Repository navigation
fix(android): map font-weight to the wght axis for custom fonts on API 26+ - #11514
Open
aleclarson wants to merge 1 commit into
Open
aleclarson wants to merge 1 commit into
aleclarson wants to merge 1 commit into
Conversation
…I 26+ Variable fonts loaded from files ignored CSS font-weight: the Typeface Builder received only explicit font-variation-settings, so font-weight: 700 rendered at the font's default weight. The typeface cache key also lacked the weight, so two weights of the same family would collide once the axis is honored. Inject a wght axis entry derived from fontWeight unless the caller set wght explicitly, include fontWeight in the cache key, and retry with the caller's explicit settings when the augmented build throws (font lacking the wght axis). Closes NativeScript#11513
|
View your CI Pipeline Execution ↗ for commit f2843f7
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
aleclarson
added a commit
to octane-xplat/octane-xplat
that referenced
this pull request
Oct 8, 2026
Filed upstream PRs for the five patch-audit fixes and recorded them via a new upstreamPR field on the manifest entries: - nativescript-community/octane#14 — setProp undefined-skip, visibility capability, intrinsic ref types - nativescript-community/octane#15 — vite-octane .tsrx HMR matching and recipients counting - nativescript-community/ui-image#69 — iOS prefetch cacheType + headers - nfrasser/linkifyjs#572 — ICU-free \p{} regex construction - facebook/lexical#9334 — @lexical/link URL_REGEX via new RegExp - NativeScript/NativeScript#11514 — font-weight → wght axis mapping on Android (issue #11513)
This branch has not been deployed
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.
PR Checklist
npx vitest run ui/styling/font.android.spec.ts(6/6); the new spec fails 4 of 6 cases against unpatchedfont.android.ts.packages/core/ui/styling/font.android.spec.ts.What is the current behavior?
On Android API 26+, custom fonts loaded from files ignore CSS
font-weight:loadFontFromFilepasses only explicitfont-variation-settingstoTypeface.Builder.setFontVariationSettings, so a variable font withfont-weight: 700renders at its default weight.computeFontCacheKeyalso omits the weight, so two weights of the same family would collide in the typeface cache. And if a font doesn't support thewghtaxis,builder.build()throws with no retry — the file load fails outright.What is the new behavior?
wghtaxis entry derived fromfontWeight(getNumericFontWeight) is appended to the variation settings unless the caller setwghtexplicitly — explicit settings always win.fontWeightjoins the typeface cache key, so weights of one family cache independently.wghtaxis still load). If the caller did requestwghtexplicitly, the error propagates to the outer catch as before and the font falls back to the default typeface — no retry of a request the caller made.Fixes #11513