-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Web] Error: Couldn't create typeface for #2784
Comments
can you share a reproduction? |
@wcandillon Sure, I added a skia paragraph using inter font to a fresh expo 52 create-expo-app. Let me know if you need more |
I found something, but I am not sure about the root cause and the consequences (I'm sure resolveAsset is used for a purpose), maybe you can help understanding this. For some reason
Patch used: diff --git a/node_modules/@shopify/react-native-skia/lib/module/skia/core/Font.js b/node_modules/@shopify/react-native-skia/lib/module/skia/core/Font.js
index 25896be..58085c1 100644
--- a/node_modules/@shopify/react-native-skia/lib/module/skia/core/Font.js
+++ b/node_modules/@shopify/react-native-skia/lib/module/skia/core/Font.js
@@ -61,7 +61,7 @@ export const listFontFamilies = (fontMgr = Skia.FontMgr.System()) => new Array(f
const loadTypefaces = typefacesToLoad => {
const promises = Object.keys(typefacesToLoad).flatMap(familyName => {
return typefacesToLoad[familyName].map(typefaceToLoad => {
- return Skia.Data.fromURI(Platform.resolveAsset(typefaceToLoad)).then(data => {
+ return Skia.Data.fromURI(typefaceToLoad).then(data => {
const tf = Skia.Typeface.MakeFreeTypeFaceFromData(data);
if (tf === null) {
throw new Error(`Couldn't create typeface for ${familyName}`); |
Hi,
I am currently upgrading from expo 51 to 52 and noticed that after the upgrade no fonts are rendered in my skia canvas due to an error:
I am adding inter fonts like this in all skia components and it used to work just fine
After then I'm using them in the styles for paragraph
It works fine in iOS (even after upgrade to expo 52) but not in Web anymore.
Tested with react-native-skia 1.5.0 and 1.6.0
The text was updated successfully, but these errors were encountered: