textmode.js / TextmodeFont
Class: TextmodeFont
Manages the textmode font used for rendering characters.
This class coordinates font loading, character extraction, texture atlas creation, and provides character color information. It acts as a facade for the font system.
Accessors
characters
Get Signature
get characters(): TextmodeCharacter[];
Returns the array of TextmodeCharacter objects in the font.
Returns
fontSize
Get Signature
get fontSize(): number;
Returns the font size used for rendering.
Returns
number
maxGlyphDimensions
Get Signature
get maxGlyphDimensions(): object;
Returns the maximum dimensions of a glyph in the font.
Returns
object
height
height: number;
width
width: number;
textureColumns
Get Signature
get textureColumns(): number;
Returns the number of columns in the texture atlas.
Returns
number
textureRows
Get Signature
get textureRows(): number;
Returns the number of rows in the texture atlas.
Returns
number
Methods
getCharacterColor()
getCharacterColor(character): [number, number, number];
Get the color associated with a character.
Parameters
character
string
The character to get the color for.
Returns
[number
, number
, number
]
The RGB color as an array [r, g, b]
.
getCharacterColors()
getCharacterColors(characters): [number, number, number][];
Get the colors associated with a string of characters.
Parameters
characters
string
The string of characters to get colors for.
Returns
[number
, number
, number
][]
An array of RGB colors for each character in the string. Each color is represented as an array [r, g, b]
.
hasAllCharacters()
hasAllCharacters(str): boolean;
Checks if all characters in the given string exist in the font.
Parameters
str
string
The string to check.
Returns
boolean
true
if all characters exist in the font, false
otherwise.