[2/6] gdi32: Don't use preferred family. (try 3)

Kusanagi Kouichi slash at ac.auone-net.jp
Thu Dec 8 08:17:21 CST 2011


Signed-off-by: Kusanagi Kouichi <slash at ac.auone-net.jp>
---
 dlls/gdi32/freetype.c   |   24 ++++++++++++++++--------
 dlls/gdi32/tests/font.c |    1 -
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 3a1ae99..262f68a 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 5bbbc1d..c5d9b64 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4113,7 +4113,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);
-    todo_wine
     ok(installed, "@WineTestVertical is not installed\n");
     todo_wine
     ok(selected, "@WineTestVertical is not selected\n");
-- 
1.7.7.3




More information about the wine-patches mailing list