font_base
Last updated
Last updated
This type represents the base class for font types. You cannot create an instance of this type. Instead, use the children types.
Type: float
Font height, in pixels.
Type: float
Font ascent value, in pixels.
Type: float
Font descent value, in pixels.
Type: float
Font line gap, in pixels.
Type: float
Font kerning gap, in pixels.
Type: float
Font outline opacity (0
to 1
). Defaults to 0.45
.
Font flags. Use bit
library to read flags.
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.
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.
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.
Shadow color. Only R, G, B values are used.
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
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
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
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
Returns glyph information for a character.
Arguments
Name
Type
Description
codepoint
int
Codepoint.
Returns
Type
Description
Glyph information.
Example
Returns a texture atlas that contains the provided glyph.
Arguments
Name
Type
Description
gl
Character glyph.
Returns
Type
Description
int
Texture pointer, or nil
if not found.
Example
Type:
Type: