Skip to content

fix(takumi): dedupe variable fonts so weights vary correctly#585

Merged
harlan-zw merged 2 commits into
mainfrom
fix/takumi-variable-font-weight
Apr 23, 2026
Merged

fix(takumi): dedupe variable fonts so weights vary correctly#585
harlan-zw merged 2 commits into
mainfrom
fix/takumi-variable-font-weight

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

❓ Type of change

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

📚 Description

@nuxt/fonts emits per-weight @font-face entries that all point at the same variable WOFF2 URL. The takumi renderer loaded that shared binary once per weight label, which pinned the wght axis, so every weight rendered at the font's default (usually 400) and bold headings looked identical to body copy.

Collapse entries sharing a binary (same family, style, src) into a single loadFont call. When a binary backs multiple weights it is loaded without a weight so takumi reads the wght axis from the font metadata; static per-weight binaries keep their explicit weight. Covered by a new unit test for the dedupe function and an image-snapshot e2e against a Public Sans fixture.

@nuxt/fonts emits per-weight @font-face entries all pointing at the same
variable WOFF2 URL. Loading that binary into takumi under multiple weight
labels prevented takumi from varying the wght axis, so every weight rendered
at the font's default axis position (typically 400).

Collapse entries sharing a binary (same family + style + src) into a single
load. When a binary backs multiple weights, omit the weight so takumi reads
the wght axis from the font metadata. Static per-weight binaries keep their
explicit weight.
@pkg-pr-new

pkg-pr-new Bot commented Apr 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: f9e1288

The original bug only surfaced in the prerender path on the user's Vercel
deployment. Add nitro.prerender.routes: ['/'] to the fixture and assert the
og:image URL lands at /_og/s/ so a regression can't silently pass by only
exercising the dynamic endpoint.
@harlan-zw harlan-zw merged commit be32596 into main Apr 23, 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