Rémi Bernon : gdi32: Ignore Type 1 fonts in fontconfig enumeration.
Alexandre Julliard
julliard at winehq.org
Fri Nov 20 14:54:31 CST 2020
Module: wine
Branch: master
Commit: 37c72ce2d6cdff13c521235cb961439565e543d8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=37c72ce2d6cdff13c521235cb961439565e543d8
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Fri Nov 20 10:40:39 2020 +0000
gdi32: Ignore Type 1 fonts in fontconfig enumeration.
Instead of loading the font with FreeType to discard it right away.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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);
More information about the wine-cvs
mailing list