Commit 65710af2 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

usp10: Better understand and handle numbers level in RTL runs.

parent 2781ac1e
......@@ -153,7 +153,7 @@ static void test_ScriptItemize( void )
/* 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,1,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 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 WCHAR test2b[] = {'A','B','C','-','D','E','F',' ',0x0621,0x0623,0x0624,0};
......
......@@ -806,10 +806,34 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int
}
else
{
if (!psControl->fMergeNeutralItems)
BOOL inNumber = FALSE;
static WCHAR math_punc[] = {'#','$','%','+',',','-','.','/',':',0x2212, 0x2044, 0x00a0,0};
strength = heap_alloc_zero(cInChars * sizeof(WORD));
if (!strength)
{
heap_free(levels);
return E_OUTOFMEMORY;
}
BIDI_GetStrengths(pwcInChars, cInChars, psControl, strength);
/* Script_Numeric and select puncuation at level 0 get bumped to level 2 */
for (i = 0; i < cInChars; i++)
{
if ((levels[i] == 0 || (odd(psState->uBidiLevel) && levels[i] == psState->uBidiLevel+1)) && inNumber && strchrW(math_punc,pwcInChars[i]))
levels[i] = 2;
else if ((levels[i] == 0 || (odd(psState->uBidiLevel) && levels[i] == psState->uBidiLevel+1)) && get_char_script(pwcInChars[i]) == Script_Numeric)
{
levels[i] = 2;
inNumber = TRUE;
}
else
inNumber = FALSE;
}
if (psControl->fMergeNeutralItems)
{
strength = heap_alloc_zero(cInChars * sizeof(WORD));
BIDI_GetStrengths(pwcInChars, cInChars, psControl, strength);
HeapFree(GetProcessHeap(),0,strength);
strength = NULL;
}
}
}
......
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