gdi32: Use a better heuristics for tmWeight.

Dmitry Timoshkov dmitry at codeweavers.com
Fri Jul 31 08:21:51 CDT 2009


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;
-- 
1.6.3.3




More information about the wine-patches mailing list