natiny.font.get_line_height

Lua
natiny.font.get_line_height(font) -> line_height

Returns the vertical distance between consecutive baselines.

Parameters

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

Returns

Type Description
number Line height in drawing units, or 0 for an invalid handle

Example

Lua
local lh = natiny.font.get_line_height(font)

Notes

  • The value is the font's natural line height multiplied by the factor set by natiny.font.set_line_spacing.
  • Everything that stacks lines uses this one number, so the height from natiny.font.measure_text, the wrapping in natiny.font.measure_wrapped and the lines natiny.render.text_box draws all move together with it.
  • natiny.font.get_ascent and natiny.font.get_descent report distances around the baseline; their sum does not include the font's line gap.