natiny.font.get_ascent
Lua
natiny.font.get_ascent(font) -> ascent
Returns how far the font reaches above the baseline, in drawing units.
Parameters
Returns
| Type |
Description |
number |
Non-negative distance above the baseline in drawing units, or 0 for an invalid handle |
Example
Lua
local ascent = natiny.font.get_ascent(big)
natiny.render.text(big, x, y, "A")
natiny.render.text(small, x + 30, y + ascent - natiny.font.get_ascent(small), "a")
Notes
natiny.render.text places the top of the line at y, so the baseline
sits at y + ascent. Two fonts of different sizes line up on the baseline
and not on the top edge, which is what this is for.
- Unaffected by
natiny.font.set_line_spacing.