Aric Stewart : usp10: Improve support for Syriac in ScriptItemize.

Alexandre Julliard julliard at winehq.org
Mon Apr 19 11:51:24 CDT 2010


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Apr 19 07:31:28 2010 -0500

usp10: Improve support for Syriac in ScriptItemize.

---

 dlls/usp10/tests/usp10.c |   68 ++++++++++++++++++++++++++++++++++++++++++++++
 dlls/usp10/usp10.c       |   16 +++++++++-
 2 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index 2867677..9be26e5 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -55,6 +55,10 @@ static void test_ScriptItemize( void )
     static const WCHAR test7[]  = {'p','a','r','t',' ','o','n','e',' ',0x05d7, 0x05dc, 0x05e7, ' ', 0x05e9, 0x05ea, 0x05d9, 0x05d9, 0x05dd, ' ','p','a','r','t',' ','t','h','r','e','e', 0};
     static const WCHAR test8[] = {0x0633, 0x0644, 0x0627, 0x0645,0};
 
+    /* Syriac  (Like Arabic )*/
+    static const WCHAR test9[] = {0x0710, 0x0712, 0x0712, 0x0714, '.',0};
+    static const WCHAR test10[] = {0x0717, 0x0718, 0x071a, 0x071b,0};
+
     SCRIPT_ITEM items[15];
     SCRIPT_CONTROL  Control;
     SCRIPT_STATE    State;
@@ -407,6 +411,70 @@ static void test_ScriptItemize( void )
     ok(items[0].a.fRTL == 1, "Wrong fRTL\n");
     ok(items[0].a.fLayoutRTL == 1, "Wrong fLayoutRTL\n");
     ok(items[0].a.s.uBidiLevel == 1, "Wrong BidiLevel\n");
+
+    hr = ScriptItemize(test9, 5, 10, NULL, NULL, items, &nItems);
+    ok(!hr, "ScriptItemize should return S_OK not %08x\n", hr);
+    ok(nItems == 2, "Wrong number of items\n");
+    ok(items[0].iCharPos == 0, "Wrong CharPos \n");
+    ok(items[0].a.fRTL == 1, "Wrong fRTL\n");
+    ok(items[0].a.fLayoutRTL == 1, "Wrong fLayoutRTL\n");
+    ok(items[0].a.s.uBidiLevel == 1, "Wrong BidiLevel\n");
+    ok(items[1].iCharPos == 4, "Wrong CharPos \n");
+    ok(items[1].a.fRTL == 0, "Wrong fRTL\n");
+    ok(items[1].a.fLayoutRTL == 0, "Wrong fLayoutRTL\n");
+    ok(items[1].a.s.uBidiLevel == 0, "Wrong BidiLevel\n");
+
+    State.uBidiLevel = 0;
+    hr = ScriptItemize(test9, 5, 10, &Control, &State, items, &nItems);
+    ok(!hr, "ScriptItemize should return S_OK not %08x\n", hr);
+    ok(nItems == 2, "Wrong number of items\n");
+    ok(items[0].iCharPos == 0, "Wrong CharPos \n");
+    ok(items[0].a.fRTL == 1, "Wrong fRTL\n");
+    ok(items[0].a.fLayoutRTL == 1, "Wrong fLayoutRTL\n");
+    ok(items[0].a.s.uBidiLevel == 1, "Wrong BidiLevel\n");
+    ok(items[1].iCharPos == 4, "Wrong CharPos \n");
+    ok(items[1].a.fRTL == 0, "Wrong fRTL\n");
+    ok(items[1].a.fLayoutRTL == 0, "Wrong fLayoutRTL\n");
+    ok(items[1].a.s.uBidiLevel == 0, "Wrong BidiLevel\n");
+
+    State.uBidiLevel = 1;
+    hr = ScriptItemize(test9, 5, 10, &Control, &State, items, &nItems);
+    ok(!hr, "ScriptItemize should return S_OK not %08x\n", hr);
+    ok(nItems == 2, "Wrong number of items\n");
+    ok(items[0].iCharPos == 0, "Wrong CharPos \n");
+    ok(items[0].a.fRTL == 1, "Wrong fRTL\n");
+    ok(items[0].a.fLayoutRTL == 1, "Wrong fLayoutRTL\n");
+    ok(items[0].a.s.uBidiLevel == 1, "Wrong BidiLevel\n");
+    ok(items[1].iCharPos == 4, "Wrong CharPos \n");
+    todo_wine ok(items[1].a.fRTL == 1, "Wrong fRTL\n");
+    todo_wine ok(items[1].a.fLayoutRTL == 1, "Wrong fLayoutRTL\n");
+    todo_wine ok(items[1].a.s.uBidiLevel == 1, "Wrong BidiLevel\n");
+
+    hr = ScriptItemize(test10, 4, 10, NULL, NULL, items, &nItems);
+    ok(!hr, "ScriptItemize should return S_OK not %08x\n", hr);
+    ok(nItems == 1, "Wrong number of items\n");
+    ok(items[0].iCharPos == 0, "Wrong CharPos \n");
+    ok(items[0].a.fRTL == 1, "Wrong fRTL\n");
+    ok(items[0].a.fLayoutRTL == 1, "Wrong fLayoutRTL\n");
+    ok(items[0].a.s.uBidiLevel == 1, "Wrong BidiLevel\n");
+
+    State.uBidiLevel = 0;
+    hr = ScriptItemize(test10, 4, 10, &Control, &State, items, &nItems);
+    ok(!hr, "ScriptItemize should return S_OK not %08x\n", hr);
+    ok(nItems == 1, "Wrong number of items\n");
+    ok(items[0].iCharPos == 0, "Wrong CharPos \n");
+    ok(items[0].a.fRTL == 1, "Wrong fRTL\n");
+    ok(items[0].a.fLayoutRTL == 1, "Wrong fLayoutRTL\n");
+    ok(items[0].a.s.uBidiLevel == 1, "Wrong BidiLevel\n");
+
+    State.uBidiLevel = 1;
+    hr = ScriptItemize(test10, 4, 10, &Control, &State, items, &nItems);
+    ok(!hr, "ScriptItemize should return S_OK not %08x\n", hr);
+    ok(nItems == 1, "Wrong number of items\n");
+    ok(items[0].iCharPos == 0, "Wrong CharPos \n");
+    ok(items[0].a.fRTL == 1, "Wrong fRTL\n");
+    ok(items[0].a.fLayoutRTL == 1, "Wrong fLayoutRTL\n");
+    ok(items[0].a.s.uBidiLevel == 1, "Wrong BidiLevel\n");
 }
 
 
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index a1af271..201a74a 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -519,8 +519,11 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
 #define Arabic_stop   0x06ff
 #define Hebrew_start  0x0590
 #define Hebrew_stop   0x05ff
+#define Syriac_start  0x0700
+#define Syriac_stop   0x074f
 #define Latin_start   0x0001
 #define Latin_stop    0x024f
+#define Script_Syriac  8
 #define Script_Hebrew  7
 #define Script_Arabic  6
 #define Script_Latin   1
@@ -574,6 +577,9 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
     if  (pwcInChars[cnt] >= Hebrew_start && pwcInChars[cnt] <= Hebrew_stop)
         pItems[index].a.eScript = Script_Hebrew;
     else
+    if  (pwcInChars[cnt] >= Syriac_start && pwcInChars[cnt] <= Syriac_stop)
+        pItems[index].a.eScript = Script_Syriac;
+    else
     if  (pwcInChars[cnt] >= Latin_start && pwcInChars[cnt] <= Latin_stop)
         pItems[index].a.eScript = Script_Latin;
 
@@ -584,7 +590,8 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
         pItems[index].a.s.uBidiLevel = levels[cnt];
     }
     else if ((pItems[index].a.eScript  == Script_Arabic) ||
-             (pItems[index].a.eScript  == Script_Hebrew))
+             (pItems[index].a.eScript  == Script_Hebrew) ||
+             (pItems[index].a.eScript  == Script_Syriac))
     {
         pItems[index].a.s.uBidiLevel = 1;
         pItems[index].a.fRTL = 1;
@@ -619,6 +626,10 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
              || (New_Script == Script_Hebrew && pwcInChars[cnt] == Numeric_space))
             New_Script = Script_Hebrew;
         else
+        if  ((pwcInChars[cnt] >= Syriac_start && pwcInChars[cnt] <= Syriac_stop)
+             || (New_Script == Script_Syriac && pwcInChars[cnt] == Numeric_space))
+            New_Script = Script_Syriac;
+        else
         if  ((pwcInChars[cnt] >= Latin_start && pwcInChars[cnt] <= Latin_stop)
              || (New_Script == Script_Latin && pwcInChars[cnt] == Numeric_space))
             New_Script = Script_Latin;
@@ -642,7 +653,8 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
                 pItems[index].a.s.uBidiLevel = levels[cnt];
             }
             else if  ((New_Script == Script_Arabic) ||
-                      (New_Script == Script_Hebrew))
+                      (New_Script == Script_Hebrew) ||
+                      (New_Script == Script_Syriac))
             {
                 pItems[index].a.s.uBidiLevel = 1;
                 pItems[index].a.fRTL = 1;




More information about the wine-cvs mailing list