Skip to content

supervisor: size the terminal font bitmap for the glyphs the font has - #11365

Open
lynt-smitka wants to merge 1 commit into
adafruit:mainfrom
MakerClassCZ:terminal-font-tiles
Open

supervisor: size the terminal font bitmap for the glyphs the font has#11365
lynt-smitka wants to merge 1 commit into
adafruit:mainfrom
MakerClassCZ:terminal-font-tiles

Conversation

@lynt-smitka

Copy link
Copy Markdown

The terminal font bitmap is sized for every character in the locale's sample text, but only the characters the font has are drawn. The rest are blank tiles that no glyph index can reach: a Japanese build allocates 520 tiles and uses 95.

Size the bitmap and the tile grids from filtered_characters instead.

Generated output is byte-identical for en_US, de_DE, fr and ru. It also shrinks for ko by 3552 bytes and for cs by 48. Nothing changes on screen, those characters were never drawn; the console output is unaffected either way.

The other way round is a board-level choice that stays open: point CIRCUITPY_DISPLAY_FONT at a font that has the glyphs, as the commented-out line in adafruit_fruit_jam suggests.

# CIRCUITPY_DISPLAY_FONT = $(TOP)/tools/fonts/unifont-16.0.02-all.bdf
# CIRCUITPY_FONT_EXTRA_CHARACTERS = "🖮🖱️"

Flash in a Japanese build:

board before after saved free after
bluemicro840 534552 530712 3840 5864
datalore_ip_m4 497740 493900 3840 5812

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.
@dhalbert

Copy link
Copy Markdown
Collaborator

@tannewt this makes sense to me but not sure of all the consequences

@dhalbert
dhalbert requested a review from tannewt September 14, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants