rust-font-loader
rust-font-loader copied to clipboard
Android integration
The font loading and parsing logic is implemented in java. They parse a simple xml file which contains all the infos, so replicating shouldn't be a problem.
Parsing by third party apps is NOT supported, see source, which means we'll have to specialize for android releases, in case they change behaviour. Also unchecked, which Android version is the earliest we could supported with this?
Might be helpful to look at what servo is doing here: https://github.com/servo/servo/blob/master/components/gfx/platform/freetype/android/font_list.rs
Looks like they support from API 17 (Android 4.2) on, which seems reasonable to be the earliest supported version. Also, apparently there is an API for querying fonts available in Android O (API 26), but I don't think servo supports it yet.
Thanks for the servo hint, didn't thought on that one! Having working reference code is a nice addition.
I'm concerned that we can't trivialy implement the query interface, because they store no metadata about those fonts. Therefore, we would have to load the files and index them on our own i guess.
Just leaving this as a reminder for future me: https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html