[PATCH 2/5] usp10: Handle C2_ARABICNUMBER as numeric.

Henri Verbeet hverbeet at codeweavers.com
Tue Jun 7 14:18:34 CDT 2016


I.e., make sure ٬ and ٫ get classified as Script_Arabic_Numeric.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/usp10/tests/usp10.c | 22 +++++++++++-----------
 dlls/usp10/usp10.c       |  5 +++--
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index 1793e65..fe579d3 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -584,19 +584,19 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
                                     {{0,0,0,0,0,0}, 3,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0}, 6,0,0,0,1,arab_tag,FALSE},
                                     {{0,0,0,0,0,0}, 7,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0},10,0,0,0,1,arab_tag,FALSE},
                                     {{0,0,0,0,0,0},11,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
-    static const itemTest t574[] = {{{0,0,0,0,0,0}, 0,0,1,2,0,arab_tag,FALSE},{{0,0,1,0,0,0}, 2,0,1,2,0,arab_tag,FALSE},
-                                    {{0,0,0,0,0,0}, 3,0,1,2,0,arab_tag,FALSE},{{0,0,1,0,0,0}, 6,0,1,2,0,arab_tag,FALSE},
-                                    {{0,0,0,0,0,0}, 7,0,1,2,0,arab_tag,FALSE},{{0,0,1,0,0,0},10,0,1,2,0,arab_tag,FALSE},
+    static const itemTest t574[] = {{{0,0,0,0,0,0}, 0,0,1,2,0,arab_tag,FALSE},{{0,0,0,0,0,0}, 2,0,1,2,0,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0}, 3,0,1,2,0,arab_tag,FALSE},{{0,0,0,0,0,0}, 6,0,1,2,0,arab_tag,FALSE},
+                                    {{0,0,0,0,0,0}, 7,0,1,2,0,arab_tag,FALSE},{{0,0,0,0,0,0},10,0,1,2,0,arab_tag,FALSE},
                                     {{0,0,0,0,0,0},11,0,1,2,0,arab_tag,FALSE},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
     /* Arabic numerals and punctuation. */
     static const WCHAR test58[] = {0x0661, 0x0662, 0x066c, 0x0663, 0x0664, 0x0665, 0x066c,  /* ١٢٬٣٤٥٬ */
                                    0x0666, 0x0667, 0x0668, 0x066b, 0x0669, 0x0660};         /* ٦٧٨٫٩٠ */
     static const itemTest t581[] = {{{0,1,0,1,0,0}, 0,0,1,2,0,arab_tag,FALSE},
-                                    {{1,1,1,1,1,0},13,0,0,0,0,-1,FALSE}};
+                                    {{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
     static const itemTest t582[] = {{{0,1,1,1,0,1}, 0,0,0,0,1,arab_tag,FALSE},
-                                    {{1,1,1,1,1,0},13,0,0,0,0,-1,FALSE}};
+                                    {{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
     static const itemTest t583[] = {{{0,0,0,0,0,0}, 0,0,1,2,0,arab_tag,FALSE},
-                                    {{1,0,0,1,1,0},13,0,0,0,0,-1,FALSE}};
+                                    {{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE}};
 
     SCRIPT_ITEM items[15];
     SCRIPT_CONTROL  Control;
@@ -680,7 +680,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test47,26,NULL,NULL,1,t471,FALSE,0);
     test_items_ok(test56,6,NULL,NULL,1,t561,FALSE,0);
     test_items_ok(test57,13,NULL,NULL,7,t571,FALSE,0);
-    test_items_ok(test58,13,NULL,NULL,1,t581,TRUE,0);
+    test_items_ok(test58,13,NULL,NULL,1,t581,FALSE,0);
 
     State.uBidiLevel = 0;
     test_items_ok(test1,4,&Control,&State,1,t11,FALSE,0);
@@ -745,7 +745,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test55,8,&Control,&State,2,t551,FALSE,0);
     test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
     test_items_ok(test57,13,&Control,&State,7,t572,FALSE,0);
-    test_items_ok(test58,13,&Control,&State,1,t581,TRUE,0);
+    test_items_ok(test58,13,&Control,&State,1,t581,FALSE,0);
 
     State.uBidiLevel = 1;
     test_items_ok(test1,4,&Control,&State,1,t12,FALSE,0);
@@ -802,7 +802,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0);
     test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
     test_items_ok(test57,13,&Control,&State,7,t574,FALSE,0);
-    test_items_ok(test58,13,&Control,&State,1,t583,TRUE,0);
+    test_items_ok(test58,13,&Control,&State,1,t583,FALSE,0);
 
     State.uBidiLevel = 1;
     Control.fMergeNeutralItems = TRUE;
@@ -860,7 +860,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0);
     test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
     test_items_ok(test57,13,&Control,&State,7,t574,FALSE,0);
-    test_items_ok(test58,13,&Control,&State,1,t583,TRUE,0);
+    test_items_ok(test58,13,&Control,&State,1,t583,FALSE,0);
 
     State.uBidiLevel = 0;
     Control.fMergeNeutralItems = FALSE;
@@ -927,7 +927,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
     test_items_ok(test55,8,&Control,&State,2,t552,FALSE,0);
     test_items_ok(test56,6,&Control,&State,1,t562,FALSE,0);
     test_items_ok(test57,13,&Control,&State,7,t573,FALSE,0);
-    test_items_ok(test58,13,&Control,&State,1,t582,TRUE,0);
+    test_items_ok(test58,13,&Control,&State,1,t582,FALSE,0);
 }
 
 static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 8c4991a..d686a68 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -891,7 +891,7 @@ static inline DWORD decode_surrogate_pair(LPCWSTR str, INT index, INT end)
 static WORD get_char_script( LPCWSTR str, INT index, INT end, INT *consumed)
 {
     static const WCHAR latin_punc[] = {'#','$','&','\'',',',';','<','>','?','@','\\','^','_','`','{','|','}','~', 0x00a0, 0};
-    WORD type = 0;
+    WORD type = 0, type2 = 0;
     DWORD ch;
     int i;
 
@@ -921,6 +921,7 @@ static WORD get_char_script( LPCWSTR str, INT index, INT end, INT *consumed)
     }
 
     GetStringTypeW(CT_CTYPE1, &str[index], 1, &type);
+    GetStringTypeW(CT_CTYPE2, &str[index], 1, &type2);
 
     if (type == 0)
         return SCRIPT_UNDEFINED;
@@ -942,7 +943,7 @@ static WORD get_char_script( LPCWSTR str, INT index, INT end, INT *consumed)
 
         if (ch >= scriptRanges[i].rangeFirst && ch <= scriptRanges[i].rangeLast)
         {
-            if (scriptRanges[i].numericScript && type & C1_DIGIT)
+            if (scriptRanges[i].numericScript && (type & C1_DIGIT || type2 == C2_ARABICNUMBER))
                 return scriptRanges[i].numericScript;
             if (scriptRanges[i].punctScript && type & C1_PUNCT)
                 return scriptRanges[i].punctScript;
-- 
2.1.4




More information about the wine-patches mailing list