Alexandre Julliard : gdi32: Fix text positioning in mirrored DCs.

Alexandre Julliard julliard at winehq.org
Thu Jul 29 12:08:40 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jul 29 13:37:20 2010 +0200

gdi32: Fix text positioning in mirrored DCs.

---

 dlls/gdi32/font.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 1b36374..29281f9 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1715,6 +1715,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
     LPWSTR reordered_str = (LPWSTR)str;
     WORD *glyphs = NULL;
     UINT align = GetTextAlign( hdc );
+    DWORD layout = GetLayout( hdc );
     POINT pt;
     TEXTMETRICW tm;
     LOGFONTW lf;
@@ -1755,17 +1756,23 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
 
     if (!lprect)
         flags &= ~ETO_CLIPPED;
-        
+
+    if (flags & ETO_RTLREADING) align |= TA_RTLREADING;
+    if (layout & LAYOUT_RTL)
+    {
+        if ((align & TA_CENTER) != TA_CENTER) align ^= TA_RIGHT;
+        align ^= TA_RTLREADING;
+    }
+
     if( !(flags & (ETO_GLYPH_INDEX | ETO_IGNORELANGUAGE)) && count > 0 )
     {
         INT cGlyphs;
         reordered_str = HeapAlloc(GetProcessHeap(), 0, count*sizeof(WCHAR));
 
         BIDI_Reorder( hdc, str, count, GCP_REORDER,
-                      ((flags&ETO_RTLREADING)!=0 || (GetTextAlign(hdc)&TA_RTLREADING)!=0)?
-                      WINE_GCPW_FORCE_RTL:WINE_GCPW_FORCE_LTR,
+                      (align & TA_RTLREADING) ? WINE_GCPW_FORCE_RTL : WINE_GCPW_FORCE_LTR,
                       reordered_str, count, NULL, &glyphs, &cGlyphs);
-    
+
         flags |= ETO_IGNORELANGUAGE;
         if (glyphs)
         {
@@ -1901,6 +1908,7 @@ 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;
 
             deltas[i].x = desired[1].x - width.x;
             deltas[i].y = desired[1].y - width.y;




More information about the wine-cvs mailing list