Epic: #113 · Milestone: MC4 — Display & 2D
Why
Only PSF bitmap fonts work today (8×16 on a 4K panel). MASTER_PLAN §9 names fonts as the weak point and lists a Home TrueType rasterizer as an unstarted Phase 4 deliverable. A 10-foot UI is mostly text at 24–96 px; nothing in ~/Code rasterises outlines (ts-font-editor parses TTF/OTF/WOFF2 and gives Path/Glyph outlines — a useful reference for the table parser; ts-svg has a TS scanline rasteriser whose algorithm can be ported).
Tasks
- Parser:
cmap(formats 4/12),glyf/loca,hmtx/hhea,head,kern+GPOSpair adjustment,CFFcharstrings (Type 2) for OTF; variable fonts out of scope. - Rasteriser: quadratic/cubic flattening, non-zero winding scanline with 4× vertical/8-bit coverage AA, gamma-aware blending; no hinting (large sizes).
- Shaper-lite: Latin ligature-free shaping, combining marks, bidi out of scope for v1; script fallback chain (UI font → symbol font → tofu).
- Glyph atlas (per size, LRU, 4 MB cap) uploaded to the compositor as an alpha texture; text layout API (measure, wrap, ellipsis) used by Craft
text.home. - Fonts shipped: pick a permissively licensed family (the user's
~/Code/Fonts/nps-fontsfirst), subset at build time withts-font-editor. - CI: golden renders in QEMU x86 with a tolerance.
Acceptance
fb-boot-log variant renders the boot log in TrueType at 32 px; the Craft demo draws a paragraph at 6 sizes; a 500-glyph screen paints in ≤ 3 ms on the Pi.
Size: L · Depends on: — (x86 QEMU first; can start now) · Blocks: #92, #86