Nikolay Sivov : dwrite: Keep original script for NO_VISUAL case.

Alexandre Julliard julliard at winehq.org
Mon Jul 4 09:54:40 CDT 2016


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Jul  4 10:44:48 2016 +0300

dwrite: Keep original script for NO_VISUAL case.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/analyzer.c       |  7 +++---
 dlls/dwrite/tests/analyzer.c | 52 +++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 4 deletions(-)

diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index e49131b..5e53a54 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -249,7 +249,8 @@ static HRESULT analyze_script(const WCHAR *text, UINT32 position, UINT32 length,
     DWRITE_SCRIPT_ANALYSIS sa;
     UINT32 pos, i, seq_length;
 
-    if (!length) return S_OK;
+    if (!length)
+        return S_OK;
 
     sa = get_char_sa(*text);
 
@@ -268,11 +269,11 @@ static HRESULT analyze_script(const WCHAR *text, UINT32 position, UINT32 length,
         case Script_Common:
             if (cur_sa.script == Script_Unknown)
                 cur_sa.script = sa.script;
-            else if (cur_sa.script != Script_Common)
+            else if ((cur_sa.script != Script_Common) && sa.shapes == DWRITE_SCRIPT_SHAPES_DEFAULT)
                 sa.script = cur_sa.script;
             break;
         default:
-            if (cur_sa.script == Script_Unknown || cur_sa.script == Script_Common)
+            if ((cur_sa.script == Script_Common && cur_sa.shapes == DWRITE_SCRIPT_SHAPES_DEFAULT) || cur_sa.script == Script_Unknown)
                 cur_sa.script = sa.script;
         }
 
diff --git a/dlls/dwrite/tests/analyzer.c b/dlls/dwrite/tests/analyzer.c
index d008178..1e3b318 100644
--- a/dlls/dwrite/tests/analyzer.c
+++ b/dlls/dwrite/tests/analyzer.c
@@ -906,7 +906,57 @@ static struct sa_test sa_tests[] = {
             { 2, 2, DWRITE_SCRIPT_SHAPES_DEFAULT   },
             { 4, 2, DWRITE_SCRIPT_SHAPES_NO_VISUAL } }
     },
-    /* keep this as end marker */
+    {
+      /* Inherited on its own */
+      {0x300,0x300,0}, 1,
+          { { 0, 2, DWRITE_SCRIPT_SHAPES_DEFAULT } }
+    },
+    {
+      /* Inherited followed by Latin */
+      {0x300,0x300,'a',0}, 1,
+          { { 0, 3, DWRITE_SCRIPT_SHAPES_DEFAULT } }
+    },
+    {
+      /* Inherited mixed with Arabic and Latin */
+      {0x300,'+',0x627,0x300,'a',0}, 2,
+          { { 0, 4, DWRITE_SCRIPT_SHAPES_DEFAULT },
+            { 4, 1, DWRITE_SCRIPT_SHAPES_DEFAULT } }
+    },
+    {
+      {'a',0x300,'+',0x627,0x300,')','a',0}, 3,
+          { { 0, 3, DWRITE_SCRIPT_SHAPES_DEFAULT },
+            { 3, 3, DWRITE_SCRIPT_SHAPES_DEFAULT },
+            { 6, 1, DWRITE_SCRIPT_SHAPES_DEFAULT } }
+    },
+    /* Paired punctuation */
+    {
+      {0x627,'(','a',')','a',0}, 2,
+          { { 0, 2, DWRITE_SCRIPT_SHAPES_DEFAULT },
+            { 2, 3, DWRITE_SCRIPT_SHAPES_DEFAULT } }
+    },
+    {
+      {0x627,'[','a',']',0x627,0}, 3,
+          { { 0, 2, DWRITE_SCRIPT_SHAPES_DEFAULT },
+            { 2, 2, DWRITE_SCRIPT_SHAPES_DEFAULT },
+            { 4, 1, DWRITE_SCRIPT_SHAPES_DEFAULT } }
+    },
+    /* Combining marks */
+    {
+      /* dotted circle - Common, followed by accent - Inherited */
+      {0x25cc,0x300,0}, 1,
+          { { 0, 2, DWRITE_SCRIPT_SHAPES_DEFAULT } }
+    },
+    {
+      /* combining mark with explicit script value */
+      {0x25cc,0x300,0x5c4,0}, 1,
+          { { 0, 3, DWRITE_SCRIPT_SHAPES_DEFAULT } }
+    },
+    {
+      /* inherited merges with following explicit script */
+      {0x25cc,0x300,'a',0}, 1,
+          { { 0, 3, DWRITE_SCRIPT_SHAPES_DEFAULT } }
+    },
+    /* keep this as end test data marker */
     { {0} }
 };
 




More information about the wine-cvs mailing list