From 75520505de39555af87b9f4e1911bff224da638f Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Thu, 16 Jun 2011 11:28:43 -0500 Subject: [PATCH] usp10: Refine post-matra Ralf reordering to be post below form consonants as well. --- dlls/usp10/indic.c | 9 ++++++++- dlls/usp10/shape.c | 14 ++++++++++++-- dlls/usp10/usp10_internal.h | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/dlls/usp10/indic.c b/dlls/usp10/indic.c index 09de3b5c2be..82ef2c1b9b4 100644 --- a/dlls/usp10/indic.c +++ b/dlls/usp10/indic.c @@ -238,6 +238,7 @@ static BOOL Consonent_is_ralf(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, L static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR input, IndicSyllable *s, lexical_function lex) { int i; + BOOL blwf = FALSE; /* remove ralf from consideration */ if (Consonent_is_ralf(hdc, psa, psc, input, s, lex)) @@ -257,8 +258,10 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP } } - while (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) || Consonent_is_pre_base_form(hdc, psa, psc, input, s, lex)) { + if (blwf && s->blwf == -1) + s->blwf = s->base - 1; for (i = s->base-1; i >= s->start; i--) if (is_consonant( lex(input[i]) )) { @@ -270,6 +273,9 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP if (s->ralf >= 0) s->start = s->ralf; + if (s->ralf == s->base) + s->ralf = -1; + return s->base; } @@ -303,6 +309,7 @@ void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, L (*syllables)[*syllable_count].start = index; (*syllables)[*syllable_count].base = center; (*syllables)[*syllable_count].ralf = -1; + (*syllables)[*syllable_count].blwf = -1; (*syllables)[*syllable_count].end = next-1; FindBaseConsonant(hdc, psa, psc, input, &(*syllables)[*syllable_count], lex); reorder_f(input, &(*syllables)[*syllable_count], lex); diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c index c8f11dbbc38..b114618f232 100644 --- a/dlls/usp10/shape.c +++ b/dlls/usp10/shape.c @@ -1767,9 +1767,10 @@ static void Reorder_Ra_follows_matra(LPWSTR pwChar, IndicSyllable *s, lexical_fu if (s->ralf >= 0) { int j,loc; + int stop = (s->blwf >=0)? s->blwf+1 : s->base; WORD Ra = pwChar[s->start]; WORD H = pwChar[s->start+1]; - for (loc = s->end; loc > s->base; loc--) + for (loc = s->end; loc > stop; loc--) if (lexical(pwChar[loc]) == lex_Matra_post || lexical(pwChar[loc]) == lex_Matra_below) break; @@ -1781,6 +1782,7 @@ static void Reorder_Ra_follows_matra(LPWSTR pwChar, IndicSyllable *s, lexical_fu s->ralf = loc-1; s->base -= 2; + if (s->blwf >= 0) s->blwf -= 2; } } @@ -1800,6 +1802,7 @@ static void Reorder_Ra_follows_syllable(LPWSTR pwChar, IndicSyllable *s, lexical s->ralf = s->end-1; s->base -= 2; + if (s->blwf >= 0) s->blwf -= 2; } } @@ -1822,6 +1825,7 @@ static void Reorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, lexical_ pwChar[s->base] = c; if (s->ralf >= s->base) s->ralf++; + if (s->blwf >= s->base) s->blwf++; s->base ++; } } @@ -1847,6 +1851,7 @@ static void Reorder_Matra_precede_syllable(LPWSTR pwChar, IndicSyllable *s, lexi pwChar[s->start] = c; if (s->ralf >= 0) s->ralf++; + if (s->blwf >= 0) s->blwf++; s->base ++; } } @@ -1916,6 +1921,8 @@ static inline void shift_syllable_glyph_indexs(IndicSyllable *glyph_index, INT i glyph_index->end+= shift; if (glyph_index->ralf > index) glyph_index->ralf+= shift; + if (glyph_index->blwf > index) + glyph_index->blwf+= 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 ) @@ -2014,7 +2021,10 @@ static void Apply_Indic_PostBase(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa count = syllable->end - syllable->base; - g_offset = 0; + if (syllable->ralf >= syllable->base) + g_offset = -1; + else + g_offset = 0; index = find_halant_consonant(&pwChars[syllable->base], 0, count, lexical); while (index >= 0) diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h index 2b70697d22a..00d9583d494 100644 --- a/dlls/usp10/usp10_internal.h +++ b/dlls/usp10/usp10_internal.h @@ -100,6 +100,7 @@ typedef struct { INT start; INT base; INT ralf; + INT blwf; INT end; } IndicSyllable;