mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 11:43:19 +08:00
docs: Improve documentation around SpriteFontTextFormatter (#2661)
Add a class-level doc comment to `SpriteFontTextFormatter`, analogous to `TextPainterTextFormatter`. Also, super-specify the return type of the `format` method to facilitate understanding (again, this makes it more aligned with its twin `TextPainterTextFormatter`).
This commit is contained in:
@ -4,9 +4,10 @@ import 'dart:ui' hide LineMetrics;
|
||||
import 'package:flame/src/text/common/line_metrics.dart';
|
||||
import 'package:flame/src/text/common/sprite_font.dart';
|
||||
import 'package:flame/src/text/elements/sprite_font_text_element.dart';
|
||||
import 'package:flame/src/text/elements/text_element.dart';
|
||||
import 'package:flame/src/text/formatters/text_formatter.dart';
|
||||
|
||||
/// [SpriteFontTextFormatter] will render text using a [SpriteFont] font,
|
||||
/// creating a [SpriteFontTextElement].
|
||||
class SpriteFontTextFormatter extends TextFormatter {
|
||||
SpriteFontTextFormatter.fromFont(
|
||||
this.font, {
|
||||
@ -25,7 +26,7 @@ class SpriteFontTextFormatter extends TextFormatter {
|
||||
final Paint paint;
|
||||
|
||||
@override
|
||||
TextElement format(String text) {
|
||||
SpriteFontTextElement format(String text) {
|
||||
var rects = Float32List(text.length * 4);
|
||||
var transforms = Float32List(text.length * 4);
|
||||
var j = 0;
|
||||
|
||||
Reference in New Issue
Block a user