Kusanagi Kouichi : gdi32: Don't use preferred family name.

Alexandre Julliard julliard at winehq.org
Tue Dec 13 13:01:27 CST 2011


Module: wine
Branch: master
Commit: bf8a10063924a826766af2e478e248bb6ea061e0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bf8a10063924a826766af2e478e248bb6ea061e0

Author: Kusanagi Kouichi <slash at ac.auone-net.jp>
Date:   Tue Dec 13 19:44:16 2011 +0900

gdi32: Don't use preferred family name.

---

 dlls/gdi32/freetype.c   |   24 ++++++++++++++++--------
 dlls/gdi32/tests/font.c |    2 --
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 959f4aa..615a01a 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -1487,8 +1487,6 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
 #endif /* HAVE_CARBON_CARBON_H */
 
     do {
-        char *family_name = fake_family;
-
         if (file)
         {
             TRACE("Loading font file %s index %ld\n", debugstr_a(file), face_index);
@@ -1571,9 +1569,6 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
             HeapFree(GetProcessHeap(), 0, localised_family);
         }
 
-        if(!family_name)
-            family_name = ft_face->family_name;
-
         bitmap_num = 0;
         do {
             My_FT_Bitmap_Size *size = NULL;
@@ -1582,9 +1577,22 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
             if(!FT_IS_SCALABLE(ft_face))
                 size = (My_FT_Bitmap_Size *)ft_face->available_sizes + bitmap_num;
 
-            len = MultiByteToWideChar(CP_ACP, 0, family_name, -1, NULL, 0);
-            english_family = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-            MultiByteToWideChar(CP_ACP, 0, family_name, -1, english_family, len);
+            if(fake_family)
+            {
+                len = MultiByteToWideChar(CP_ACP, 0, fake_family, -1, NULL, 0);
+                english_family = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+                MultiByteToWideChar(CP_ACP, 0, fake_family, -1, english_family, len);
+            }
+            else
+            {
+                english_family = get_face_name(ft_face, TT_NAME_ID_FONT_FAMILY, TT_MS_LANGID_ENGLISH_UNITED_STATES);
+                if(!english_family)
+                {
+                    len = MultiByteToWideChar(CP_ACP, 0, ft_face->family_name, -1, NULL, 0);
+                    english_family = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+                    MultiByteToWideChar(CP_ACP, 0, ft_face->family_name, -1, english_family, len);
+                }
+            }
 
             localised_family = NULL;
             if(!fake_family) {
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 0a202dd..ed629ce 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4125,8 +4125,6 @@ static void test_vertical_font(void)
     ok(num == 2, "AddFontResourceExA should add 2 fonts from vertical.ttf\n");
 
     check_vertical_font("@WineTestVertical", &installed, &selected, &gm);
-    /* This test fails on wine if locale is not en-US. Disable for now. */
-    if (0)
     ok(installed, "@WineTestVertical is not installed\n");
     todo_wine
     ok(selected, "@WineTestVertical is not selected\n");




More information about the wine-cvs mailing list