Skip to content

Commit

Permalink
docs: Improve documentation around SpriteFontTextFormatter (#2661)
Browse files Browse the repository at this point in the history
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`).
  • Loading branch information
luanpotter committed Aug 20, 2023
1 parent 37271f5 commit 8401c56
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand All @@ -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;
Expand Down

0 comments on commit 8401c56

Please sign in to comment.