natiny.font.get_descent

Lua
natiny.font.get_descent(font) -> descent

Returns how far the font reaches below the baseline, in drawing units.

Parameters

Name Type Description
font number Font handle from natiny.font.create

Returns

Type Description
number Non-negative distance below the baseline in drawing units, or 0 for an invalid handle

Example

Lua
local ascent  = natiny.font.get_ascent(font)
local descent = natiny.font.get_descent(font)
local w = natiny.font.measure_text(font, text)
natiny.render.line(x, y + ascent + descent, x + w, y + ascent + descent, 1)

Notes

  • Counted downwards and positive: a descent of 5 means the tails reach five units below the baseline.
  • ascent + descent is the font's extent around the baseline. The value from natiny.font.get_line_height also includes the line gap.