Aric Stewart : gdi32: Handle a BiDi string being shaped into more or less glyphs than characters in the string .

Alexandre Julliard julliard at winehq.org
Mon May 24 11:30:48 CDT 2010


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Fri May 21 15:11:34 2010 -0500

gdi32: Handle a BiDi string being shaped into more or less glyphs than characters in the string.

---

 dlls/gdi32/bidi.c        |    5 ++++-
 dlls/gdi32/font.c        |    9 +++++++--
 dlls/gdi32/gdi_private.h |    2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/bidi.c b/dlls/gdi32/bidi.c
index 20fde13..82691ed 100644
--- a/dlls/gdi32/bidi.c
+++ b/dlls/gdi32/bidi.c
@@ -352,7 +352,8 @@ BOOL BIDI_Reorder(
                 LPWSTR lpOutString, /* [out] Reordered string */
                 INT uCountOut,  /* [in] Size of output buffer */
                 UINT *lpOrder, /* [out] Logical -> Visual order map */
-                WORD **lpGlyphs /* [out] reordered, mirrored, shaped glyphs to display */
+                WORD **lpGlyphs, /* [out] reordered, mirrored, shaped glyphs to display */
+                INT *cGlyphs /* [out] number of glyphs generated */
     )
 {
     WORD *chartype;
@@ -637,6 +638,8 @@ BOOL BIDI_Reorder(
 
         done += i;
     }
+    if (cGlyphs)
+        *cGlyphs = glyph_i;
 
     HeapFree(GetProcessHeap(), 0, chartype);
     HeapFree(GetProcessHeap(), 0, levels);
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 963dadc..17fb381 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1702,16 +1702,21 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
         
     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,
-                      reordered_str, count, NULL, &glyphs );
+                      reordered_str, count, NULL, &glyphs, &cGlyphs);
     
         flags |= ETO_IGNORELANGUAGE;
         if (glyphs)
+        {
             flags |= ETO_GLYPH_INDEX;
+            if (cGlyphs != count)
+                count = cGlyphs;
+        }
     }
     else if(flags & ETO_GLYPH_INDEX)
         glyphs = reordered_str;
@@ -2874,7 +2879,7 @@ GetCharacterPlacementW(
 	} else
 	{
             BIDI_Reorder(NULL, lpString, uCount, dwFlags, WINE_GCPW_FORCE_LTR, lpResults->lpOutString,
-                          nSet, lpResults->lpOrder, NULL );
+                          nSet, lpResults->lpOrder, NULL, NULL );
 	}
 
 	/* FIXME: Will use the placement chars */
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 10ff13e..d1cb66b 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -356,7 +356,7 @@ typedef struct tagBITMAPOBJ
 #define WINE_GCPW_LOOSE_MASK 2
 
 extern BOOL BIDI_Reorder( HDC hDC, LPCWSTR lpString, INT uCount, DWORD dwFlags, DWORD dwWineGCP_Flags,
-                          LPWSTR lpOutString, INT uCountOut, UINT *lpOrder, WORD **lpGlyphs ) DECLSPEC_HIDDEN;
+                          LPWSTR lpOutString, INT uCountOut, UINT *lpOrder, WORD **lpGlyphs, INT* cGlyphs ) DECLSPEC_HIDDEN;
 
 /* bitmap.c */
 extern HBITMAP BITMAP_CopyBitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list