From 208a1c2bac51a514188336f4354c8ea107de9b6b Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 25 Jun 2004 11:57:20 +0000 Subject: [PATCH] (fc_list): If FcFontList finds no font, try FcFontMatch. --- src/font-ft.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) 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); } -- 1.7.10.4