ReviewOS

home-lang/home-os

TrueType/OpenType rasterizer in Home (`text.home`): glyf + CFF outlines, anti-aliased scanline fill, kerning/GPOS basics, shaping for Latin + fallback, glyph atlas cache

#76
Open chris opened this 9 days ago ·
9 days ago

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 + GPOS pair adjustment, CFF charstrings (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-fonts first), subset at build time with ts-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

Sign in to comment on this issue.