[PATCH] gdi32: Fix text baseline calculation in compatible mode

Alexander Kochetkov al.kochet at gmail.com
Thu Feb 24 17:46:28 CST 2011


-------------- next part --------------
From b670b10fef6c28da427fe43f4f18de647a2b56dc Mon Sep 17 00:00:00 2001
From: Alexander Kochetkov <al.kochet at gmail.com>
Date: Fri, 25 Feb 2011 02:29:02 +0300
Subject: [PATCH] gdi32: Fix text baseline calculation in compatible mode

Could you please review the patch.
If this is the right direction of work, then I can try to fix the advanced mode text baseline calculation.
This is for the test application attached to the bug #22996

Thank you.

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

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index c92b6e3..aa9247e 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1842,6 +1842,12 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
     if(!(tm.tmPitchAndFamily & TMPF_VECTOR)) /* Non-scalable fonts shouldn't be rotated */
         lf.lfEscapement = 0;
 
+    if ((dc->GraphicsMode == GM_COMPATIBLE) &&
+        (dc->vport2WorldValid && dc->xformWorld2Vport.eM11 * dc->xformWorld2Vport.eM22 < 0))
+    {
+        lf.lfEscapement = -lf.lfEscapement;
+    }
+
     if(lf.lfEscapement != 0)
     {
         cosEsc = cos(lf.lfEscapement * M_PI / 1800);
@@ -1950,6 +1956,13 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
             desired[1].x -= desired[0].x;
             desired[1].y -= desired[0].y;
             if (layout & LAYOUT_RTL) desired[1].x = -desired[1].x;
+            if (dc->GraphicsMode == GM_COMPATIBLE)
+            {
+                if (dc->vport2WorldValid && dc->xformWorld2Vport.eM11 < 0)
+                    desired[1].x = -desired[1].x;
+                if (dc->vport2WorldValid && dc->xformWorld2Vport.eM22 < 0)
+                    desired[1].y = -desired[1].y;
+            }
 
             deltas[i].x = desired[1].x - width.x;
             deltas[i].y = desired[1].y - width.y;
-- 
1.7.0.4


More information about the wine-patches mailing list