natiny_font_get_descent
C
float natiny_font_get_descent(NatinyFont font);
Returns how far the font reaches below the baseline, in drawing units.
Parameters
Returns
| Type |
Description |
float |
Non-negative distance below the baseline in drawing units, or 0.0f for an invalid handle |
Example
C
float ascent = natiny_font_get_ascent(font);
float descent = natiny_font_get_descent(font);
float width = 0.0f;
natiny_font_measure_text(font, text, &width, NULL);
natiny_render_line(x, y + ascent + descent,
x + width, y + ascent + descent, 1.0f);
Notes
- Counted downwards and positive: a descent of
5 means the tails reach
five units below the baseline. TrueType reports it as a negative offset;
natiny turns the sign once, here.
ascent + descent is the font's extent around the baseline. The value from
natiny_font_get_line_height also includes the line gap.