UI module

add_synthetic_font

procedureextensionexperimentalsince 0.31.0Source

Add a fixed-metrics font (no glyphs are drawn) to the next slot.

Example↗
ui := headless();
defer free_ui(*ui);
width := text_width(*ui.text, "abcde", .{ size = 10 });
assert(width == 30);  // every character is 0.6 of the size wide
add_synthetic_font :: (text: *Text_System)

Add a fixed-metrics font (no glyphs are drawn) to the next slot.

Parameters

text: *Text_System
the text system to add the font to.
Example↗
ui := headless();
defer free_ui(*ui);
width := text_width(*ui.text, "abcde", .{ size = 10 });
assert(width == 30);  // every character is 0.6 of the size wide

See also