Module: wine Branch: master Commit: 7868be6e707404229ca7eedea743d280d146995b URL: http://source.winehq.org/git/wine.git/?a=commit;h=7868be6e707404229ca7eedea7...
Author: Aric Stewart aric@codeweavers.com Date: Mon Nov 14 13:18:02 2011 -0700
usp10: Properly set LayoutRTL.
---
dlls/usp10/tests/usp10.c | 10 +++++----- dlls/usp10/usp10.c | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c index a6e75a1..0718451 100644 --- a/dlls/usp10/tests/usp10.c +++ b/dlls/usp10/tests/usp10.c @@ -148,13 +148,13 @@ static void test_ScriptItemize( void )
static const WCHAR test1c[] = {' ', ' ', ' ', '1', '2', ' ',0}; static const itemTest t1c1[2] = {{{0,0,0,0,0},0,0,0,0,0},{{0,0,0,0,0},6,0,0,0,-1}}; - static const itemTest t1c2[4] = {{{0,0,0,0,0},0,1,1,1,0},{{0,0,1,0,0},3,0,1,2,0},{{0,0,0,0,0},5,1,1,1,0},{{0,0,0,0,0},6,0,0,0,-1}}; + static const itemTest t1c2[4] = {{{0,0,0,0,0},0,1,1,1,0},{{0,0,0,0,0},3,0,1,2,0},{{0,0,0,0,0},5,1,1,1,0},{{0,0,0,0,0},6,0,0,0,-1}};
/* Arabic, English*/ static const WCHAR test2[] = {'1','2','3','-','5','2',0x064a,0x064f,0x0633,0x0627,0x0648,0x0650,0x064a,'7','1','.',0}; static const itemTest t21[7] = {{{0,0,0,0,0},0,0,0,0,0},{{0,0,0,0,0},3,0,0,0,0},{{0,0,0,0,0},4,0,0,0,0},{{0,0,0,0,0},6,1,1,1,arab_tag},{{0,0,0,0,0},13,0,0,0,0},{{0,0,0,0,0},15,0,0,0,0},{{0,0,0,0,0},16,0,0,0,-1}}; - static const itemTest t22[5] = {{{0,0,0,0,0},0,0,0,2,0},{{0,0,0,0,0},6,1,1,1,arab_tag},{{0,0,1,0,0},13,0,1,2,0},{{0,0,0,0,0},15,0,0,0,0},{{0,0,0,0,0},16,0,0,0,-1}}; - static const itemTest t23[5] = {{{0,0,1,0,0},0,0,1,2,0},{{0,0,0,0,0},6,1,1,1,arab_tag},{{0,0,1,0,0},13,0,1,2,0},{{0,0,0,0,0},15,1,1,1,0},{{0,0,0,0,0},16,0,0,0,-1}}; + static const itemTest t22[5] = {{{0,0,0,0,0},0,0,0,2,0},{{0,0,0,0,0},6,1,1,1,arab_tag},{{0,0,0,0,0},13,0,1,2,0},{{0,0,0,0,0},15,0,0,0,0},{{0,0,0,0,0},16,0,0,0,-1}}; + static const itemTest t23[5] = {{{0,0,0,0,0},0,0,1,2,0},{{0,0,0,0,0},6,1,1,1,arab_tag},{{0,0,0,0,0},13,0,1,2,0},{{0,0,0,0,0},15,1,1,1,0},{{0,0,0,0,0},16,0,0,0,-1}};
static const WCHAR test2b[] = {'A','B','C','-','D','E','F',' ',0x0621,0x0623,0x0624,0}; static const itemTest t2b1[5] = {{{0,0,0,0,0},0,0,0,0,latn_tag},{{0,0,0,0,0},3,0,0,0,0},{{0,0,0,0,0},4,0,0,0,latn_tag},{{0,0,0,0,0},8,1,1,1,arab_tag},{{0,0,0,0,0},11,0,0,0,-1}}; @@ -188,8 +188,8 @@ static void test_ScriptItemize( void ) static const WCHAR test4[] = {'1','2','3','-','5','2',' ','i','s',' ','7','1','.',0};
static const itemTest t41[6] = {{{0,0,0,0,0},0,0,0,0,0},{{0,0,0,0,0},3,0,0,0,0},{{0,0,0,0,0},4,0,0,0,0},{{0,0,0,0,0},7,0,0,0,latn_tag},{{0,0,0,0,0},10,0,0,0,0},{{0,0,0,0,0},12,0,0,0,-1}}; - static const itemTest t42[5] = {{{0,0,1,0,0},0,0,1,2,0},{{0,0,0,0,0},6,1,1,1,0},{{0,0,0,0,0},7,0,0,2,latn_tag},{{0,0,0,0,0},10,0,0,2,0},{{0,0,0,0,0},12,0,0,0,-1}}; - static const itemTest t43[4] = {{{0,0,1,0,0},0,0,1,2,0},{{0,0,0,0,0},6,1,1,1,0},{{0,0,0,0,0},7,0,0,2,latn_tag},{{0,0,0,0,0},12,0,0,0,-1}}; + static const itemTest t42[5] = {{{0,0,0,0,0},0,0,1,2,0},{{0,0,0,0,0},6,1,1,1,0},{{0,0,0,0,0},7,0,0,2,latn_tag},{{0,0,0,0,0},10,0,0,2,0},{{0,0,0,0,0},12,0,0,0,-1}}; + static const itemTest t43[4] = {{{0,0,0,0,0},0,0,1,2,0},{{0,0,0,0,0},6,1,1,1,0},{{0,0,0,0,0},7,0,0,2,latn_tag},{{0,0,0,0,0},12,0,0,0,-1}};
/* Arabic */ static const WCHAR test5[] = diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 94c49fe..589711d 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -814,6 +814,7 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int WORD baselevel = 0; BOOL new_run; WORD last_indic = -1; + WORD layoutRTL = 0;
TRACE("%s,%d,%d,%p,%p,%p,%p\n", debugstr_wn(pwcInChars, cInChars), cInChars, cMaxItems, psControl, psState, pItems, pcItems); @@ -948,12 +949,14 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int
if (levels) { + layoutRTL = (psState->uBidiLevel || odd(levels[cnt]))?1:0; pItems[index].a.fRTL = odd(levels[cnt]); - pItems[index].a.fLayoutRTL = odd(levels[cnt]); + pItems[index].a.fLayoutRTL = layoutRTL; pItems[index].a.s.uBidiLevel = levels[cnt]; } else if (!pItems[index].a.s.uBidiLevel) { + layoutRTL = (odd(baselevel))?1:0; pItems[index].a.s.uBidiLevel = baselevel; pItems[index].a.fLayoutRTL = odd(baselevel); pItems[index].a.fRTL = odd(baselevel); @@ -1005,6 +1008,12 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int new_run = TRUE; }
+ if (!new_run && strength && str == BIDI_STRONG) + { + layoutRTL = odd(levels[cnt])?1:0; + pItems[index].a.fLayoutRTL = layoutRTL; + } + if (new_run) { TRACE("New_Level = %i, New_Strength = %i, New_Script=%d, eScript=%d\n", levels?levels[cnt]:-1, strength?strength[cnt]:str, New_Script, pItems[index].a.eScript); @@ -1023,14 +1032,18 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int pScriptTags[index] = scriptInformation[New_Script].scriptTag; if (levels) { + if (levels[cnt] == 0) + layoutRTL = 0; + else + layoutRTL = (layoutRTL || odd(levels[cnt]))?1:0; pItems[index].a.fRTL = odd(levels[cnt]); - pItems[index].a.fLayoutRTL = odd(levels[cnt]); + pItems[index].a.fLayoutRTL = layoutRTL; pItems[index].a.s.uBidiLevel = levels[cnt]; } else if (!pItems[index].a.s.uBidiLevel) { pItems[index].a.s.uBidiLevel = baselevel; - pItems[index].a.fLayoutRTL = odd(baselevel); + pItems[index].a.fLayoutRTL = layoutRTL; pItems[index].a.fRTL = odd(baselevel); }