Skip to content

refactor(font-system): source substitution evidence from @docfonts/fallbacks#3669

Merged
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/docfonts-fallbacks-adoption
Jun 5, 2026
Merged

refactor(font-system): source substitution evidence from @docfonts/fallbacks#3669
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/docfonts-fallbacks-adoption

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

SuperDoc's font-fallback evidence was a hand-copied snapshot of the docfonts registry. This sources the measured data from the published @docfonts/fallbacks package (pinned 0.2.0) instead, so there's one upstream source of truth and no drift.

  • Type shapes stay local; the package's rows are pinned to them by a const assignment (a build-time drift guard), which also keeps the public facade free of any @docfonts/fallbacks reference consumers can't resolve.
  • The resolver derives its maps through the package's asset-safe decision (getRenderableFallback), gated by BUNDLED_MANIFEST, so substitutes we haven't shipped assets for (Georgia, Arial Narrow, Baskerville) stay inert. Key normalization unchanged.
  • Behavior-preserving: the same seven rows activate and the default toolbar is identical. The offering layer now classifies the whole registry, setting up the document-specific dropdown without changing what ships.

Verified: check:types pass; check:public:superdoc pass (14 stages); frozen-lockfile pass; @docfonts/fallbacks bundled away (no import/dep in the published package). Unit tests in CI.

…llbacks

The hand-vendored evidence DATA becomes an import from the published @docfonts/fallbacks registry (pinned 0.2.0), pinned to SuperDoc's local type contract by a const assignment that fails the build if the package shape drifts. The type shapes stay local so the public facade stays self-contained: re-exporting the package's types would leave an unresolvable @docfonts/fallbacks reference in superdoc's emitted .d.ts. One upstream source of truth for the measured data.

docfonts owns the evidence and the asset-safe fallback decision; SuperDoc owns what activates. The resolver derives its maps through getRenderableFallback gated by BUNDLED_MANIFEST, so the registry's extra substitutes (Georgia, Arial Narrow, ...) stay inert until their assets ship; key normalization stays normalizeFamilyKey.

No behavior change: the same seven rows activate, the default toolbar is unchanged, and FONT_OFFERINGS now classifies the full registry for the later document-specific surface without expanding the toolbar.
@caio-pizzol caio-pizzol requested a review from a team as a code owner June 5, 2026 23:49
@caio-pizzol caio-pizzol merged commit 8f90d4d into main Jun 5, 2026
59 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/docfonts-fallbacks-adoption branch June 5, 2026 23:55
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants