UI module

draw_text_baseline

procedureextensionexperimentalsince 0.31.0Source

Draw one line of text with its baseline at baseline, returning its width in points.

Example↗
ui := headless();
defer free_ui(*ui);
width := draw_text_baseline(*ui, 10, 30, "hello", .{ size = 10 });
assert(width == 30);
draw_text_baseline :: (
    ui: *UI_State,
    x: float,
    baseline: float,
    text: string,
    style: Text_Style
) -> float

Draw one line of text with its baseline at baseline, returning its width in points.

Parameters

ui: *UI_State
the UI whose display list gets the glyphs.
x: float
left edge of the line.
baseline: float
vertical position of the baseline.
text: string
the UTF-8 text. Control characters other than tab are skipped.
style: Text_Style
font, size and colour.

Returns

float
Example↗
ui := headless();
defer free_ui(*ui);
width := draw_text_baseline(*ui, 10, 30, "hello", .{ size = 10 });
assert(width == 30);

See also