Skip to content

Stage B, PR 3: PortableFont v3 with full layer-stack round-trip#67

Merged
aurpelai merged 1 commit into
mainfrom
feat/portable-font-v3
Jun 22, 2026
Merged

Stage B, PR 3: PortableFont v3 with full layer-stack round-trip#67
aurpelai merged 1 commit into
mainfrom
feat/portable-font-v3

Conversation

@aurpelai

Copy link
Copy Markdown
Owner

Summary

  • Splits the monolithic portable.ts into a directory: codec, types, export, import (dispatch), import-v2 (shim). Public API at @/core/font/portable is unchanged.
  • v3 wire format serialises the full layer stack — per-layer pixels, offsets, visibility, lock, color, preview — so multi-layer fonts no longer lose layers on JSON round-trip.
  • v2 bundles are accepted via import-v2.ts: each v2 glyph reconstitutes as a single-base-layer v3 glyph; the v2 top-level xoffset/yoffset/xadvance lift onto bmf. v1 still throws.
  • ADR-0001 amended with the per-version import-shim policy.

Test plan

  • pnpm test (109 tests, including new multi-layer v3 round-trip + v2 shim cases)
  • pnpm build
  • pnpm lint
  • Manual: round-trip a multi-layer font via Export Portable → Import Portable; confirm every layer's pixels/offsets/visibility/lock survives
  • Manual: import a v2 JSON file exported from main before this PR; confirm it loads with a single base layer and correct BMF metadata
  • Manual: attempt to import a v1 bundle — should fail with Unsupported font version: 1

🤖 Generated with Claude Code

Splits the monolithic portable.ts into a directory with one module per
concern (codec, types, export, import dispatch, v2 shim). v3 serialises
the full layer stack — per-layer pixels, offsets, visibility, lock,
color, preview — so multi-layer fonts no longer lose layers on JSON
round-trip.

v2 bundles are still accepted via import-v2.ts: each v2 glyph
reconstitutes as a single-base-layer v3 glyph, with the v2 top-level
xoffset/yoffset/xadvance lifted onto `bmf`. v1 still throws — no v1
data is worth a shim. ADR-0001 amended with the per-version import
shim policy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aurpelai aurpelai merged commit 49c8f9a into main Jun 22, 2026
1 check passed
@aurpelai aurpelai deleted the feat/portable-font-v3 branch June 22, 2026 14:51
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