-
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
Packaged fonts show as system fonts on iOS but not Android #2503
Comments
Can you add a font to the example project at https://github.com/Shopify/react-native-skia/tree/main/example and then we can add a test for it as well debugging the issue |
@wcandillon please take a look at #2512. I've packaged the Roboto font with the app natively such that it is usable in a |
Hey @wcandillon, I know you're busy, just wanted to highlight this issue - it would be nice to extend api with ability to use custom fonts already included into the app. I can also see similar issue has been opened. |
This inconsistency confuses me as well, as It would be nice to make Android aligned to access the packaged font without the need of loading and bundling the font twice. |
Discussed in #2257
Originally posted by murattil February 27, 2024
The fonts packaged as assets in my RN app (
assets/fonts/[font].ttf
) show up as system fonts on iOS when listed withlistFontFamilies()
, and I am able to use them in the Paragraph API directly without passing a custom font manager. On Android however, they don't show up, and a call tolistFontFamilies()
just lists a couple of basic Android fonts.What is the reason for that discrepancy? Is there any way to make the bundled fonts show as system fonts as well, similar to the behaviour on iOS? I know you can create a custom font manager (
useFonts
), however, as I have >500 fonts that need to be loaded, doingrequire('...')
on all of them takes a very long time, and sometimes crashes the app on lower-end Android devices. On iOS this is not an issue, as they are usable without loading them into a custom font manager.There are two issues here:
require(...)
with a resource, Metro packages that resource into the bundle. In the case of fonts that have also been packaged in the app using theassets
directory, this means that the asset is now packaged twice, increasing total bundle size unnecessarilyThe text was updated successfully, but these errors were encountered: