rust-font-loader icon indicating copy to clipboard operation
rust-font-loader copied to clipboard

Android integration

Open matprec opened this issue 6 years ago • 2 comments

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?

matprec avatar Oct 06 '17 02:10 matprec

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.

christolliday avatar Oct 06 '17 15:10 christolliday

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

matprec avatar Oct 06 '17 23:10 matprec