pre-cache ascii range in font atlas

This commit is contained in:
Alessandro Mauri 2024-12-16 17:06:33 +01:00
parent 2e0c6333d3
commit 7d9a8a1363

View File

@ -92,9 +92,9 @@ fn void! Font.load(&font, String name, ZString path, uint height, float scale)
font.atlas.new(font.id, ATLAS_GRAYSCALE, size, size)!;
// preallocate the ASCII range
// for (char c = ' '; c < '~'; c++) {
// font.get_glyph((Codepoint)c)!;
// }
for (char c = ' '; c < '~'; c++) {
font.get_glyph((Codepoint)c)!;
}
}
fn Glyph*! Font.get_glyph(&font, Codepoint code)