You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Android, cosmic-text will crash by default since it doesn't find any fonts. Once you do add fonts though, it works just fine, which is great.
On every Android device, a set of default fonts is located in /system/fonts, which is user-readable. This does not appear to be documented by the Android project officially anywhere - nevertheless, it's a fact that you'll find these fonts in that folder on every device, and there surely are lots of apps out there that depend on this.
Here's all I needed to do to get basic font families to work on Android (although there might also be some work to be done with fallbacks):
letmut font_system = cosmic_text::FontSystem::new();#[cfg(target_os = "android")]{
font_system.db_mut().load_fonts_dir("/system/fonts");
font_system.db_mut().set_sans_serif_family("Roboto");
font_system.db_mut().set_serif_family("Noto Serif");
font_system.db_mut().set_monospace_family("Droid Sans Mono");// Cutive Mono looks more printer-like
font_system.db_mut().set_cursive_family("Dancing Script");
font_system.db_mut().set_fantasy_family("Dancing Script");}// ... use the FontSystem as normal
If the project doesn't want to add this, at least this Github issue will now be searchable to find this workaround.
I'm not sure exactly how to set up the CJK fallback fonts, though. I've logged the info about the found faces from a PocoPhone F1 here.
The text was updated successfully, but these errors were encountered:
Yes, there may need to be custom fallback code in cosmic-text, but the system font directories should be added in fontdb so other projects using it find the fonts as well.
On Android, cosmic-text will crash by default since it doesn't find any fonts. Once you do add fonts though, it works just fine, which is great.
On every Android device, a set of default fonts is located in
/system/fonts
, which is user-readable. This does not appear to be documented by the Android project officially anywhere - nevertheless, it's a fact that you'll find these fonts in that folder on every device, and there surely are lots of apps out there that depend on this.Here's all I needed to do to get basic font families to work on Android (although there might also be some work to be done with fallbacks):
If the project doesn't want to add this, at least this Github issue will now be searchable to find this workaround.
I'm not sure exactly how to set up the CJK fallback fonts, though. I've logged the info about the found faces from a PocoPhone F1 here.
The text was updated successfully, but these errors were encountered: