Commit 35948c6f authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

usp10: Return the set of Indic syllables after reorder.

parent b1ec7c9d
......@@ -212,12 +212,14 @@ static INT Indic_process_next_syllable( LPCWSTR input, INT cChar, INT start, INT
return parse_consonant_syllable(input, cChar, start, main, next, lex);
}
void Indic_ReorderCharacters( LPWSTR input, int cChar, lexical_function lex, reorder_function reorder_f)
void Indic_ReorderCharacters( LPWSTR input, int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, reorder_function reorder_f)
{
int index = 0;
int next = 0;
int center = 0;
*syllable_count = 0;
if (!lex || ! reorder_f)
{
ERR("Failure to have required functions\n");
......@@ -233,8 +235,16 @@ void Indic_ReorderCharacters( LPWSTR input, int cChar, lexical_function lex, reo
next = Indic_process_next_syllable(input, cChar, 0, &center, index, lex);
if (next != -1)
{
reorder_f(input, index, center, next-1, lex);
if (*syllable_count)
*syllables = HeapReAlloc(GetProcessHeap(),0,*syllables, sizeof(IndicSyllable)*(*syllable_count+1));
else
*syllables = HeapAlloc(GetProcessHeap(),0,sizeof(IndicSyllable));
(*syllables)[*syllable_count].start = index;
(*syllables)[*syllable_count].base = center;
(*syllables)[*syllable_count].end = next-1;
reorder_f(input, &(*syllables)[*syllable_count], lex);
index = next;
*syllable_count = (*syllable_count)+1;
}
else if (index < cChar)
{
......@@ -250,21 +260,21 @@ void Indic_ReorderCharacters( LPWSTR input, int cChar, lexical_function lex, reo
}
}
}
TRACE("Processed %i of %i characters\n",index,cChar);
TRACE("Processed %i of %i characters into %i syllables\n",index,cChar,*syllable_count);
}
int Indic_FindBaseConsonant(LPWSTR input, INT start, INT main, INT end, lexical_function lex)
int Indic_FindBaseConsonant(LPWSTR input, IndicSyllable *s, lexical_function lex)
{
int i;
/* try to find a base consonant */
if (!is_consonant( lex(input[main]) ))
if (!is_consonant( lex(input[s->base]) ))
{
for (i = end; i >= start; i--)
for (i = s->end; i >= s->start; i--)
if (is_consonant( lex(input[i]) ))
{
main = i;
s->base = i;
break;
}
}
return main;
return s->base;
}
......@@ -96,10 +96,16 @@ typedef struct {
OPENTYPE_TAG userLang;
} ScriptCache;
typedef struct {
INT start;
INT base;
INT end;
} IndicSyllable;
enum {lex_Halant, lex_Composed_Vowel, lex_Matra_post, lex_Matra_pre, lex_Matra_above, lex_Matra_below, lex_ZWJ, lex_ZWNJ, lex_NBSP, lex_Modifier, lex_Vowel, lex_Consonant, lex_Generic, lex_Ra, lex_Vedic, lex_Anudatta, lex_Nukta};
typedef int (*lexical_function)(WCHAR c);
typedef void (*reorder_function)(LPWSTR pwChar, INT start, INT main, INT end, lexical_function lex);
typedef void (*reorder_function)(LPWSTR pwChar, IndicSyllable *syllable, lexical_function lex);
#define odd(x) ((x) & 1)
......@@ -114,5 +120,5 @@ void SHAPE_ApplyDefaultOpentypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYS
HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa) DECLSPEC_HIDDEN;
void SHAPE_CharGlyphProp(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp) DECLSPEC_HIDDEN;
void Indic_ReorderCharacters( LPWSTR input, int cChars, lexical_function lexical_f, reorder_function reorder_f) DECLSPEC_HIDDEN;
int Indic_FindBaseConsonant(LPWSTR pwChar, INT start, INT main, INT end, lexical_function lex) DECLSPEC_HIDDEN;
void Indic_ReorderCharacters( LPWSTR input, int cChars, IndicSyllable **syllables, int *syllable_count, lexical_function lexical_f, reorder_function reorder_f) DECLSPEC_HIDDEN;
int Indic_FindBaseConsonant(LPWSTR pwChar, IndicSyllable *syllable, lexical_function lex) DECLSPEC_HIDDEN;
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