Aric Stewart : usp10: Do matra second reorderings for Tamil and Malayalam to prevent blocking consonant ligatures .
Alexandre Julliard
julliard at winehq.org
Thu Jun 16 14:28:50 CDT 2011
Module: wine
Branch: master
Commit: 9a849038eca854adf87fae7cd302e712912f914d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9a849038eca854adf87fae7cd302e712912f914d
Author: Aric Stewart <aric at codeweavers.com>
Date: Thu Jun 16 11:28:53 2011 -0500
usp10: Do matra second reorderings for Tamil and Malayalam to prevent blocking consonant ligatures.
---
dlls/usp10/shape.c | 42 +++++++++++++++++++++++++++++++++---------
1 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 92a5bb6..7151cd9 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -1884,6 +1884,29 @@ static void SecondReorder_Blwf_follows_matra(LPWSTR pwChar, IndicSyllable *s, WO
}
}
+static void SecondReorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, WORD *glyphs, IndicSyllable *g, lexical_function lexical)
+{
+ int i;
+
+ /* reorder previously moved Matras to correct position*/
+ for (i = s->start; i < s->base; i++)
+ {
+ if (lexical(pwChar[i]) == lex_Matra_pre)
+ {
+ int j;
+ int g_start = g->start + i - s->start;
+ if (g_start < g->base -1 )
+ {
+ WCHAR og = glyphs[g_start];
+ TRACE("Doing reorder of matra from %i to %i\n",g_start,g->base);
+ for (j = g_start; j < g->base-1; j++)
+ glyphs[j] = glyphs[j+1];
+ glyphs[g->base-1] = 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);
@@ -1924,26 +1947,27 @@ static void Reorder_Like_Kannada(LPWSTR pwChar, IndicSyllable *s, lexical_functi
Reorder_Matra_precede_syllable(pwChar, s, lexical);
}
-static void Reorder_Like_Malayalam(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
+static void SecondReorder_Like_Telugu(LPWSTR pwChar, IndicSyllable *s, WORD* pwGlyphs, IndicSyllable *g, lexical_function lexical)
{
TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
+ TRACE("Glyphs (%i..%i..%i)\n",g->start,g->base,g->end);
if (s->start == s->base && s->base == s->end) return;
if (lexical(pwChar[s->base]) == lex_Vowel) return;
- Reorder_Ra_follows_matra(pwChar, s, lexical);
- Reorder_Matra_precede_base(pwChar, s, lexical);
+ SecondReorder_Blwf_follows_matra(pwChar, s, pwGlyphs, g, lexical);
}
-static void SecondReorder_Like_Telugu(LPWSTR pwChar, IndicSyllable *s, WORD* pwGlyphs, IndicSyllable *g, lexical_function lexical)
+static void SecondReorder_Like_Tamil(LPWSTR pwChar, IndicSyllable *s, WORD* pwGlyphs, IndicSyllable *g, lexical_function lexical)
{
TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
TRACE("Glyphs (%i..%i..%i)\n",g->start,g->base,g->end);
if (s->start == s->base && s->base == s->end) return;
if (lexical(pwChar[s->base]) == lex_Vowel) return;
- SecondReorder_Blwf_follows_matra(pwChar, s, pwGlyphs, g, lexical);
+ SecondReorder_Matra_precede_base(pwChar, s, pwGlyphs, g, lexical);
}
+
static inline void shift_syllable_glyph_indexs(IndicSyllable *glyph_index, INT index, INT shift)
{
if (shift == 0)
@@ -2659,13 +2683,13 @@ static void ContextualShape_Tamil(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *ps
TRACE("New composed string %s (%i)\n",debugstr_wn(input,cCount),cCount);
/* Step 2: Reorder within Syllables */
- Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, tamil_lex, Reorder_Like_Sinhala);
+ Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, tamil_lex, Reorder_Like_Bengali);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Base Form application to syllables */
- ShapeIndicSyllables(hdc, psc, psa, input, cCount, syllables, syllable_count, pwOutGlyphs, pcGlyphs, pwLogClust, tamil_lex, NULL);
+ ShapeIndicSyllables(hdc, psc, psa, input, cCount, syllables, syllable_count, pwOutGlyphs, pcGlyphs, pwLogClust, tamil_lex, SecondReorder_Like_Tamil);
HeapFree(GetProcessHeap(),0,input);
HeapFree(GetProcessHeap(),0,syllables);
@@ -2848,13 +2872,13 @@ static void ContextualShape_Malayalam(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS
TRACE("New composed string %s (%i)\n",debugstr_wn(input,cCount),cCount);
/* Step 2: Reorder within Syllables */
- Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, malayalam_lex, Reorder_Like_Malayalam);
+ Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, malayalam_lex, Reorder_Like_Devanagari);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Base Form application to syllables */
- ShapeIndicSyllables(hdc, psc, psa, input, cCount, syllables, syllable_count, pwOutGlyphs, pcGlyphs, pwLogClust, malayalam_lex, NULL);
+ ShapeIndicSyllables(hdc, psc, psa, input, cCount, syllables, syllable_count, pwOutGlyphs, pcGlyphs, pwLogClust, malayalam_lex, SecondReorder_Like_Tamil);
HeapFree(GetProcessHeap(),0,input);
HeapFree(GetProcessHeap(),0,syllables);
More information about the wine-cvs
mailing list