font_cache_glyph

This function lets you pre-cache a character glyph from a font.

If you don't pre-cache a character using this function, it's automatically cached before it's drawn for the first time.

This function returns a struct with the x and y position of the glyph on the font's texture page, e.g. { x : 208, y : 62 }. To get a handle to the texture page that the cached glyph is on you can use font_get_texture.

 

Syntax:

font_cache_glyph(font, glyph_index);

ArgumentTypeDescription
fontFont AssetThe font to cache a character or glyph from
glyph_indexRealThe index (or character code) of the glyph to cache (see ord/string_ord_at)

 

Returns:

Struct

 

Example:

var _glyph = font_cache_glyph(fnt_gui, 65);

The above code caches the glyph with the index 65 from a font asset, and stores the returned struct in a local variable.