Skip to content

fix(takumi): treat single-entry variable fonts as axis-driven (defensive)#599

Merged
harlan-zw merged 1 commit into
mainfrom
fix/takumi-variable-font-single-weight
May 5, 2026
Merged

fix(takumi): treat single-entry variable fonts as axis-driven (defensive)#599
harlan-zw merged 1 commit into
mainfrom
fix/takumi-variable-font-single-weight

Conversation

@harlan-zw

@harlan-zw harlan-zw commented May 5, 2026

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Reported on https://github.com/maevsi/vibetype (no og-image issue filed).

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

dedupeFontsByBinary flagged a binary as variable only when multiple weight tags shared it (weights.size > 1). With a single-entry variable WOFF2 it would pass an explicit weight to takumi.loadFont instead of letting the renderer auto-detect the wght axis. Propagates weightRange from the @nuxt/fonts CSS parser through ParsedFont and FontConfig so dedupe can detect a variable binary regardless of how many weight tags are present.

This is a defensive consistency fix — end-to-end testing of the vibetype reproducer showed takumi auto-varies the axis correctly even with the explicit weight, so this PR alone does not fix the user-visible weight regression. The actual fix lives in #600 and depends on this one for the weightRange plumbing.

When a variable WOFF2 reaches the takumi renderer as a single entry (e.g. in
dev where build-time per-weight expansion hasn't populated fontRequirements
yet), dedupe was passing an explicit `weight` to takumi.loadFont. Takumi then
mis-mapped the wght axis at render time, so a requested weight 400 rendered
near axis 100 while 700 rendered correctly, with a linear skew in between.

Propagate `weightRange` from the @nuxt/fonts CSS parser through ParsedFont and
FontConfig so the runtime dedupe can detect a variable binary even when only
one weight tag is present, and pass `weight: undefined` so takumi auto-detects
the axis from the font metadata.
@pkg-pr-new

pkg-pr-new Bot commented May 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-og-image@599

commit: 5d051b8

@harlan-zw harlan-zw changed the title fix(takumi): treat single-entry variable fonts as axis-driven fix(takumi): treat single-entry variable fonts as axis-driven (defensive) May 5, 2026
@harlan-zw harlan-zw merged commit c053a79 into main May 5, 2026
10 checks passed
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