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

This commit is contained in:
Aric Stewart 2011-06-15 09:54:04 -05:00 committed by Alexandre Julliard
parent 35948c6fdd
commit 5f22264c1d
3 changed files with 17 additions and 27 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;