From 37c72ce2d6cdff13c521235cb961439565e543d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Bernon?= Date: Fri, 20 Nov 2020 10:40:39 +0000 Subject: [PATCH] gdi32: Ignore Type 1 fonts in fontconfig enumeration. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Instead of loading the font with FreeType to discard it right away. Signed-off-by: RĂ©mi Bernon Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/gdi32/freetype.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 61397e8b542..1722f0c746c 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -1393,9 +1393,9 @@ static void load_fontconfig_fonts(void) { FcPattern *pat; FcFontSet *fontset; - int i, len; + const char *format; + int i; char *file; - const char *ext; if (!fontconfig_enabled) return; @@ -1418,25 +1418,29 @@ static void load_fontconfig_fonts(void) pFcConfigSubstitute( NULL, fontset->fonts[i], FcMatchFont ); - /* We're just interested in OT/TT fonts for now, so this hack just - picks up the scalable fonts without extensions .pf[ab] to save time - loading every other font */ - if(pFcPatternGetBool(fontset->fonts[i], FC_SCALABLE, 0, &scalable) == FcResultMatch && !scalable) { TRACE("not scalable\n"); continue; } + if (pFcPatternGetString( fontset->fonts[i], FC_FONTFORMAT, 0, (FcChar8 **)&format ) != FcResultMatch) + { + TRACE( "ignoring unknown font format %s\n", debugstr_a(file) ); + continue; + } + + if (!strcmp( format, "Type 1" )) + { + TRACE( "ignoring Type 1 font %s\n", debugstr_a(file) ); + continue; + } + aa_flags = parse_aa_pattern( fontset->fonts[i] ); TRACE("fontconfig: %s aa %x\n", file, aa_flags); - len = strlen( file ); - if(len < 4) continue; - ext = &file[ len - 3 ]; - if(_strnicmp(ext, "pfa", -1) && _strnicmp(ext, "pfb", -1)) - AddFontToList(NULL, file, NULL, 0, - ADDFONT_EXTERNAL_FONT | ADDFONT_ADD_TO_CACHE | ADDFONT_AA_FLAGS(aa_flags) ); + AddFontToList( NULL, file, NULL, 0, + ADDFONT_EXTERNAL_FONT | ADDFONT_ADD_TO_CACHE | ADDFONT_AA_FLAGS(aa_flags) ); } pFcFontSetDestroy(fontset); pFcPatternDestroy(pat); -- 2.11.4.GIT