Aric Stewart : usp10: Do not require a separate call to find Indic base consonant.

Alexandre Julliard julliard at winehq.org
Wed Jun 15 13:43:02 CDT 2011


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Wed Jun 15 09:54:04 2011 -0500

usp10: Do not require a separate call to find Indic base consonant.

---

 dlls/usp10/indic.c          |   33 +++++++++++++++++----------------
 dlls/usp10/shape.c          |   10 ----------
 dlls/usp10/usp10_internal.h |    1 -
 3 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/dlls/usp10/indic.c b/dlls/usp10/indic.c
index 568401d..1b29959 100644
--- a/dlls/usp10/indic.c
+++ b/dlls/usp10/indic.c
@@ -212,6 +212,22 @@ static INT Indic_process_next_syllable( LPCWSTR input, INT cChar, INT start, INT
     return parse_consonant_syllable(input, cChar, start, main, next, lex);
 }
 
+static int FindBaseConsonant(LPWSTR input, IndicSyllable *s, lexical_function lex)
+{
+    int i;
+    /* try to find a base consonant */
+    if (!is_consonant( lex(input[s->base]) ))
+    {
+        for (i = s->end; i >= s->start; i--)
+            if (is_consonant( lex(input[i]) ))
+            {
+                s->base = i;
+                break;
+            }
+    }
+    return s->base;
+}
+
 void Indic_ReorderCharacters( LPWSTR input, int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, reorder_function reorder_f)
 {
     int index = 0;
@@ -242,6 +258,7 @@ void Indic_ReorderCharacters( LPWSTR input, int cChar, IndicSyllable **syllables
             (*syllables)[*syllable_count].start = index;
             (*syllables)[*syllable_count].base = center;
             (*syllables)[*syllable_count].end = next-1;
+            FindBaseConsonant(input, &(*syllables)[*syllable_count], lex);
             reorder_f(input, &(*syllables)[*syllable_count], lex);
             index = next;
             *syllable_count = (*syllable_count)+1;
@@ -262,19 +279,3 @@ void Indic_ReorderCharacters( LPWSTR input, int cChar, IndicSyllable **syllables
     }
     TRACE("Processed %i of %i characters into %i syllables\n",index,cChar,*syllable_count);
 }
-
-int Indic_FindBaseConsonant(LPWSTR input, IndicSyllable *s, lexical_function lex)
-{
-    int i;
-    /* try to find a base consonant */
-    if (!is_consonant( lex(input[s->base]) ))
-    {
-        for (i = s->end; i >= s->start; i--)
-            if (is_consonant( lex(input[i]) ))
-            {
-                s->base = i;
-                break;
-            }
-    }
-    return s->base;
-}
diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 99862f8..5c939f9 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -1956,8 +1956,6 @@ static void Reorder_Like_Sinhala(LPWSTR pwChar, IndicSyllable *s, lexical_functi
 {
     TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
     if (s->start == s->base && s->base == s->end)  return;
-
-    Indic_FindBaseConsonant(pwChar, s, lexical);
     if (lexical(pwChar[s->base]) == lex_Vowel) return;
 
     Reorder_Ra_follows_base(pwChar, s, lexical);
@@ -1968,8 +1966,6 @@ static void Reorder_Like_Devanagari(LPWSTR pwChar, IndicSyllable *s, lexical_fun
 {
     TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
     if (s->start == s->base && s->base == s->end)  return;
-
-    Indic_FindBaseConsonant(pwChar, s, lexical);
     if (lexical(pwChar[s->base]) == lex_Vowel) return;
 
     Reorder_Ra_follows_matra(pwChar, s, lexical);
@@ -1980,8 +1976,6 @@ static void Reorder_Like_Bengali(LPWSTR pwChar, IndicSyllable *s, lexical_functi
 {
     TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
     if (s->start == s->base && s->base == s->end)  return;
-
-    Indic_FindBaseConsonant(pwChar, s, lexical);
     if (lexical(pwChar[s->base]) == lex_Vowel) return;
 
     Reorder_Ra_follows_base(pwChar, s, lexical);
@@ -1992,8 +1986,6 @@ static void Reorder_Like_Kannada(LPWSTR pwChar, IndicSyllable *s, lexical_functi
 {
     TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
     if (s->start == s->base && s->base == s->end)  return;
-
-    Indic_FindBaseConsonant(pwChar, s, lexical);
     if (lexical(pwChar[s->base]) == lex_Vowel) return;
 
     Reorder_Ra_follows_syllable(pwChar, s, lexical);
@@ -2004,8 +1996,6 @@ static void Reorder_Like_Malayalam(LPWSTR pwChar, IndicSyllable *s, lexical_func
 {
     TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
     if (s->start == s->base && s->base == s->end)  return;
-
-    Indic_FindBaseConsonant(pwChar, s, lexical);
     if (lexical(pwChar[s->base]) == lex_Vowel) return;
 
     Reorder_Ra_follows_matra(pwChar, s, lexical);
diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h
index 40dce16..7e7e257 100644
--- a/dlls/usp10/usp10_internal.h
+++ b/dlls/usp10/usp10_internal.h
@@ -121,4 +121,3 @@ HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANA
 void SHAPE_CharGlyphProp(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) DECLSPEC_HIDDEN;
 
 void Indic_ReorderCharacters( LPWSTR input, int cChars, IndicSyllable **syllables, int *syllable_count, lexical_function lexical_f, reorder_function reorder_f) DECLSPEC_HIDDEN;
-int Indic_FindBaseConsonant(LPWSTR pwChar, IndicSyllable *syllable, lexical_function lex) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list