iOS variable fonts ignore computed font-weight and normal weight defaults

未關閉
#11,618 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@aleclarson 已經在處理了。

開始於 2026年11月6日。

  • #11619 來自 @aleclarson —— 未關閉

評估

難度
4/5
預估耗時
3-5 天
新手友好度
25/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
ios, typescript
領域
mobile

研究方向

Start by tracing the iOS font resolver path that applies fontVariationSettings, then inspect how computed fontWeight reaches Label, TextField, and TextView. Reproduce with the SN Pro variable font and compare native UIFont variation coordinates for normal, 600, and 500 weights. Done means computed weights select the supported wght coordinate, explicit axes take precedence, values clamp to the font range, and static font selection is unchanged; pull request #11619 is already open.

由索引模型根據 Issue 內容生成。

描述

On iOS, ordinary CSS font-weight can leave a variable font at the file's default weight. With SN Pro (weight range 200–900, default 200), a normal label should select 400 and font-weight: 600 should select 600, but both resolve to 200. TextField and TextView have the same problem. This was reproduced with NativeScript core 9.1.3 on an iOS 27 simulator by inspecting the native UIFont's CoreText variation coordinates. Current main still only applies variation coordinates when fontVariationSettings is explicit.

Reproduction: bundle SNPro[wght].ttf as fonts/SNPro.ttf and apply:

<StackLayout>
  <Label fontFamily="SN Pro" text="Expected normal weight 400" />
  <Label fontFamily="SN Pro" fontWeight="600" text="Expected weight 600" />
  <TextField fontFamily="SN Pro" fontWeight="500" text="Expected weight 500" />
  <TextView fontFamily="SN Pro" fontWeight="500" text="Expected weight 500" />
</StackLayout>

Explicit font-variation-settings: 'wght' 550 selects the correct coordinate, but callers should not need to duplicate the weight in low-level variation settings. The resolver should derive the supported wght coordinate from the computed CSS weight, use 400 for normal, preserve explicit-axis precedence, clamp to the font's range, and leave static fonts on their existing selection path.

Downstream reproduction and fix: https://github.com/octane-xplat/octane-xplat/issues/156. The Android counterpart is tracked separately in #11513 / #11514.

主要語言
TypeScript
星號
25.7k
分支
1.7k
平均合併
4 天 2 小時
30 天內合併 PR
41

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

NativeScript/NativeScript 的其他 Issue

查看 NativeScript/NativeScript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。