Commit 145102c7 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

usp10: Merge neutral scripts.

parent 3767cebc
......@@ -870,8 +870,41 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int
}
if (psControl->fMergeNeutralItems)
{
HeapFree(GetProcessHeap(),0,strength);
strength = NULL;
/* Merge the neutrals */
for (i = 0; i < cInChars; i++)
{
if (strength[i] == BIDI_NEUTRAL || strength[i] == BIDI_WEAK)
{
int j;
for (j = i; j > 0; j--)
{
if (levels[i] != levels[j])
break;
if ((strength[j] == BIDI_STRONG) || (strength[i] == BIDI_NEUTRAL && strength[j] == BIDI_WEAK))
{
scripts[i] = scripts[j];
strength[i] = strength[j];
break;
}
}
}
/* Try going the other way */
if (strength[i] == BIDI_NEUTRAL || strength[i] == BIDI_WEAK)
{
int j;
for (j = i; j < cInChars; j++)
{
if (levels[i] != levels[j])
break;
if ((strength[j] == BIDI_STRONG) || (strength[i] == BIDI_NEUTRAL && strength[j] == BIDI_WEAK))
{
scripts[i] = scripts[j];
strength[i] = strength[j];
break;
}
}
}
}
}
}
}
......
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