UI module

load_font_data

procedureextensionexperimentalsince 0.31.0Source

Open a font from bytes (which the text system keeps and frees).

Example↗
ui := headless();
defer free_ui(*ui);
#import "File";

data := read_entire_file("fonts/Inter-Regular.ttf");
load_font_data(*ui.text, data, "Inter");

This one is only checked to compile, not run.

load_font_data :: (text: *Text_System, data: string, name: string = "") -> bool

Open a font from bytes (which the text system keeps and frees).

Parameters

text: *Text_System
the text system to add the font to.
data: string
the font file's bytes. The call takes ownership: it copies them and frees data, even on failure.
name: string = ""
a label for the font, copied.

Returns

bool
Example↗
ui := headless();
defer free_ui(*ui);
#import "File";

data := read_entire_file("fonts/Inter-Regular.ttf");
load_font_data(*ui.text, data, "Inter");

This one is only checked to compile, not run.

See also