Rémi Bernon : gdi32: Rewrite find_any_face using the rbtree.

Alexandre Julliard julliard at winehq.org
Fri Nov 13 15:57:52 CST 2020


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Nov 13 09:05:57 2020 +0000

gdi32: Rewrite find_any_face using the rbtree.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/font.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 450d31ca82a..303467af466 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1493,19 +1493,20 @@ static struct gdi_font_face *find_any_face( const LOGFONTW *lf, FONTSIGNATURE fs
 {
     struct gdi_font_family *family;
     struct gdi_font_face *face;
-    WCHAR name[LF_FACESIZE];
+    WCHAR name[LF_FACESIZE + 1];
     int i = 0;
 
     /* first try the family fallbacks */
     while (enum_fallbacks( lf->lfPitchAndFamily, i++, name ))
     {
-        WINE_RB_FOR_EACH_ENTRY( family, &family_name_tree, struct gdi_font_family, name_entry )
+        if (want_vertical)
         {
-            if ((family->family_name[0] == '@') == !want_vertical) continue;
-            if (wcsicmp( family->family_name + want_vertical, name ) &&
-                wcsicmp( family->second_name + want_vertical, name )) continue;
-            if ((face = find_best_matching_face( family, lf, fs, FALSE ))) return face;
+            memmove(name + 1, name, min(lstrlenW(name), LF_FACESIZE));
+            name[0] = '@';
         }
+
+        if (!(family = find_family_from_any_name(name))) continue;
+        if ((face = find_best_matching_face( family, lf, fs, FALSE ))) return face;
     }
     /* otherwise try only scalable */
     WINE_RB_FOR_EACH_ENTRY( family, &family_name_tree, struct gdi_font_family, name_entry )




More information about the wine-cvs mailing list