fix(takumi): treat single-entry variable fonts as axis-driven (defensive)#599
Merged
Merged
Conversation
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.
commit: |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
Reported on https://github.com/maevsi/vibetype (no og-image issue filed).
❓ Type of change
📚 Description
dedupeFontsByBinaryflagged a binary as variable only when multiple weight tags shared it (weights.size > 1). With a single-entry variable WOFF2 it would pass an explicitweighttotakumi.loadFontinstead of letting the renderer auto-detect the wght axis. PropagatesweightRangefrom the @nuxt/fonts CSS parser throughParsedFontandFontConfigso 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
weightRangeplumbing.