natiny.font.set_fallback
natiny.font.set_fallback(font, fallback)
Names another font to draw the code points this one has no outline for.
Parameters
| Name | Type | Description |
|---|---|---|
font |
number |
Font handle from natiny.font.create |
fallback |
number or nil |
Font used for missing glyphs; nil clears the fallback |
Example
local latin = natiny.font.create(roboto, 24)
local emoji = natiny.font.create(noto_emoji, 24)
natiny.font.set_fallback(latin, emoji)
natiny.render.text(latin, 10, 10, "Ready 馃殌")
Notes
- Resolution is per code point, and measuring follows the same chain as drawing.
- A fallback may have its own fallback. Resolution follows at most eight fonts.
- A font cannot be its own fallback; that call is ignored.
- Kerning does not cross the boundary between two faces - there is no pair to look up, and the two have no shared opinion about the gap.
- Destroying the fallback quietly ends the arrangement; the glyphs go back to the missing-glyph box.
- Font sizes are independent; create compatible faces at matching sizes when they should share a line.