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

Alexandre Julliard julliard at winehq.org
Thu May 26 10:56:27 CDT 2011


Module: wine
Branch: master
Commit: eaaf157f6c722aabcf8f3a30f0431f6c8dbae3f2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=eaaf157f6c722aabcf8f3a30f0431f6c8dbae3f2

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu May 26 07:37:03 2011 -0500

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

---

 dlls/usp10/usp10.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 0ab9ab9..fa20b93 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -625,6 +625,8 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int
 {
 
 #define Numeric_space 0x0020
+#define ZWNJ 0x200C
+#define ZWJ  0x200D
 
     int   cnt = 0, index = 0, str = 0;
     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++;
 
     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))))
             continue;
 
-        if(pwcInChars[cnt] != Numeric_space)
+        if(pwcInChars[cnt] != Numeric_space && pwcInChars[cnt] != ZWJ && pwcInChars[cnt] != ZWNJ)
             New_Script = get_char_script(pwcInChars[cnt]);
         else if (levels)
         {
             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++;
             New_Script = get_char_script(pwcInChars[cnt+j]);
         }




More information about the wine-cvs mailing list