From: Keith Packard Date: Sun, 26 Feb 2023 06:38:33 +0000 (-0800) Subject: altos/draw: Only cover ASCII X-Git-Tag: 1.9.16~1^2~45 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=994e8b9e62e561561e49f2cffb82e07fabdd25a0 altos/draw: Only cover ASCII Skip the rest of latin-1 Signed-off-by: Keith Packard --- diff --git a/src/draw/font-convert b/src/draw/font-convert index c7d9c780..f47ccc9c 100755 --- a/src/draw/font-convert +++ b/src/draw/font-convert @@ -103,7 +103,7 @@ void print_font(font_t font, string font_name) { int height = font.glyphs[0].height; int max_width = width; int max_height = height; - int[256] pos = { -1 ... }; + int[128] pos = { -1 ... }; int[...] bytes; bool fixed_size = true; @@ -122,9 +122,12 @@ void print_font(font_t font, string font_name) { /* build byte array */ for (int i = 0; i < dim(font.glyphs); i++) { - pos[font.glyphs[i].encoding] = dim(bytes); - for (int b = 0; b < dim(font.glyphs[i].bytes); b++) - bytes[dim(bytes)] = font.glyphs[i].bytes[b]; + if (font.glyphs[i].encoding < dim(pos)) + { + pos[font.glyphs[i].encoding] = dim(bytes); + for (int b = 0; b < dim(font.glyphs[i].bytes); b++) + bytes[dim(bytes)] = font.glyphs[i].bytes[b]; + } } /* Fill in default glyph */