« Back to Search  |  Reader Mode  |  Switch to Full Retro Site View Links: Stay in Reader  |  Retro Mode: ON  |  Original »
GitHub · Extracted in 1293 ms

fix(ios): register custom fonts by URL instead of the deprecated graphics-font API by NathanWalker · Pull Request #11698 · NativeScript/NativeScript

Source: https://github.com/NativeScript/NativeScript/pull/11698

Repository navigation

fix(ios): register custom fonts by URL instead of the deprecated graphics-font API - #11698


Open
NathanWalker wants to merge 1 commit into main from fix/ios-font-registration-url
Open

fix(ios): register custom fonts by URL instead of the deprecated graphics-font API #11698 NathanWalker wants to merge 1 commit into main from fix/ios-font-registration-url

Conversation

NathanWalker commented Dec 1, 2026



Copy link Copy Markdown
Contributor

PR Checklist

What is the current behavior?

ios.registerFont (which also registers every .ttf/.otf in the app's fonts folder at startup) loads the whole file into memory and registers it with CTFontManagerRegisterGraphicsFont, which has been deprecated since iOS 18. That API registers a single CGFont, so only a variable font's default instance and only the first face of a font collection are visible to UIKit.

What is the new behavior?

Font files are registered with CTFontManagerRegisterFontsForURL at process scope, which Apple names as the replacement. It doesn't read the file into JS memory first, and it exposes every face in the file. For the bundled SN Pro variable font, UIFont.fontNamesForFamilyName('SN Pro') now lists all eight named instances (SNPro-Regular through SNPro-Black) instead of just the default one.

Error handling is unchanged:

  • A missing file, or a file that isn't a valid font (kCTFontManagerErrorUnrecognizedFormat / kCTFontManagerErrorInvalidFontData), still throws Could not load font from: <file>.
  • Other registration failures, such as a font that is already registered, are still only traced.

The public API (ios.registerFont(fontFile)) is unchanged.

New FONT-REGISTRATION device tests (iOS) cover the missing-file and invalid-data throws, registering the same font twice, and the named instances being exposed.

Validation:

fix(ios): register custom fonts by URL instead of the deprecated grap... 4cfa182
...hics-font API

CTFontManagerRegisterGraphicsFont is deprecated since iOS 18. Register font
files with CTFontManagerRegisterFontsForURL at process scope instead, which
Apple names as the replacement. It also exposes every face in the file: the
named instances of a variable font and all fonts in a collection.

Missing files and files that aren't valid fonts still throw
"Could not load font from"; other registration failures, such as a font
that is already registered, are still only traced.

nx-cloud
Bot
commented Dec 1, 2026 · edited Loading



Copy link Copy Markdown

View your CI Pipeline Execution ↗ for commit 4cfa182

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 2m 49s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-12-01 22:56:28 UTC

pkg-pr-new
Bot
commented Dec 1, 2026



Copy link Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11698
npm i https://pkg.pr.new/@nativescript/vite@11698
npm i https://pkg.pr.new/@nativescript/webpack@11698

commit: 4cfa182

This branch has not been deployed


No deployments
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

1 participant