diff --git a/dlls/gdi32/bidi.c b/dlls/gdi32/bidi.c index 1bb38d8d0ef..87fe05afd25 100644 --- a/dlls/gdi32/bidi.c +++ b/dlls/gdi32/bidi.c @@ -1054,7 +1054,7 @@ BOOL BIDI_Reorder( { WORD *levels; WORD *chartype; - unsigned i, baselevel = 0, forcedir = 0, done; + unsigned i, baselevel = 0, done; TRACE("%s, %d, 0x%08x lpOutString=%p, lpOrder=%p\n", debugstr_wn(lpString, uCount), uCount, dwFlags, lpOutString, lpOrder); @@ -1081,14 +1081,8 @@ BOOL BIDI_Reorder( memcpy(lpOutString, lpString, uCount * sizeof(WCHAR)); - switch (dwWineGCP_Flags&WINE_GCPW_DIR_MASK) - { - /* 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; - } + if (WINE_GCPW_FORCE_RTL == (dwWineGCP_Flags&WINE_GCPW_DIR_MASK)) + baselevel = 1; i = done = 0; while (done < uCount) @@ -1107,29 +1101,26 @@ BOOL BIDI_Reorder( default: continue; } - if (!forcedir) - { - if ((dwWineGCP_Flags&WINE_GCPW_DIR_MASK) == WINE_GCPW_LOOSE_RTL) - baselevel = 1; - else baselevel = 0; + if ((dwWineGCP_Flags&WINE_GCPW_DIR_MASK) == WINE_GCPW_LOOSE_RTL) + baselevel = 1; + else if ((dwWineGCP_Flags&WINE_GCPW_DIR_MASK) == WINE_GCPW_LOOSE_LTR) + baselevel = 0; + if (dwWineGCP_Flags & WINE_GCPW_LOOSE_MASK) for (j = 0; j < i; ++j) - { if (chartype[j] == L) { baselevel = 0; break; } - if (chartype[j] == R) + else if (chartype[j] == R) { baselevel = 1; break; } - } - } /* resolve explicit */ - resolveExplicit(baselevel, forcedir, chartype, levels, i, 0); + resolveExplicit(baselevel, N, chartype, levels, i, 0); /* resolve weak */ resolveWeak(baselevel, chartype, levels, i); diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 421e7c5926f..2cf52030fb3 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -373,14 +373,16 @@ typedef struct tagBITMAPOBJ /* Wine_GCPW Flags */ /* Directionality - - * LOOSE means that the paragraph dir is only set if there is no strong character. - * FORCE means override the characters in the paragraph. + * LOOSE means taking the directionality of the first strong character, if there is found one. + * FORCE means the paragraph direction is forced. (RLE/LRE) */ #define WINE_GCPW_FORCE_LTR 0 #define WINE_GCPW_FORCE_RTL 1 #define WINE_GCPW_LOOSE_LTR 2 #define WINE_GCPW_LOOSE_RTL 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, LPWSTR lpOutString, INT uCountOut, UINT *lpOrder );