Starts a new run of prepared text, dropping what an earlier run gathered, glyphs and quads alike.
A run is built with begin_prepare_text, any number of append_prepare_text calls and end_prepare_text. After the end,
font.current_quads holds one Font_Quad per glyph, so the layout can be looked at, and draw_prepared_text draws the run
wherever it is asked to. prepare_text does the three steps for one string and returns its width.
#import "Simp";
#import "File";
draw_label :: (font: *Dynamic_Font) {
begin_prepare_text(font);
append_prepare_text(font, "Score: ");
append_prepare_text(font, "42");
end_prepare_text(font);
// The quads are laid out from the origin, one per glyph, left to right.
last := font.current_quads[font.current_quads.count - 1];
width := last.lr.x;
draw_prepared_text(font, 20, 40, .{ 1, 1, 0, 1 });
}This one is only checked to compile, not run.
begin_prepare_text :: (font: *Dynamic_Font)
Starts a new run of prepared text, dropping what an earlier run gathered, glyphs and quads alike.
A run is built with begin_prepare_text, any number of append_prepare_text calls and end_prepare_text. After the end,
font.current_quads holds one Font_Quad per glyph, so the layout can be looked at, and draw_prepared_text draws the run
wherever it is asked to. prepare_text does the three steps for one string and returns its width.
Parameters
- font: *Dynamic_Font
#import "Simp";
#import "File";
draw_label :: (font: *Dynamic_Font) {
begin_prepare_text(font);
append_prepare_text(font, "Score: ");
append_prepare_text(font, "42");
end_prepare_text(font);
// The quads are laid out from the origin, one per glyph, left to right.
last := font.current_quads[font.current_quads.count - 1];
width := last.lr.x;
draw_prepared_text(font, 20, 40, .{ 1, 1, 0, 1 });
}This one is only checked to compile, not run.