Module: wine Branch: master Commit: 520f07a4b0cce8f7431bc00f16d12efc05f8e50f URL: http://source.winehq.org/git/wine.git/?a=commit;h=520f07a4b0cce8f7431bc00f16...
Author: Aric Stewart aric@codeweavers.com Date: Thu Jun 16 11:29:03 2011 -0500
usp10: Pre-base consonants need to be reordered like pre-base matras for scripts that have them.
---
dlls/usp10/indic.c | 7 ++++++- dlls/usp10/shape.c | 20 ++++++++++++++++++++ dlls/usp10/usp10_internal.h | 1 + 3 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/dlls/usp10/indic.c b/dlls/usp10/indic.c index 82ef2c1..3855f0c 100644 --- a/dlls/usp10/indic.c +++ b/dlls/usp10/indic.c @@ -239,6 +239,7 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP { int i; BOOL blwf = FALSE; + BOOL pref = FALSE;
/* remove ralf from consideration */ 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) s->blwf = s->base - 1; + if (pref && s->pref == -1) + s->pref = s->base - 1; + for (i = s->base-1; i >= s->start; 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].ralf = -1; (*syllables)[*syllable_count].blwf = -1; + (*syllables)[*syllable_count].pref = -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 7151cd9..c1bc18f 100644 --- a/dlls/usp10/shape.c +++ b/dlls/usp10/shape.c @@ -1785,6 +1785,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; + 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->base -= 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->blwf >= s->base) s->blwf++; + if (s->pref >= s->base) s->pref++; 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->blwf >= 0) s->blwf++; + if (s->pref >= 0) s->pref++; 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) { 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;
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; if (glyph_index->blwf > index) 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 ) diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h index 00d9583..e4c42f8 100644 --- a/dlls/usp10/usp10_internal.h +++ b/dlls/usp10/usp10_internal.h @@ -101,6 +101,7 @@ typedef struct { INT base; INT ralf; INT blwf; + INT pref; INT end; } IndicSyllable;