Skip to content

Fix hard crash from a custom terminal font - #11707

Open
mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:fix-10848
Open

mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:fix-10848

Conversation

@mikeysklar

@mikeysklar mikeysklar commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

What

Proportional terminal fonts now get a cell as wide as their widest glyph.

Glyph slots stay inside the cache.

Fonts that still can't work use the built-in font.

Why

Fixes #10848.

The font has a normal space, but the width guess picked a 3 px cell.

Glyphs did not fit, slots ran past the cache, and the terminal raised during boot.

Case Before After
Issue font, desktop lab, 3 runs no boot boots in its own font, wide gaps
Monospace ASCII font, desktop lab no boot boots, custom font
65 bad or truncated fonts, 3 passes 38 no boot, 1 pass all boot
terminalio and 7 valid fonts (2 at 2/4bpp show no text either way) pixel identical
One-glyph font not checked boots
Forced second font init failure, earlier revision with the same display.c change crash built-in font
CLUE, issue font and ASCII font, 3 boots each issue font loses USB, measured on an earlier commit boots, safe mode reason NONE
Free heap on CLUE, built-in font 129984 129984
Free heap on CLUE, issue font 8.1 KB less than built-in
Flash, CLUE build +192 bytes
Fruit Jam safe mode (issue) not run

On a real CLUE, the issue's font now boots as the terminal, with wide gaps between letters.

CLUE terminal showing the issue's font, with wide gaps between letters

Limits: proportional text is monospaced, so gaps are wide and some glyphs clip. A font with two widths that aren't 1:2 uses the built-in font. Not fixed here: bits_per_pixel >= 6 still crashes at boot, and font deinit leaks the glyph bitmap.

@lynt-smitka your cp-desktop-lab reproduced this crash and tested the fix before any hardware run.

AI assistance

Claude wrote the patch and ran the lab and CLUE tests. I directed the work and reviewed the results.

🤖 Generated with Claude Code

Give proportional fonts a cell as wide as their widest glyph, keep glyph
slots inside the cache, and fall back to the built-in font when a terminal
font still can't load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhalbert
dhalbert requested a review from tannewt November 1, 2026 17:07
@mikeysklar
mikeysklar requested a review from dhalbert November 1, 2026 17:31
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.

Hardcrash from custom terminal font

1 participant