Skip to content

perf: subset built-in TTF fonts to ligature and kerning data - #54

Merged
prokrypt merged 1 commit into
developmentfrom
claude/project-thread-v7jlsy
Sep 27, 2026
Merged

prokrypt merged 1 commit into
developmentfrom
claude/project-thread-v7jlsy

Conversation

@prokrypt

Copy link
Copy Markdown
Owner

Before: the embedded Bitter and Lexend Deca TTFs carried every OpenType layout feature (22 GSUB features in Bitter, GPOS mark/mkmk), none of which the firmware reads. x4-pro-light-sleep firmware was 5,842,849 B (89.2% of app0).

After: the fonts keep only GSUB liga/rlig and GPOS kern, which are the only lookups FreeInkFont performs (lib/ScalableFont/ScalableGsub.h:73, freeink-sdk/libs/font/FreeInkFont/src/Gpos.cpp:226). The firmware is 5,557,872 B (84.8%), a saving of 284,977 B. Text renders the same.

How: the new scripts/subset_scalable_fonts.py subsets each font in lib/EpdFont/scalableFonts/manifest.txt in place with fontTools. It keeps every cmap codepoint, keeps GDEF and the full name table (so the copyright and OFL strings stay), and drops DSIG and STAT. The fonts had no hinting tables to lose. Re-running it is a no-op. Raw TTFs go from 945,028 to 659,500 B. OutlineFingerprint changes, so glyph caches keyed on it rebuild once.

Hardware check (X4 Pro, light-sleep build): open an EPUB in Bitter and in Lexend Deca, in regular, bold and italic, and confirm the fi/fl ligatures and kerning (for example "AV", "To") look unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_013k1W4UZTzyPQnTVXwZUbkS


Generated by Claude Code

FreeInkFont only reads GSUB liga/rlig and GPOS kern, so the other layout
features (small caps, figure styles, mark positioning, ...) in the embedded
Bitter and Lexend Deca TTFs were dead flash. scripts/subset_scalable_fonts.py
strips them in place, keeping every cmap codepoint and the name table
(copyright and license strings). Raw TTFs 945,028 -> 659,500 B;
x4-pro-light-sleep firmware 5,842,849 -> 5,557,872 B (-284,977 B).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013k1W4UZTzyPQnTVXwZUbkS
@prokrypt
prokrypt merged commit ca4fd55 into development Sep 27, 2026
9 checks passed
@prokrypt
prokrypt deleted the claude/project-thread-v7jlsy branch September 27, 2026 16:04
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