[PATCH] gdi32: Fix text baseline calculation in compatible mode (try 2)

Alexander Kochetkov al.kochet at gmail.com
Fri Feb 25 06:32:50 CST 2011


Same as previous patch, but also fixes baseline calculation for RTL
layouts in compatible mode.
For the test application attached to the bug #22996.
Thank you.
-------------- next part --------------
From ef9803f758df08a3730aa5d002d8675c09951fbf Mon Sep 17 00:00:00 2001
From: Alexander Kochetkov <al.kochet at gmail.com>
Date: Fri, 25 Feb 2011 15:19:55 +0300
Subject: [PATCH] gdi32: Fix text baseline calculation in compatible mode

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

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index c92b6e3..29864d7 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);
@@ -1949,7 +1955,18 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
             LPtoDP(hdc, desired, 2);
             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;
+            }
+            else
+            {
+                if (layout & LAYOUT_RTL) desired[1].x = -desired[1].x;
+            }
 
             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