Font + TextFormat cache for the library's TextFields.

register() points every widget at an embedded font asset; formats are cached per (size, color, align) so text restyles never allocate. TextFields copy assigned formats internally, so sharing cached instances is safe.

Static variables

@:value("_sans")staticread onlyfontName:String = "_sans"

The active font face name (falls back to the system sans).

Static methods

staticformat(size:Int, color:Int, ?align:TextFormatAlign):TextFormat

A cached TextFormat for the library font.

Parameters:

size

font size in px

color

text color (0xRRGGBB; alpha bits are masked off)

align

paragraph alignment (default LEFT)

Returns:

the shared cached format — safe to assign, TextField copies it

staticinlinelibraryLoaded(id:String):Bool

Whether the asset library backing an id is loaded. A silent guard (no lime logging) so callers can probe openfl.utils.Assets even when a project embeds no assets at all — an unguarded Assets.exists/getX against a missing library spams ERROR: There is no asset library named "default".

Parameters:

id

an asset path, optionally library:path prefixed (defaults to the default library)

Returns:

true when the referenced library exists

staticmake(size:Int, color:Int, ?align:TextFormatAlign):TextField

Builds a non-interactive single-line auto-sizing TextField in the library font.

Parameters:

size

font size in px

color

text color

align

paragraph alignment (default LEFT)

Returns:

the configured field (mouse-transparent, not selectable)

staticregister(assetPath:String):Bool

Loads an embedded font asset and makes it the library font.

Parameters:

assetPath

the embedded font asset (e.g. assets/fonts/main.ttf)

Returns:

true when the font was found and applied

staticinlinerestyle(tf:TextField, size:Int, color:Int, ?align:TextFormatAlign):Void

Restyles an existing field with a cached format (applies to current and future text).

Parameters:

tf

the field to restyle

size

font size in px

color

text color

align

paragraph alignment (default LEFT)