From 1f4934e24fe6a9c56a206519e7214ccf8a4a66b8 Mon Sep 17 00:00:00 2001 From: Qian Hong Date: Thu, 6 Dec 2012 03:19:58 +0800 Subject: [PATCH] gdi32: Ignore fonts in enum_face_charsets if OpenFontFace fails. Reply-To: wine-devel@winehq.org To: wine-patches@winehq.org --- dlls/gdi32/freetype.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 456a094..1ff8625 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -2992,7 +2992,7 @@ struct fontdir #include -static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, +static BOOL get_enum_structs(Face *face, LPENUMLOGFONTEXW pelf, NEWTEXTMETRICEXW *pntm, LPDWORD ptype); static BOOL get_fontdir( const char *unix_name, struct fontdir *fd ) @@ -3012,7 +3012,11 @@ static BOOL get_fontdir( const char *unix_name, struct fontdir *fd ) insert_face_in_family_list( face, family ); pFT_Done_Face( ft_face ); - GetEnumStructs( face, &elf, &ntm, &type ); + if (!get_enum_structs( face, &elf, &ntm, &type )) + { + free_family( family ); + return FALSE; + } free_family( family ); if ((type & TRUETYPE_FONTTYPE) == 0) return FALSE; @@ -5185,7 +5189,7 @@ static DWORD create_enum_charset_list(DWORD charset, struct enum_charset_list *l return n; } -static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, +static BOOL get_enum_structs(Face *face, LPENUMLOGFONTEXW pelf, NEWTEXTMETRICEXW *pntm, LPDWORD ptype) { GdiFont *font; @@ -5197,7 +5201,7 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, *pelf = face->cached_enum_data->elf; *pntm = face->cached_enum_data->ntm; *ptype = face->cached_enum_data->type; - return; + return TRUE; } font = alloc_font(); @@ -5214,7 +5218,7 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, if (!(font->ft_face = OpenFontFace(font, face, width, height))) { free_font(font); - return; + return FALSE; } font->name = strdupW(face->family->FamilyName); @@ -5290,6 +5294,7 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, } free_font(font); + return TRUE; } static BOOL family_matches(Family *family, const LOGFONTW *lf) @@ -5324,7 +5329,7 @@ static BOOL enum_face_charsets(const Family *family, Face *face, struct enum_cha DWORD type = 0; int i; - GetEnumStructs(face, &elf, &ntm, &type); + if (!get_enum_structs(face, &elf, &ntm, &type)) return TRUE; for(i = 0; i < list->total; i++) { if(!face->scalable && face->fs.fsCsb[0] == 0) { /* OEM bitmap */ elf.elfLogFont.lfCharSet = ntm.ntmTm.tmCharSet = OEM_CHARSET; -- 1.7.9.5