default_font : Font
Text
:= []
Text module - fonts, text measurement, and prepared text drawing.
Measurement is a hosted effect. Prepare text once when content/style changes, then draw the prepared value without measuring again.
load_font! : LoadFont => Try(Font, [FontLoadFailed, ResourceLimit, ..])
measure_builder! : Builder => Size
prepare_builder! : Builder => Try(Prepared, [ResourceLimit, ..])
align_top_left : Align
align_top_center : Align
align_top_right : Align
align_center : Align
align_middle_left : Align
align_middle_right : Align
align_bottom_left : Align
align_bottom_center : Align
align_bottom_right : Align
align_offset : Size, Align -> Vec2
origin_for : Vec2, Size, Align -> Vec2
draw_prepared! : Frame, { text : Prepared, pos : Vec2, color : Color, align : Align } => { }
Draw owns the host resource lifecycle; prepared text retains loaded fonts through the same ARC value as all other drawing APIs.
HAlign : [Left, Center, Right]
VAlign : [Top, Middle, Bottom]
Align : {
horizontal : HAlign,
vertical : VAlign,
}
Builder
Text.Builder :: # (opaque)
Prepared
Text.Prepared :: # (opaque)
Host-owned immutable text. Its ARC handle retains any loaded font and its cached native NUL-terminated bytes are reused by every draw.