gdi32: Fix meaning and use of bidirectionality flags.

oldstable
Maarten Lankhorst 2007-09-27 10:41:58 +02:00 committed by Alexandre Julliard
parent 455a4994d5
commit 6b2a6a2bcf
2 changed files with 14 additions and 21 deletions

View File

@ -1054,7 +1054,7 @@ BOOL BIDI_Reorder(
{ {
WORD *levels; WORD *levels;
WORD *chartype; WORD *chartype;
unsigned i, baselevel = 0, forcedir = 0, done; unsigned i, baselevel = 0, done;
TRACE("%s, %d, 0x%08x lpOutString=%p, lpOrder=%p\n", TRACE("%s, %d, 0x%08x lpOutString=%p, lpOrder=%p\n",
debugstr_wn(lpString, uCount), uCount, dwFlags, debugstr_wn(lpString, uCount), uCount, dwFlags,
lpOutString, lpOrder); lpOutString, lpOrder);
@ -1081,14 +1081,8 @@ BOOL BIDI_Reorder(
memcpy(lpOutString, lpString, uCount * sizeof(WCHAR)); memcpy(lpOutString, lpString, uCount * sizeof(WCHAR));
switch (dwWineGCP_Flags&WINE_GCPW_DIR_MASK) if (WINE_GCPW_FORCE_RTL == (dwWineGCP_Flags&WINE_GCPW_DIR_MASK))
{ baselevel = 1;
/* force means initial level is set directly,
* loose means initial level is determined by first character that has a direction */
case WINE_GCPW_FORCE_LTR: forcedir = L; break;
case WINE_GCPW_FORCE_RTL: forcedir = R; baselevel = 1; break;
default: break;
}
i = done = 0; i = done = 0;
while (done < uCount) while (done < uCount)
@ -1107,29 +1101,26 @@ BOOL BIDI_Reorder(
default: continue; default: continue;
} }
if (!forcedir) if ((dwWineGCP_Flags&WINE_GCPW_DIR_MASK) == WINE_GCPW_LOOSE_RTL)
{ baselevel = 1;
if ((dwWineGCP_Flags&WINE_GCPW_DIR_MASK) == WINE_GCPW_LOOSE_RTL) else if ((dwWineGCP_Flags&WINE_GCPW_DIR_MASK) == WINE_GCPW_LOOSE_LTR)
baselevel = 1; baselevel = 0;
else baselevel = 0;
if (dwWineGCP_Flags & WINE_GCPW_LOOSE_MASK)
for (j = 0; j < i; ++j) for (j = 0; j < i; ++j)
{
if (chartype[j] == L) if (chartype[j] == L)
{ {
baselevel = 0; baselevel = 0;
break; break;
} }
if (chartype[j] == R) else if (chartype[j] == R)
{ {
baselevel = 1; baselevel = 1;
break; break;
} }
}
}
/* resolve explicit */ /* resolve explicit */
resolveExplicit(baselevel, forcedir, chartype, levels, i, 0); resolveExplicit(baselevel, N, chartype, levels, i, 0);
/* resolve weak */ /* resolve weak */
resolveWeak(baselevel, chartype, levels, i); resolveWeak(baselevel, chartype, levels, i);

View File

@ -373,14 +373,16 @@ typedef struct tagBITMAPOBJ
/* Wine_GCPW Flags */ /* Wine_GCPW Flags */
/* Directionality - /* Directionality -
* LOOSE means that the paragraph dir is only set if there is no strong character. * LOOSE means taking the directionality of the first strong character, if there is found one.
* FORCE means override the characters in the paragraph. * FORCE means the paragraph direction is forced. (RLE/LRE)
*/ */
#define WINE_GCPW_FORCE_LTR 0 #define WINE_GCPW_FORCE_LTR 0
#define WINE_GCPW_FORCE_RTL 1 #define WINE_GCPW_FORCE_RTL 1
#define WINE_GCPW_LOOSE_LTR 2 #define WINE_GCPW_LOOSE_LTR 2
#define WINE_GCPW_LOOSE_RTL 3 #define WINE_GCPW_LOOSE_RTL 3
#define WINE_GCPW_DIR_MASK 3 #define WINE_GCPW_DIR_MASK 3
#define WINE_GCPW_LOOSE_MASK 2
extern BOOL BIDI_Reorder( LPCWSTR lpString, INT uCount, DWORD dwFlags, DWORD dwWineGCP_Flags, extern BOOL BIDI_Reorder( LPCWSTR lpString, INT uCount, DWORD dwFlags, DWORD dwWineGCP_Flags,
LPWSTR lpOutString, INT uCountOut, UINT *lpOrder ); LPWSTR lpOutString, INT uCountOut, UINT *lpOrder );