Commit 75520505 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

usp10: Refine post-matra Ralf reordering to be post below form consonants as well.

parent 2a8e004b
...@@ -238,6 +238,7 @@ static BOOL Consonent_is_ralf(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, L ...@@ -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) static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR input, IndicSyllable *s, lexical_function lex)
{ {
int i; int i;
BOOL blwf = 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))
...@@ -257,8 +258,10 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP ...@@ -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--) for (i = s->base-1; i >= s->start; i--)
if (is_consonant( lex(input[i]) )) if (is_consonant( lex(input[i]) ))
{ {
...@@ -270,6 +273,9 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP ...@@ -270,6 +273,9 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP
if (s->ralf >= 0) if (s->ralf >= 0)
s->start = s->ralf; s->start = s->ralf;
if (s->ralf == s->base)
s->ralf = -1;
return s->base; return s->base;
} }
...@@ -303,6 +309,7 @@ void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, L ...@@ -303,6 +309,7 @@ void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, L
(*syllables)[*syllable_count].start = index; (*syllables)[*syllable_count].start = index;
(*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].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);
......
...@@ -1767,9 +1767,10 @@ static void Reorder_Ra_follows_matra(LPWSTR pwChar, IndicSyllable *s, lexical_fu ...@@ -1767,9 +1767,10 @@ static void Reorder_Ra_follows_matra(LPWSTR pwChar, IndicSyllable *s, lexical_fu
if (s->ralf >= 0) if (s->ralf >= 0)
{ {
int j,loc; int j,loc;
int stop = (s->blwf >=0)? s->blwf+1 : s->base;
WORD Ra = pwChar[s->start]; WORD Ra = pwChar[s->start];
WORD H = pwChar[s->start+1]; 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) if (lexical(pwChar[loc]) == lex_Matra_post || lexical(pwChar[loc]) == lex_Matra_below)
break; break;
...@@ -1781,6 +1782,7 @@ static void Reorder_Ra_follows_matra(LPWSTR pwChar, IndicSyllable *s, lexical_fu ...@@ -1781,6 +1782,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;
} }
} }
...@@ -1800,6 +1802,7 @@ static void Reorder_Ra_follows_syllable(LPWSTR pwChar, IndicSyllable *s, lexical ...@@ -1800,6 +1802,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;
} }
} }
...@@ -1822,6 +1825,7 @@ static void Reorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, lexical_ ...@@ -1822,6 +1825,7 @@ static void Reorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, lexical_
pwChar[s->base] = c; pwChar[s->base] = c;
if (s->ralf >= s->base) s->ralf++; if (s->ralf >= s->base) s->ralf++;
if (s->blwf >= s->base) s->blwf++;
s->base ++; s->base ++;
} }
} }
...@@ -1847,6 +1851,7 @@ static void Reorder_Matra_precede_syllable(LPWSTR pwChar, IndicSyllable *s, lexi ...@@ -1847,6 +1851,7 @@ static void Reorder_Matra_precede_syllable(LPWSTR pwChar, IndicSyllable *s, lexi
pwChar[s->start] = c; pwChar[s->start] = c;
if (s->ralf >= 0) s->ralf++; if (s->ralf >= 0) s->ralf++;
if (s->blwf >= 0) s->blwf++;
s->base ++; s->base ++;
} }
} }
...@@ -1916,6 +1921,8 @@ static inline void shift_syllable_glyph_indexs(IndicSyllable *glyph_index, INT i ...@@ -1916,6 +1921,8 @@ static inline void shift_syllable_glyph_indexs(IndicSyllable *glyph_index, INT i
glyph_index->end+= shift; glyph_index->end+= shift;
if (glyph_index->ralf > index) if (glyph_index->ralf > index)
glyph_index->ralf+= shift; 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 ) 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 ...@@ -2014,7 +2021,10 @@ static void Apply_Indic_PostBase(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa
count = syllable->end - syllable->base; 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); index = find_halant_consonant(&pwChars[syllable->base], 0, count, lexical);
while (index >= 0) while (index >= 0)
......
...@@ -100,6 +100,7 @@ typedef struct { ...@@ -100,6 +100,7 @@ typedef struct {
INT start; INT start;
INT base; INT base;
INT ralf; INT ralf;
INT blwf;
INT end; INT end;
} IndicSyllable; } IndicSyllable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment