Alexandre Julliard : gdi32: Put vertical font families after their horizontal counterpart in the font list .

Alexandre Julliard julliard at winehq.org
Thu Jun 20 15:31:16 CDT 2013


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jun 20 12:12:16 2013 +0200

gdi32: Put vertical font families after their horizontal counterpart in the font list.

---

 dlls/gdi32/freetype.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 2ec7335..bdd6df7 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -1622,6 +1622,38 @@ static void load_face(HKEY hkey_face, WCHAR *face_name, Family *family, void *bu
     }
 }
 
+/* move vertical fonts after their horizontal counterpart */
+/* assumes that font_list is already sorted by family name */
+static void reorder_vertical_fonts(void)
+{
+    Family *family, *next, *vert_family;
+    struct list *ptr, *vptr;
+    struct list vertical_families = LIST_INIT( vertical_families );
+
+    LIST_FOR_EACH_ENTRY_SAFE( family, next, &font_list, Family, entry )
+    {
+        if (family->FamilyName[0] != '@') continue;
+        list_remove( &family->entry );
+        list_add_tail( &vertical_families, &family->entry );
+    }
+
+    ptr = list_head( &font_list );
+    vptr = list_head( &vertical_families );
+    while (ptr && vptr)
+    {
+        family = LIST_ENTRY( ptr, Family, entry );
+        vert_family = LIST_ENTRY( vptr, Family, entry );
+        if (strcmpiW( family->FamilyName, vert_family->FamilyName + 1 ) > 0)
+        {
+            list_remove( vptr );
+            list_add_before( ptr, vptr );
+            vptr = list_head( &vertical_families );
+        }
+        else ptr = list_next( &font_list, ptr );
+    }
+    list_move_tail( &font_list, &vertical_families );
+}
+
 static void load_font_list_from_cache(HKEY hkey_font_cache)
 {
     DWORD size, family_index = 0;
@@ -1672,6 +1704,8 @@ static void load_font_list_from_cache(HKEY hkey_font_cache)
         release_family( family );
         size = sizeof(buffer);
     }
+
+    reorder_vertical_fonts();
 }
 
 static LONG create_font_cache_key(HKEY *hkey, DWORD *disposition)




More information about the wine-cvs mailing list