From 994e8b9e62e561561e49f2cffb82e07fabdd25a0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 25 Feb 2023 22:38:33 -0800 Subject: [PATCH] altos/draw: Only cover ASCII Skip the rest of latin-1 Signed-off-by: Keith Packard --- src/draw/font-convert | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 */ -- 2.30.2