Title: fix(core): Android font-weight is ignored for custom fonts on API 26+ (no wght axis mapping) · Issue #11513 · NativeScript/NativeScript · GitHub
Open Graph Title: fix(core): Android font-weight is ignored for custom fonts on API 26+ (no wght axis mapping) · Issue #11513 · NativeScript/NativeScript
X Title: fix(core): Android font-weight is ignored for custom fonts on API 26+ (no wght axis mapping) · Issue #11513 · NativeScript/NativeScript
Description: Issue Description On Android API 26+, @nativescript/core loads custom font files through android.graphics.Typeface.Builder and passes font-variation-settings via setFontVariationSettings. For a variable font, the font-weight CSS property...
Open Graph Description: Issue Description On Android API 26+, @nativescript/core loads custom font files through android.graphics.Typeface.Builder and passes font-variation-settings via setFontVariationSettings. For a var...
X Description: Issue Description On Android API 26+, @nativescript/core loads custom font files through android.graphics.Typeface.Builder and passes font-variation-settings via setFontVariationSettings. For a var...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/11513
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fix(core): Android font-weight is ignored for custom fonts on API 26+ (no wght axis mapping)","articleBody":"### Issue Description\n\nOn Android API 26+, `@nativescript/core` loads custom font files through `android.graphics.Typeface.Builder` and passes `font-variation-settings` via `setFontVariationSettings`. For a **variable font**, the `font-weight` CSS property has no effect unless the caller also knows to pass an explicit `'wght'` variation setting: `loadFontFromFile` never maps `fontWeight` onto the `wght` axis, so e.g. `font-family: 'MyVariableFont'; font-weight: 700` renders at the font's default weight.\n\nTwo adjacent problems:\n\n- `computeFontCacheKey` keys the typeface cache only on family + explicit variation settings, so once the weight is forwarded (by workaround or fix), two weights of the same family collide in the cache.\n- If a font doesn't support the `wght` axis, `builder.build()` throws and there is no retry — the file load fails outright instead of falling back to the explicit variation settings.\n\n### Reproduction\n\nOn an API 26+ Android device/emulator with a variable font (e.g. `fonts/Inter.var.ttf`):\n\n```xml\n\u003cLabel fontFamily=\"Inter.var\" fontWeight=\"700\" text=\"should be bold\" />\n```\n\nThe label renders at the font's default weight (400) because `setFontVariationSettings` is called with `''` (no `wght` axis).\n\n### Proposed fix\n\nIn `loadFontFromFile`, inject `{ axis: 'wght', value: \u003cnumeric fontWeight> }` into the variation settings when the caller did not set `wght` explicitly, include `fontWeight` in `computeFontCacheKey`, and retry the build with the caller's explicit settings if the `wght`-augmented build throws.\n\n### Environment\n\n- @nativescript/core 9.x, Android API 26+\n\nI have a PR with this fix plus unit tests ready to submit.","author":{"url":"https://github.com/aleclarson","@type":"Person","name":"aleclarson"},"datePublished":"2026-10-08T01:46:13Z","url":"https://github.com/NativeScript/NativeScript/issues/11513"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:79ef822a-9e32-ec55-ecef-a3a7cb7a3f8d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE56:B53AF:1523465:1C241E4:6B013328 |
| html-safe-nonce | 5e672479998e0322ab33d5d3cfd90069fe33fff616282e8f5049c8beab668818 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTU2OkI1M0FGOjE1MjM0NjU6MUMyNDFFNDo2QjAxMzMyOCIsInZpc2l0b3JfaWQiOiIyMjA0OTA1MTQyMDQ0NjY4NzEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3bf4529e36e222692db32365b1e26e7303051e3485b7f401ccdf286a3c50b704 |
| hovercard-subject-tag | issue:5754506908 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/11513/issue_layout |
| twitter:image | https://opengraph.githubassets.com/af6c25a7ce64d9821c9f96e0534831c985c416fc2e6303ea83685742b1049c18/NativeScript/NativeScript/issues/11513 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/af6c25a7ce64d9821c9f96e0534831c985c416fc2e6303ea83685742b1049c18/NativeScript/NativeScript/issues/11513 |
| og:image:alt | Issue Description On Android API 26+, @nativescript/core loads custom font files through android.graphics.Typeface.Builder and passes font-variation-settings via setFontVariationSettings. For a var... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aleclarson |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width