natiny.font.preload

Lua
natiny.font.preload(font, text)

Rasterizes every glyph the text uses now, instead of on the frame that first draws it.

Parameters

Name Type Description
font number Font handle from natiny.font.create
text string UTF-8 text whose glyphs to bake

Example

Lua
local font = natiny.font.create(res, 24)

natiny.font.preload(font, "Играть Настройки Выход")

Notes

  • A glyph is normally baked when first drawn. Preloading moves rasterization and atlas upload to the call site.
  • Line breaks and tabs in text are skipped; they have no glyph.
  • Follows the fallback chain, so a glyph this font lacks is baked into the atlas of whichever font supplies it.