Skip to content

paint: fall back to DejaVu Sans for a character the family has no glyph for - #145

Merged
tannevaled merged 1 commit into
mainfrom
glyph-fallback
Sep 7, 2026
Merged

tannevaled merged 1 commit into
mainfrom
glyph-fallback

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

A character the family's face has no glyph for drew as nothing (a user's report lost its and circled digits yesterday); a browser falls back per character to the system's fonts. paint.Fonts now carries DejaVu Sans as the last resort (go-opentype/fonts#18, dejavusans):

  • Fonts.Runs(text, family, weight, italic) []Run{Text, Fallback} splits a text by glyph coverage (whitespace joins the run it is in; a character neither covers — CJK — stays with the family);
  • Measure sums both faces' advances, so layout reserves the room; drawText walks the same runs;
  • a consumer that sets the same text elsewhere (go-pdfkit/html2pdf embedding both fonts) walks Runs too, so its glyphs come from the faces the layout measured with.

The fonts module moves to v0.9.1-0.20260907071658-dd9656234a3d (opentype v0.12.0 with it); its newer Inter covers and ①–⑩ by itself, Lora and Go Mono do not. Every existing fixture and pixel test is unchanged by the bump; paint stays at 100 % (tests: coverage split per family, measured widths, inked pixels, face cache).

🤖 Generated with Claude Code

…ph for

A character the family's face had no glyph for drew as nothing — the
user's report lost its "↔" and circled digits — where a browser falls
back per character to the system's fonts. Fonts now carries DejaVu Sans
(go-opentype/fonts/dejavusans: arrows, mathematical operators, box
drawing, geometric shapes, braille, Greek, Cyrillic, ①–⑩ — breadth, not
looks) as the last resort: Runs splits a text into the stretches the
family sets and those the fallback sets (a character neither covers, CJK,
stays with the family), Measure sums both faces' advances so layout
reserves the room, and drawText walks the same runs. A consumer that sets
the same text elsewhere — a PDF exporter embedding both fonts — walks
Runs too, so its glyphs come from the faces the layout measured with.

The fonts module moves to the DejaVu-bearing commit, which also brings a
newer Inter that covers arrows and ①–⑩ itself (Lora and Go Mono do not);
every existing fixture and pixel test is unchanged by the bump.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit bd351df into main Sep 7, 2026
7 checks passed
@tannevaled
tannevaled deleted the glyph-fallback branch September 7, 2026 07:22
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.

1 participant