usp10: Pre-base consonants need to be reordered like pre-base matras for scripts that have them.

This commit is contained in:
Aric Stewart 2011-06-16 11:29:03 -05:00 committed by Alexandre Julliard
parent 9a849038ec
commit 520f07a4b0
3 changed files with 27 additions and 1 deletions

View File

@ -239,6 +239,7 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP
{ {
int i; int i;
BOOL blwf = FALSE; BOOL blwf = FALSE;
BOOL pref = FALSE;
/* remove ralf from consideration */ /* remove ralf from consideration */
if (Consonent_is_ralf(hdc, psa, psc, input, s, lex)) if (Consonent_is_ralf(hdc, psa, psc, input, s, lex))
@ -258,10 +259,13 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP
} }
} }
while ((blwf = Consonent_is_below_base_form(hdc, psa, psc, input, s, lex)) || Consonent_is_post_base_form(hdc, psa, psc, input, s, lex) || Consonent_is_pre_base_form(hdc, psa, psc, input, s, lex)) while ((blwf = Consonent_is_below_base_form(hdc, psa, psc, input, s, lex)) || Consonent_is_post_base_form(hdc, psa, psc, input, s, lex) || (pref = Consonent_is_pre_base_form(hdc, psa, psc, input, s, lex)))
{ {
if (blwf && s->blwf == -1) if (blwf && s->blwf == -1)
s->blwf = s->base - 1; s->blwf = s->base - 1;
if (pref && s->pref == -1)
s->pref = s->base - 1;
for (i = s->base-1; i >= s->start; i--) for (i = s->base-1; i >= s->start; i--)
if (is_consonant( lex(input[i]) )) if (is_consonant( lex(input[i]) ))
{ {
@ -310,6 +314,7 @@ void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, L
(*syllables)[*syllable_count].base = center; (*syllables)[*syllable_count].base = center;
(*syllables)[*syllable_count].ralf = -1; (*syllables)[*syllable_count].ralf = -1;
(*syllables)[*syllable_count].blwf = -1; (*syllables)[*syllable_count].blwf = -1;
(*syllables)[*syllable_count].pref = -1;
(*syllables)[*syllable_count].end = next-1; (*syllables)[*syllable_count].end = next-1;
FindBaseConsonant(hdc, psa, psc, input, &(*syllables)[*syllable_count], lex); FindBaseConsonant(hdc, psa, psc, input, &(*syllables)[*syllable_count], lex);
reorder_f(input, &(*syllables)[*syllable_count], lex); reorder_f(input, &(*syllables)[*syllable_count], lex);

View File

@ -1785,6 +1785,7 @@ static void Reorder_Ra_follows_matra(LPWSTR pwChar, IndicSyllable *s, lexical_fu
s->ralf = loc-1; s->ralf = loc-1;
s->base -= 2; s->base -= 2;
if (s->blwf >= 0) s->blwf -= 2; if (s->blwf >= 0) s->blwf -= 2;
if (s->pref >= 0) s->pref -= 2;
} }
} }
@ -1805,6 +1806,7 @@ static void Reorder_Ra_follows_syllable(LPWSTR pwChar, IndicSyllable *s, lexical
s->ralf = s->end-1; s->ralf = s->end-1;
s->base -= 2; s->base -= 2;
if (s->blwf >= 0) s->blwf -= 2; if (s->blwf >= 0) s->blwf -= 2;
if (s->pref >= 0) s->pref -= 2;
} }
} }
@ -1828,6 +1830,7 @@ static void Reorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, lexical_
if (s->ralf >= s->base) s->ralf++; if (s->ralf >= s->base) s->ralf++;
if (s->blwf >= s->base) s->blwf++; if (s->blwf >= s->base) s->blwf++;
if (s->pref >= s->base) s->pref++;
s->base ++; s->base ++;
} }
} }
@ -1854,6 +1857,7 @@ static void Reorder_Matra_precede_syllable(LPWSTR pwChar, IndicSyllable *s, lexi
if (s->ralf >= 0) s->ralf++; if (s->ralf >= 0) s->ralf++;
if (s->blwf >= 0) s->blwf++; if (s->blwf >= 0) s->blwf++;
if (s->pref >= 0) s->pref++;
s->base ++; s->base ++;
} }
} }
@ -1907,6 +1911,19 @@ static void SecondReorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, WO
} }
} }
static void SecondReorder_Pref_precede_base(LPWSTR pwChar, IndicSyllable *s, WORD *glyphs, IndicSyllable *g, lexical_function lexical)
{
if (s->pref >= 0 && g->pref > g->base)
{
int j;
WCHAR og = glyphs[g->pref];
TRACE("Doing reorder of pref from %i to %i\n",g->pref,g->base);
for (j = g->pref; j > g->base; j--)
glyphs[j] = glyphs[j-1];
glyphs[g->base] = og;
}
}
static void Reorder_Like_Sinhala(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical) static void Reorder_Like_Sinhala(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
{ {
TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end); TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
@ -1965,6 +1982,7 @@ static void SecondReorder_Like_Tamil(LPWSTR pwChar, IndicSyllable *s, WORD* pwGl
if (lexical(pwChar[s->base]) == lex_Vowel) return; if (lexical(pwChar[s->base]) == lex_Vowel) return;
SecondReorder_Matra_precede_base(pwChar, s, pwGlyphs, g, lexical); SecondReorder_Matra_precede_base(pwChar, s, pwGlyphs, g, lexical);
SecondReorder_Pref_precede_base(pwChar, s, pwGlyphs, g, lexical);
} }
@ -1983,6 +2001,8 @@ static inline void shift_syllable_glyph_indexs(IndicSyllable *glyph_index, INT i
glyph_index->ralf+= shift; glyph_index->ralf+= shift;
if (glyph_index->blwf > index) if (glyph_index->blwf > index)
glyph_index->blwf+= shift; glyph_index->blwf+= shift;
if (glyph_index->pref > index)
glyph_index->pref+= shift;
} }
static void Apply_Indic_BasicForm(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwChars, INT cChars, IndicSyllable *syllable, WORD *pwOutGlyphs, INT* pcGlyphs, WORD *pwLogClust, lexical_function lexical, IndicSyllable *glyph_index, const GSUB_Feature *feature ) static void Apply_Indic_BasicForm(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwChars, INT cChars, IndicSyllable *syllable, WORD *pwOutGlyphs, INT* pcGlyphs, WORD *pwLogClust, lexical_function lexical, IndicSyllable *glyph_index, const GSUB_Feature *feature )

View File

@ -101,6 +101,7 @@ typedef struct {
INT base; INT base;
INT ralf; INT ralf;
INT blwf; INT blwf;
INT pref;
INT end; INT end;
} IndicSyllable; } IndicSyllable;