Aric Stewart : usp10: Merge neutral scripts.

Alexandre Julliard julliard at winehq.org
Tue Nov 15 13:17:31 CST 2011


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Nov 14 13:17:25 2011 -0700

usp10: Merge neutral scripts.

---

 dlls/usp10/usp10.c |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index f297125..0ffab66 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -870,8 +870,41 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int
             }
             if (psControl->fMergeNeutralItems)
             {
-                HeapFree(GetProcessHeap(),0,strength);
-                strength = NULL;
+                /* Merge the neutrals */
+                for (i = 0; i < cInChars; i++)
+                {
+                    if (strength[i] == BIDI_NEUTRAL || strength[i] == BIDI_WEAK)
+                    {
+                        int j;
+                        for (j = i; j > 0; j--)
+                        {
+                            if (levels[i] != levels[j])
+                                break;
+                            if ((strength[j] == BIDI_STRONG) || (strength[i] == BIDI_NEUTRAL && strength[j] == BIDI_WEAK))
+                            {
+                                scripts[i] = scripts[j];
+                                strength[i] = strength[j];
+                                break;
+                            }
+                        }
+                    }
+                    /* Try going the other way */
+                    if (strength[i] == BIDI_NEUTRAL || strength[i] == BIDI_WEAK)
+                    {
+                        int j;
+                        for (j = i; j < cInChars; j++)
+                        {
+                            if (levels[i] != levels[j])
+                                break;
+                            if ((strength[j] == BIDI_STRONG) || (strength[i] == BIDI_NEUTRAL && strength[j] == BIDI_WEAK))
+                            {
+                                scripts[i] = scripts[j];
+                                strength[i] = strength[j];
+                                break;
+                            }
+                        }
+                    }
+                }
             }
         }
     }




More information about the wine-cvs mailing list