From: handa Date: Fri, 25 Jun 2004 11:57:20 +0000 (+0000) Subject: (fc_list): If FcFontList finds no font, try X-Git-Tag: withdl~17 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=208a1c2bac51a514188336f4354c8ea107de9b6b;p=m17n%2Fm17n-lib.git (fc_list): If FcFontList finds no font, try FcFontMatch. --- diff --git a/src/font-ft.c b/src/font-ft.c index e398e85..0f6a451 100644 --- a/src/font-ft.c +++ b/src/font-ft.c @@ -304,12 +304,27 @@ fc_list (MSymbol family) fs = FcFontList (fc_config, pattern, os); if (fs) { - for (i = 0; i < fs->nfont; i++) - { - char *filename; + char *filename; - FcPatternGetString (fs->fonts[i], FC_FILE, 0, (FcChar8 **) &filename); - add_font_info (filename, family); + if (fs->nfont > 0) + for (i = 0; i < fs->nfont; i++) + { + FcPatternGetString (fs->fonts[i], FC_FILE, 0, + (FcChar8 **) &filename); + add_font_info (filename, family); + } + else + { + FcPattern *match; + FcResult result; + + FcConfigSubstitute (fc_config, pattern, FcMatchPattern); + FcDefaultSubstitute (pattern); + match = FcFontMatch (fc_config, pattern, &result); + if (FcPatternGetString (match, FC_FILE, 0, (FcChar8 **) &filename) + == FcResultMatch) + add_font_info (filename, family); + FcPatternDestroy (match); } FcFontSetDestroy (fs); }