Skip to content

fix(🔤): accept a TypefaceFontProvider wherever a FontMgr is expected (2.x backport of #4541) - #4542

Merged
wcandillon merged 1 commit into
wcandillon:2.xfrom
filipemsilv4:fix/svg-accept-typeface-font-provider-2x
Nov 26, 2026
Merged

wcandillon merged 1 commit into
wcandillon:2.xfrom
filipemsilv4:fix/svg-accept-typeface-font-provider-2x

Conversation

@filipemsilv4

@filipemsilv4 filipemsilv4 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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 using useFonts() the way the SVG docs show, and the app crashed on native with Expected FontMgr but got different type. TypefaceFontProvider already extends SkFontMgr in TypeScript, on web, and in Skia C++, but JsiSkFontMgr::fromValue rejected its native object.

(Translated from Portuguese with AI.)

Agent-written content

Summary

Tests (packages/skia/src/renderer/__tests__/e2e/SVG.spec.tsx)

Local verification

  • cpplint (exact ci.yml command), clang-format, eslint, prettier, yarn tsc, and clang++ -std=c++20 -fsyntax-only against 2.x's pinned Skia headers all passed.
  • E2E tests have not been executed on a local simulator/device and will run on CI.

…(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.
@wcandillon
wcandillon merged commit 0583a3d into wcandillon:2.x Nov 26, 2026
6 of 7 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.15.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants