Repository navigation
fix(🔤): accept a TypefaceFontProvider wherever a FontMgr is expected (2.x backport of #4541) - #4542
Merged
wcandillon merged 1 commit intoNov 26, 2026
Conversation
…(2.x backport of wcandillon#4541) Skia.SVG.MakeFromString and MakeFromData document useFonts() as their font manager, and SkTypefaceFontProvider extends SkFontMgr in the types, on the web and in Skia itself. On iOS and Android, JsiSkFontMgr::fromValue only accepted a JsiSkFontMgr, so passing a provider threw "Expected FontMgr but got different type". fromValue now also unwraps a JsiSkTypefaceFontProvider; anything else still goes through the strict check.
1 task done
wcandillon
self-requested a review
November 26, 2026 07:29
wcandillon
approved these changes
Nov 26, 2026
Contributor
|
🎉 This PR is included in version 2.15.6 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Description
Backport of #4541. Fixes #4543 for
2.x.I ran into this bug while building an Expo 58 app (on
@shopify/react-native-skia@2.14.0) that renders SVGs with text usinguseFonts()the way the SVG docs show, and the app crashed on native withExpected FontMgr but got different type.TypefaceFontProvideralready extendsSkFontMgrin TypeScript, on web, and in Skia C++, butJsiSkFontMgr::fromValuerejected its native object.(Translated from Portuguese with AI.)
Agent-written content
Summary
packages/skia/cpp/api/JsiSkFontMgr.h:JsiSkFontMgr::fromValueunwrapsJsiSkTypefaceFontProviderbefore falling through toobjectFromValue(runtime, obj).Expected FontMgr but got different typefor invalid objects and the disposed-object check for disposed providers.Tests (
packages/skia/src/renderer/__tests__/e2e/SVG.spec.tsx)2.xAPI (MakeFreeTypeFaceFromDataand synchronouscanvas.readPixels).Local verification
cpplint(exactci.ymlcommand),clang-format,eslint,prettier,yarn tsc, andclang++ -std=c++20 -fsyntax-onlyagainst2.x's pinned Skia headers all passed.