natiny.font.preload_range

Lua
natiny.font.preload_range(font, first, last)

Rasterizes every glyph in a range of code points.

Parameters

Name Type Description
font number Font handle from natiny.font.create
first number or string First Unicode code point, or a UTF-8 string whose first character is used
last number or string Last Unicode code point, inclusive, or a UTF-8 string whose first character is used

Example

Lua
natiny.font.preload_range(font, 0x0410, 0x044F)

Notes

  • The endpoints are inclusive and are swapped when last is less than first.
  • A code point the face has no outline for costs an entry in the glyph table and no atlas space, so a generous range is cheap in pixels and not free in memory. Prefer natiny.font.preload when the strings are known.
  • The atlas is finite. A range wide enough to overflow it prints "font atlas is full" once and the glyphs past that point are not drawn.
  • Follows the fallback chain.
  • An empty or malformed string endpoint raises a Lua error.