[PATCH 2/2] gdi32: Report unsubstituted font face names.

Alex Henrie alexhenrie24 at gmail.com
Tue May 6 15:43:09 CDT 2014


---
 dlls/gdi32/freetype.c   | 14 +++++++++++---
 dlls/gdi32/tests/font.c | 11 +++++++++++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index f318c7d..61523a5 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -5731,7 +5731,7 @@ static BOOL face_matches(const WCHAR *family_name, Face *face, const WCHAR *face
 }
 
 static BOOL enum_face_charsets(const Family *family, Face *face, struct enum_charset_list *list,
-                               FONTENUMPROCW proc, LPARAM lparam)
+                               WCHAR *unsubstituted_face_name, FONTENUMPROCW proc, LPARAM lparam)
 {
     ENUMLOGFONTEXW elf;
     NEWTEXTMETRICEXW ntm;
@@ -5765,6 +5765,11 @@ static BOOL enum_face_charsets(const Family *family, Face *face, struct enum_cha
             else
                 strcpyW(elf.elfFullName, family->FamilyName);
         }
+        /* Make sure that MS Shell Dlg says "MS Shell Dlg" and not "Tahoma" */
+        if (unsubstituted_face_name)
+        {
+            lstrcpynW(elf.elfLogFont.lfFaceName, unsubstituted_face_name, LF_FACESIZE);
+        }
         TRACE("enuming face %s full %s style %s charset = %d type %d script %s it %d weight %d ntmflags %08x\n",
               debugstr_w(elf.elfLogFont.lfFaceName),
               debugstr_w(elf.elfFullName), debugstr_w(elf.elfStyle),
@@ -5807,13 +5812,16 @@ static BOOL freetype_EnumFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc,
     if(plf->lfFaceName[0]) {
         FontSubst *psub = get_font_subst(&font_subst_list, plf->lfFaceName, plf->lfCharSet);
         WCHAR *face_name;
+        WCHAR *unsubstituted_face_name;
 
         if(psub) {
             TRACE("substituting %s -> %s\n", debugstr_w(plf->lfFaceName),
                   debugstr_w(psub->to.name));
             face_name = psub->to.name;
+            unsubstituted_face_name = plf->lfFaceName;
         } else {
             face_name = plf->lfFaceName;
+            unsubstituted_face_name = NULL;
         }
 
         LIST_FOR_EACH_ENTRY( family, &font_list, Family, entry ) {
@@ -5821,14 +5829,14 @@ static BOOL freetype_EnumFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc,
             face_list = get_face_list_from_family(family);
             LIST_FOR_EACH_ENTRY( face, face_list, Face, entry ) {
                 if (!face_matches(family->FamilyName, face, face_name)) continue;
-                if (!enum_face_charsets(family, face, &enum_charsets, proc, lparam)) return FALSE;
+                if (!enum_face_charsets(family, face, &enum_charsets, unsubstituted_face_name, proc, lparam)) return FALSE;
 	    }
 	}
     } else {
         LIST_FOR_EACH_ENTRY( family, &font_list, Family, entry ) {
             face_list = get_face_list_from_family(family);
             face = LIST_ENTRY(list_head(face_list), Face, entry);
-            if (!enum_face_charsets(family, face, &enum_charsets, proc, lparam)) return FALSE;
+            if (!enum_face_charsets(family, face, &enum_charsets, NULL, proc, lparam)) return FALSE;
 	}
     }
     LeaveCriticalSection( &freetype_cs );
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index fa3b420..9efa2b5 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4738,6 +4738,17 @@ static void test_EnumFonts(void)
     ret = EnumFontFamiliesA(hdc, NULL, enum_all_fonts_proc, (LPARAM)&lf);
     ok(ret, "font Arial Italic Bold should not be enumerated\n");
 
+    /* MS Shell Dlg and MS Shell Dlg 2 must exist */
+    ret = EnumFontFamiliesA(hdc, "MS Shell Dlg", enum_fonts_proc, (LPARAM)&lf);
+    ok(!ret, "font MS Shell Dlg is not enumerated\n");
+    ret = strcmp(lf.lfFaceName, "MS Shell Dlg");
+    ok(!ret, "expected MS Shell Dlg got %s\n", lf.lfFaceName);
+
+    ret = EnumFontFamiliesA(hdc, "MS Shell Dlg 2", enum_fonts_proc, (LPARAM)&lf);
+    ok(!ret, "font MS Shell Dlg 2 is not enumerated\n");
+    ret = strcmp(lf.lfFaceName, "MS Shell Dlg 2");
+    ok(!ret, "expected MS Shell Dlg 2 got %s\n", lf.lfFaceName);
+
     DeleteDC(hdc);
 }
 
-- 
1.9.1



More information about the wine-patches mailing list