Commit 71cabaa4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

usp10: Resolve BNs and explicit formatting characters to the preceding level in resolveResolved().

As in section 5.2 of the Unicode Bidirectional Algorithm. Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAric Stewart <aric@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d283c5b6
...@@ -969,6 +969,11 @@ static void resolveResolved(unsigned baselevel, const WORD * pcls, WORD *plevel, ...@@ -969,6 +969,11 @@ static void resolveResolved(unsigned baselevel, const WORD * pcls, WORD *plevel,
plevel[j--] = baselevel; plevel[j--] = baselevel;
plevel[i] = baselevel; plevel[i] = baselevel;
} }
else if (pcls[i] == LRE || pcls[i] == RLE || pcls[i] == LRO || pcls[i] == RLO ||
pcls[i] == PDF || pcls[i] == BN)
{
plevel[i] = i ? plevel[i - 1] : baselevel;
}
if (i == eos && if (i == eos &&
(pcls[i] == WS || pcls[i] == FSI || pcls[i] == LRI || pcls[i] == RLI || (pcls[i] == WS || pcls[i] == FSI || pcls[i] == LRI || pcls[i] == RLI ||
pcls[i] == PDI || pcls[i] == LRE || pcls[i] == RLE || pcls[i] == LRO || pcls[i] == PDI || pcls[i] == LRE || pcls[i] == RLE || pcls[i] == LRO ||
......
...@@ -563,6 +563,11 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE}, ...@@ -563,6 +563,11 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
{{0,0,0,0,0,0},2,0,1,0,1,0,FALSE}, {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE},
{{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE}}; {{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE}};
/* ZWNJ */
static const WCHAR test56[] = {0x0645, 0x06cc, 0x200c, 0x06a9, 0x0646, 0x0645}; /* می‌کنم */
static const itemTest t561[] = {{{0,0,0,0,0,0},0,1,1,1,0,arab_tag,FALSE},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE}};
static const itemTest t562[] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE}};
SCRIPT_ITEM items[15]; SCRIPT_ITEM items[15];
SCRIPT_CONTROL Control; SCRIPT_CONTROL Control;
SCRIPT_STATE State; SCRIPT_STATE State;
...@@ -643,6 +648,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE}, ...@@ -643,6 +648,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
test_items_ok(test45,24,NULL,NULL,1,t451,FALSE,0); test_items_ok(test45,24,NULL,NULL,1,t451,FALSE,0);
test_items_ok(test46,16,NULL,NULL,1,t461,FALSE,0); test_items_ok(test46,16,NULL,NULL,1,t461,FALSE,0);
test_items_ok(test47,26,NULL,NULL,1,t471,FALSE,0); test_items_ok(test47,26,NULL,NULL,1,t471,FALSE,0);
test_items_ok(test56,6,NULL,NULL,1,t561,FALSE,0);
State.uBidiLevel = 0; State.uBidiLevel = 0;
test_items_ok(test1,4,&Control,&State,1,t11,FALSE,0); test_items_ok(test1,4,&Control,&State,1,t11,FALSE,0);
...@@ -705,6 +711,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE}, ...@@ -705,6 +711,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
test_items_ok(test53,8,&Control,&State,4,t531,FALSE,0); test_items_ok(test53,8,&Control,&State,4,t531,FALSE,0);
test_items_ok(test54,7,&Control,&State,2,t541,FALSE,0); test_items_ok(test54,7,&Control,&State,2,t541,FALSE,0);
test_items_ok(test55,8,&Control,&State,2,t551,FALSE,0); test_items_ok(test55,8,&Control,&State,2,t551,FALSE,0);
test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
State.uBidiLevel = 1; State.uBidiLevel = 1;
test_items_ok(test1,4,&Control,&State,1,t12,FALSE,0); test_items_ok(test1,4,&Control,&State,1,t12,FALSE,0);
...@@ -759,6 +766,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE}, ...@@ -759,6 +766,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
test_items_ok(test45,24,&Control,&State,1,t452,FALSE,0); test_items_ok(test45,24,&Control,&State,1,t452,FALSE,0);
test_items_ok(test46,16,&Control,&State,1,t462,FALSE,0); test_items_ok(test46,16,&Control,&State,1,t462,FALSE,0);
test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0); test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0);
test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
State.uBidiLevel = 1; State.uBidiLevel = 1;
Control.fMergeNeutralItems = TRUE; Control.fMergeNeutralItems = TRUE;
...@@ -814,6 +822,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE}, ...@@ -814,6 +822,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
test_items_ok(test45,24,&Control,&State,1,t452,FALSE,0); test_items_ok(test45,24,&Control,&State,1,t452,FALSE,0);
test_items_ok(test46,16,&Control,&State,1,t462,FALSE,0); test_items_ok(test46,16,&Control,&State,1,t462,FALSE,0);
test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0); test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0);
test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
State.uBidiLevel = 0; State.uBidiLevel = 0;
Control.fMergeNeutralItems = FALSE; Control.fMergeNeutralItems = FALSE;
...@@ -878,6 +887,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE}, ...@@ -878,6 +887,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
test_items_ok(test53,8,&Control,&State,4,t532,FALSE,0); test_items_ok(test53,8,&Control,&State,4,t532,FALSE,0);
test_items_ok(test54,7,&Control,&State,2,t542,FALSE,0); test_items_ok(test54,7,&Control,&State,2,t542,FALSE,0);
test_items_ok(test55,8,&Control,&State,2,t552,FALSE,0); test_items_ok(test55,8,&Control,&State,2,t552,FALSE,0);
test_items_ok(test56,6,&Control,&State,1,t562,FALSE,0);
} }
static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string, static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment