UI module

font_metrics

procedureextensionexperimentalsince 0.31.0Source

Ascent, descent and line height of a font slot at size points.

Example↗
ui := headless();
defer free_ui(*ui);
metrics := font_metrics(*ui.text, .SANS, 20);
assert(metrics.line_height > 0);
font_metrics :: (
    text: *Text_System,
    slot: Font_Slot,
    size: float
) -> Font_Metrics

Ascent, descent and line height of a font slot at size points.

Parameters

text: *Text_System
the text system holding the fonts.
slot: Font_Slot
which font to measure.
size: float
the font size in points.

Returns

Example↗
ui := headless();
defer free_ui(*ui);
metrics := font_metrics(*ui.text, .SANS, 20);
assert(metrics.line_height > 0);

See also