™️font_base
This type represents the base class for font types. You cannot create an instance of this type. Instead, use the children types.
height
FieldRead only
Type: float
Font height, in pixels.
ascent
Field
Type: float
Font ascent value, in pixels.
descent
Field
Type: float
Font descent value, in pixels.
line_gap
Field
Type: float
Font line gap, in pixels.
kerning_gap
Field
Type: float
Font kerning gap, in pixels.
outline_alpha
Field
Type: float
Font outline opacity (0 to 1). Defaults to 0.45.
flags
FieldRead only
Type: font_flags
Font flags. Use bit library to read flags.
y_offset
Field
Type: int
Glyph Y offset, in pixels. Will alter the location of a glyph in the atlas. Changing this value after the font was created is meaningless.
x_offset
Field
Type: int
Glyph X offset, in pixels. Will alter the location of a glyph in the atlas. Changing this value after the font was created is meaningless.
fallback_font
Field
Type: font_base
Fallback font to use, in case a glyph is not found in this font. Is it useful when one font does not have codepoints for specific symbols, that are present in another font, but you still want to prefer this font's glyphs over other font.
dropshadow_color
Field
Type: color
Shadow color. Only R, G, B values are used.
get_kerned_char_width
Method
Returns character width, included with kerning.
Arguments
Name
Type
Description
left
int
Previous character codepoint.
right
int
Current character codepoint.
Returns
Type
Description
float
Distance, in pixels.
Example
get_kerning
Method
Returns kerning value for a single character. If kerning is disabled, will instead return kerning gap.
Arguments
Name
Type
Description
cp
int
Codepoint.
Returns
Type
Description
float
Kerning value, in pixels.
Example
get_text_size
Method
Returns text area size.
Arguments
Name
Type
Description
text
string
Text.
skip_scaling
bool
If set to true, will skip global DPI scaling. Defaults to false.
til_newline
bool
Calculate size only until a line break is met. Defaults to false.
Returns
Type
Description
Text area size.
Example
wrap_text
Method
Wraps text to meet the desired width. Wrapping is done by breaking text by words and inserting line breaks in between. If one of the words is longer than the target width, will instead use that word's width.
Arguments
Name
Type
Description
text
string
Text to wrap.
width
float
Target width.
Returns
Type
Description
string
Wrapped text.
Example
get_glyph
Method
Returns glyph information for a character.
Arguments
Name
Type
Description
codepoint
int
Codepoint.
Returns
Type
Description
Glyph information.
Example
get_texture
Method
Returns a texture atlas that contains the provided glyph.
Arguments
Name
Type
Description
Returns
Type
Description
int
Texture pointer, or nil if not found.
Example
Last updated