[Fontconfig] Fontconfig on Android is slow

Kuldeep Singh Dhaka kuldeepdhaka9 at gmail.com
Thu Jan 28 03:17:58 PST 2016


Hello,

I have been trying to run Fontconfig on Android.

Im able to use Fontconfig to search font (success) BUT it takes around
~20second to return result.

Source: https://github.com/kuldeepdhaka/fontconfig/tree/android
(note: the inspiration branch also give same result)

here is the code that i use to search:

FcPattern* pat = FcNameParse("");/* also tried "Droid" */
FcPatternAddInteger(pat, FC_WEIGHT, FC_WEIGHT_NORMAL);
FcPatternAddInteger(pat, FC_SLANT, FC_SLANT_ROMAN);
FcConfigSubstitute(config, pat, FcMatchPattern);
FcDefaultSubstitute(pat);

FcResult result;
FcPattern *font = FcFontMatch(config, pat, &result);
if (font != NULL) {
    FcChar8 *file = NULL;
    if (FcPatternGetString(font, FC_FILE, 0, &file)
				== FcResultMatch) {
	//read font from filesystem path: file
    }
    FcPatternDestroy(font);
}

FcPatternDestroy(pat);

Currently there are 91 fonts in my /system/fonts.
Due to which the "app" become unresponsive till Fontconfig finish.
The delay is unacceptable.

Im looking for help on overcoming the problem.

-- 
Kuldeep Singh Dhaka


More information about the Fontconfig mailing list