TextRenderer class abstract
TextRenderer is the abstract API that Flame uses for rendering text. This class can be extended to provide another implementation of text rendering in the engine.
See TextPaint for the default implementation offered by Flame
- Implementers
Constructors
- TextRenderer({TextDirection? textDirection})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textDirection → TextDirection
-
final
Methods
-
measureText(
String text) → Vector2 -
Given a
text
String, returns a Vector2 with the size of thattext
has. -
measureTextHeight(
String text) → double -
Given a
text
String, returns the height of thattext
. -
measureTextWidth(
String text) → double -
Given a
text
String, returns the width of thattext
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render(
Canvas canvas, String text, Vector2 position, {Anchor anchor = Anchor.topLeft}) → void -
Renders a given
text
in a given positionposition
using the providedcanvas
andanchor
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
defaultRenderersRegistry
↔ Map<
Type, TextRenderer Function()> -
A registry containing default providers for every TextRenderer subclass;
used by createDefault to create default parameter values.
getter/setter pair
Static Methods
-
createDefault<
T extends TextRenderer> () → T -
Given a generic type
T
, creates a default renderer of that type.