Aric Stewart : usp10: All glyphs in a single indic syllable are part of the same cluster.

Alexandre Julliard julliard at winehq.org
Fri Oct 28 12:48:37 CDT 2011


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu Oct 27 13:38:42 2011 -0500

usp10: All glyphs in a single indic syllable are part of the same cluster.

---

 dlls/usp10/indic.c          |   33 ++++++++++++++++++++++++---------
 dlls/usp10/shape.c          |   21 +++++++++++++++++++++
 dlls/usp10/usp10_internal.h |    1 +
 3 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/dlls/usp10/indic.c b/dlls/usp10/indic.c
index f8e5b5e..df2a977 100644
--- a/dlls/usp10/indic.c
+++ b/dlls/usp10/indic.c
@@ -71,7 +71,8 @@ static void debug_output_string(LPCWSTR str, int cChar, lexical_function f)
 static inline BOOL is_matra( int type )
 {
     return (type == lex_Matra_above || type == lex_Matra_below ||
-            type == lex_Matra_pre || type == lex_Matra_post);
+            type == lex_Matra_pre || type == lex_Matra_post ||
+            type == lex_Composed_Vowel);
 }
 
 static inline BOOL is_joiner( int type )
@@ -207,7 +208,7 @@ static INT Indic_process_next_syllable( LPCWSTR input, INT cChar, INT start, INT
     return parse_consonant_syllable(input, cChar, start, main, next, lex);
 }
 
-static BOOL Consonent_is_post_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
+static BOOL Consonent_is_post_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
 {
     if (is_consonant(lexical(pwChar[s->base])) && s->base > s->start && lexical(pwChar[s->base-1]) == lex_Halant)
     {
@@ -224,7 +225,7 @@ static BOOL Consonent_is_post_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCac
     return FALSE;
 }
 
-static BOOL Consonent_is_below_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
+static BOOL Consonent_is_below_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
 {
     if (is_consonant(lexical(pwChar[s->base])) && s->base > s->start && lexical(pwChar[s->base-1]) == lex_Halant)
     {
@@ -241,7 +242,7 @@ static BOOL Consonent_is_below_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCa
     return FALSE;
 }
 
-static BOOL Consonent_is_pre_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
+static BOOL Consonent_is_pre_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
 {
     if (is_consonant(lexical(pwChar[s->base])) && s->base > s->start && lexical(pwChar[s->base-1]) == lex_Halant)
     {
@@ -258,14 +259,14 @@ static BOOL Consonent_is_pre_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCach
     return FALSE;
 }
 
-static BOOL Consonent_is_ralf(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
+static BOOL Consonent_is_ralf(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical)
 {
     if ((lexical(pwChar[s->start])==lex_Ra) && s->end > s->start && lexical(pwChar[s->start+1]) == lex_Halant)
         return (SHAPE_does_GSUB_feature_apply_to_chars(hdc, psa, psc, &pwChar[s->start], 1, 2, "rphf") > 0);
     return FALSE;
 }
 
-static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR input, IndicSyllable *s, lexical_function lex, BOOL modern)
+static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR input, IndicSyllable *s, lexical_function lex, BOOL modern)
 {
     int i;
     BOOL blwf = FALSE;
@@ -313,7 +314,7 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP
     return s->base;
 }
 
-void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR input, int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, reorder_function reorder_f, BOOL modern)
+void Indic_ParseSyllables( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR input, const int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, BOOL modern)
 {
     int index = 0;
     int next = 0;
@@ -321,7 +322,7 @@ void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, L
 
     *syllable_count = 0;
 
-    if (!lex || ! reorder_f)
+    if (!lex)
     {
         ERR("Failure to have required functions\n");
         return;
@@ -349,7 +350,6 @@ void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, L
             (*syllables)[*syllable_count].pref = -1;
             (*syllables)[*syllable_count].end = next-1;
             FindBaseConsonant(hdc, psa, psc, input, &(*syllables)[*syllable_count], lex, modern);
-            reorder_f(input, &(*syllables)[*syllable_count], lex);
             index = next;
             *syllable_count = (*syllable_count)+1;
         }
@@ -361,3 +361,18 @@ void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, L
     }
     TRACE("Processed %i of %i characters into %i syllables\n",index,cChar,*syllable_count);
 }
+
+void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR input, int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, reorder_function reorder_f, BOOL modern)
+{
+    int i;
+
+    if (!reorder_f)
+    {
+        ERR("Failure to have required functions\n");
+        return;
+    }
+
+    Indic_ParseSyllables(hdc, psa, psc, input, cChar, syllables, syllable_count, lex, modern);
+    for (i = 0; i < *syllable_count; i++)
+        reorder_f(input, &(*syllables)[i], lex);
+}
diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 0b1af46..779e8f6 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -3213,6 +3213,9 @@ static void ShapeCharGlyphProp_Tibet( HDC hdc, ScriptCache* psc, SCRIPT_ANALYSIS
 static void ShapeCharGlyphProp_BaseIndic( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp, lexical_function lexical)
 {
     int i,k;
+    IndicSyllable *syllables = NULL;
+    int syllable_count = 0;
+    BOOL modern = get_GSUB_Indic2(psa, psc);
 
     for (i = 0; i < cGlyphs; i++)
     {
@@ -3257,7 +3260,25 @@ static void ShapeCharGlyphProp_BaseIndic( HDC hdc, ScriptCache *psc, SCRIPT_ANAL
                     break;
             }
     }
+
+    Indic_ParseSyllables( hdc, psa, psc, pwcChars, cChars, &syllables, &syllable_count, lexical, modern);
+
+    for (i = 0; i < syllable_count; i++)
+    {
+        int j;
+        WORD g = pwLogClust[syllables[i].start];
+        for (j = syllables[i].start+1; j <= syllables[i].end; j++)
+        {
+            if (pwLogClust[j] != g)
+            {
+                pGlyphProp[pwLogClust[j]].sva.fClusterStart = 0;
+                pwLogClust[j] = g;
+            }
+        }
+    }
+
     UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
+    HeapFree(GetProcessHeap(), 0, syllables);
 }
 
 static void ShapeCharGlyphProp_Devanagari( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp )
diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h
index e85afbe..7a88ac7 100644
--- a/dlls/usp10/usp10_internal.h
+++ b/dlls/usp10/usp10_internal.h
@@ -136,5 +136,6 @@ void SHAPE_CharGlyphProp(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const
 INT SHAPE_does_GSUB_feature_apply_to_chars(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, const WCHAR *chars, INT write_dir, INT count, const char* feature) DECLSPEC_HIDDEN;
 
 void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR input, int cChars, IndicSyllable **syllables, int *syllable_count, lexical_function lexical_f, reorder_function reorder_f, BOOL modern) DECLSPEC_HIDDEN;
+void Indic_ParseSyllables( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR input, const int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, BOOL modern);
 
 void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list