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

oldstable
Aric Stewart 2010-05-21 15:11:34 -05:00 committed by Alexandre Julliard
parent a27e03bf5d
commit ec62c33d79
3 changed files with 12 additions and 4 deletions

View File

@ -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);

View File

@ -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 */

View File

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