natiny_font_get_ascent
C
float natiny_font_get_ascent(NatinyFont font);
Returns how far the font reaches above the baseline, in drawing units.
Parameters
Returns
| Type |
Description |
float |
Non-negative distance above the baseline in drawing units, or 0.0f for an invalid handle |
Example
C
float ascent = natiny_font_get_ascent(big);
natiny_render_text(big, x, y, "A");
natiny_render_text(small, x + 30.0f,
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.