Dmitry Timoshkov : gdi32: Use a better heuristics for tmWeight.

Alexandre Julliard julliard at winehq.org
Mon Aug 3 11:13:59 CDT 2009


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

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Fri Jul 31 22:21:51 2009 +0900

gdi32: Use a better heuristics for tmWeight.

Marlett uses FW_MEDIUM (500) and current code allows only FW_REGULAR and
FW_BOLD. New heuristics detects if flags and usWeightClass in the font match.

---

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

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 96b197a..b5ab51a 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -5585,7 +5585,19 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
         TM.tmAveCharWidth = 1; 
     }
     TM.tmMaxCharWidth = (pFT_MulFix(ft_face->bbox.xMax - ft_face->bbox.xMin, x_scale) + 32) >> 6;
-    TM.tmWeight = (font->fake_bold || (ft_face->style_flags & FT_STYLE_FLAG_BOLD)) ? FW_BOLD : FW_REGULAR;
+    TM.tmWeight = FW_REGULAR;
+    if (font->fake_bold)
+        TM.tmWeight = FW_BOLD;
+    else
+    {
+        if (ft_face->style_flags & FT_STYLE_FLAG_BOLD)
+        {
+            if (pOS2->usWeightClass > FW_MEDIUM)
+                TM.tmWeight = pOS2->usWeightClass;
+        }
+        else if (pOS2->usWeightClass <= FW_MEDIUM)
+            TM.tmWeight = pOS2->usWeightClass;
+    }
     TM.tmOverhang = 0;
     TM.tmDigitizedAspectX = 300;
     TM.tmDigitizedAspectY = 300;




More information about the wine-cvs mailing list