From 59cfdb10f71a66f565d54e7a24c8ab6b94ffc8e5 Mon Sep 17 00:00:00 2001 From: Vladimir Smitka Date: Sun, 13 Sep 2026 16:37:29 +0000 Subject: [PATCH] supervisor: size the terminal font bitmap for the glyphs the font has The bitmap is allocated for every character in the locale's sample text, but only the characters the font actually has are drawn into it, so the rest ship as blank tiles. The terminal font has no CJK glyphs, so a Japanese build carries 520 tiles where 95 are used. Size the bitmap, its width and the tile grids from filtered_characters, which is the list the glyph lookup already uses. Generated output is byte-identical for en_US, de_DE, fr and ru. It shrinks for ja (18707 to 7181 bytes of generated C), ko and cs. Flash on a Japanese build: bluemicro840 3592 bytes, datalore_ip_m4 3828 bytes. --- tools/gen_display_resources.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py index 9ed829f7d37..f857754e95f 100644 --- a/tools/gen_display_resources.py +++ b/tools/gen_display_resources.py @@ -76,7 +76,7 @@ def _load_row(self, y, row): print("Font missing", missing, "characters", file=sys.stderr) tile_x, tile_y, dx, dy = f.get_bounding_box() -total_bits = tile_x * len(all_characters) +total_bits = tile_x * len(filtered_characters) total_bits += 32 - total_bits % 32 bytes_per_row = total_bits // 8 b = bytearray(bytes_per_row * tile_y) @@ -283,7 +283,7 @@ def _load_row(self, y, row): .inline_tiles = false, .in_group = true }}; -""".format(len(all_characters), tile_x, tile_y) +""".format(len(filtered_characters), tile_x, tile_y) ) c_file.write( @@ -311,7 +311,7 @@ def _load_row(self, y, row): .inline_tiles = false, .in_group = true }}; -""".format(len(all_characters), tile_x, tile_y) +""".format(len(filtered_characters), tile_x, tile_y) ) c_file.write( @@ -345,7 +345,7 @@ def _load_row(self, y, row): .bitmask = 0x01, .read_only = true }}; -""".format(len(all_characters) * tile_x, tile_y, bytes_per_row / 4) +""".format(len(filtered_characters) * tile_x, tile_y, bytes_per_row / 4) )