Skip to content

Mojo graphics font

mojo:mojo.graphics.Font

Class Font Extends std.resource.Resource#

The Font class.

Fonts are used when drawing text to a canvas using Canvas.DrawText.

To load a font, use the Font.Load function. Fonts should be in .otf, .ttf or .fon format.

Once a font is loaded it can be used with a canvas via the Canvas.Font property.

Properties
FirstChar The first character in the font. (read only)
Height The font height in pixels. (read only)
NumChars The number of characters in the font. (read only)
Methods
GetGlyph Gets the glyph for a character.
GetGlyphPage Gets the glyph page for a character.
GetKerning Gets the kerning between 2 characters.
TextWidth Measures the width of some text when rendered by the font.
Functions
Load Loads a font from a file.