usp10: Zero Width Joiners and Non-Joiners should, like spaces, not split runs.

This commit is contained in:
Aric Stewart 2011-05-26 07:37:03 -05:00 committed by Alexandre Julliard
parent 1857a05996
commit eaaf157f6c
1 changed files with 5 additions and 3 deletions

View File

@ -625,6 +625,8 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int
{ {
#define Numeric_space 0x0020 #define Numeric_space 0x0020
#define ZWNJ 0x200C
#define ZWJ 0x200D
int cnt = 0, index = 0, str = 0; int cnt = 0, index = 0, str = 0;
int New_Script = SCRIPT_UNDEFINED; int New_Script = SCRIPT_UNDEFINED;
@ -665,7 +667,7 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int
} }
} }
while (pwcInChars[cnt] == Numeric_space && cnt < cInChars) while ((pwcInChars[cnt] == Numeric_space || pwcInChars[cnt] == ZWJ || pwcInChars[cnt] == ZWNJ) && cnt < cInChars)
cnt++; cnt++;
if (cnt == cInChars) /* All Spaces */ if (cnt == cInChars) /* All Spaces */
@ -704,12 +706,12 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int
if (levels && (levels[cnt] == pItems[index].a.s.uBidiLevel && (!strength || (strength[cnt] == 0 || strength[cnt] == str)))) if (levels && (levels[cnt] == pItems[index].a.s.uBidiLevel && (!strength || (strength[cnt] == 0 || strength[cnt] == str))))
continue; continue;
if(pwcInChars[cnt] != Numeric_space) if(pwcInChars[cnt] != Numeric_space && pwcInChars[cnt] != ZWJ && pwcInChars[cnt] != ZWNJ)
New_Script = get_char_script(pwcInChars[cnt]); New_Script = get_char_script(pwcInChars[cnt]);
else if (levels) else if (levels)
{ {
int j = 1; int j = 1;
while (cnt + j < cInChars - 1 && pwcInChars[cnt+j] == Numeric_space) while (cnt + j < cInChars - 1 && (pwcInChars[cnt+j] == Numeric_space || pwcInChars[cnt+j] == ZWJ || pwcInChars[cnt+j] == ZWNJ))
j++; j++;
New_Script = get_char_script(pwcInChars[cnt+j]); New_Script = get_char_script(pwcInChars[cnt+j]);
} }