usp10: Apply 'half' only to the pre-base consonants in Indic syllables.
This commit is contained in:
parent
e626019be8
commit
c1d4db0d78
|
@ -422,7 +422,6 @@ static OPENTYPE_FEATURE_RECORD devanagari_features[] =
|
|||
/* Base forms */
|
||||
{ MS_MAKE_TAG('r','p','h','f'), 1},
|
||||
{ MS_MAKE_TAG('b','l','w','f'), 1},
|
||||
{ MS_MAKE_TAG('h','a','l','f'), 1},
|
||||
{ MS_MAKE_TAG('v','a','t','u'), 1},
|
||||
{ MS_MAKE_TAG('c','j','c','t'), 1},
|
||||
/* Presentation forms */
|
||||
|
@ -457,7 +456,6 @@ static OPENTYPE_FEATURE_RECORD bengali_features[] =
|
|||
{ MS_MAKE_TAG('r','p','h','f'), 1},
|
||||
{ MS_MAKE_TAG('b','l','w','f'), 1},
|
||||
{ MS_MAKE_TAG('p','s','t','f'), 1},
|
||||
{ MS_MAKE_TAG('h','a','l','f'), 1},
|
||||
{ MS_MAKE_TAG('v','a','t','u'), 1},
|
||||
{ MS_MAKE_TAG('c','j','c','t'), 1},
|
||||
/* Presentation forms */
|
||||
|
@ -494,7 +492,6 @@ static OPENTYPE_FEATURE_RECORD gurmukhi_features[] =
|
|||
{ MS_MAKE_TAG('r','p','h','f'), 1},
|
||||
{ MS_MAKE_TAG('b','l','w','f'), 1},
|
||||
{ MS_MAKE_TAG('p','s','t','f'), 1},
|
||||
{ MS_MAKE_TAG('h','a','l','f'), 1},
|
||||
{ MS_MAKE_TAG('v','a','t','u'), 1},
|
||||
{ MS_MAKE_TAG('c','j','c','t'), 1},
|
||||
/* Presentation forms */
|
||||
|
@ -560,7 +557,6 @@ static OPENTYPE_FEATURE_RECORD tamil_features[] =
|
|||
/* Base forms */
|
||||
{ MS_MAKE_TAG('r','p','h','f'), 1},
|
||||
{ MS_MAKE_TAG('p','r','e','f'), 1},
|
||||
{ MS_MAKE_TAG('h','a','l','f'), 1},
|
||||
/* Presentation forms */
|
||||
{ MS_MAKE_TAG('p','r','e','s'), 1},
|
||||
{ MS_MAKE_TAG('a','b','v','s'), 1},
|
||||
|
@ -595,7 +591,6 @@ static OPENTYPE_FEATURE_RECORD telugu_features[] =
|
|||
{ MS_MAKE_TAG('p','r','e','f'), 1},
|
||||
{ MS_MAKE_TAG('b','l','w','f'), 1},
|
||||
{ MS_MAKE_TAG('p','s','t','f'), 1},
|
||||
{ MS_MAKE_TAG('h','a','l','f'), 1},
|
||||
{ MS_MAKE_TAG('c','j','c','t'), 1},
|
||||
/* Presentation forms */
|
||||
{ MS_MAKE_TAG('p','r','e','s'), 1},
|
||||
|
@ -642,25 +637,25 @@ static const ScriptShapeData ShapingData[] =
|
|||
{{ thai_features, 1}, NULL, "thai", "", NULL, ShapeCharGlyphProp_Thai},
|
||||
{{ thai_features, 1}, required_lao_features, "lao", "", NULL, ShapeCharGlyphProp_Thai},
|
||||
{{ thai_features, 1}, required_lao_features, "lao", "", NULL, ShapeCharGlyphProp_Thai},
|
||||
{{ devanagari_features, 11}, required_devanagari_features, "deva", "dev2", ContextualShape_Devanagari, ShapeCharGlyphProp_Devanagari},
|
||||
{{ devanagari_features, 11}, required_devanagari_features, "deva", "dev2", ContextualShape_Devanagari, ShapeCharGlyphProp_Devanagari},
|
||||
{{ bengali_features, 12}, required_bengali_features, "beng", "bng2", ContextualShape_Bengali, ShapeCharGlyphProp_Bengali},
|
||||
{{ bengali_features, 12}, required_bengali_features, "beng", "bng2", ContextualShape_Bengali, ShapeCharGlyphProp_Bengali},
|
||||
{{ gurmukhi_features, 12}, required_gurmukhi_features, "guru", "gur2", ContextualShape_Gurmukhi, ShapeCharGlyphProp_Gurmukhi},
|
||||
{{ gurmukhi_features, 12}, required_gurmukhi_features, "guru", "gur2", ContextualShape_Gurmukhi, ShapeCharGlyphProp_Gurmukhi},
|
||||
{{ devanagari_features, 11}, required_devanagari_features, "gujr", "gjr2", ContextualShape_Gujarati, ShapeCharGlyphProp_Gujarati},
|
||||
{{ devanagari_features, 11}, required_devanagari_features, "gujr", "gjr2", ContextualShape_Gujarati, ShapeCharGlyphProp_Gujarati},
|
||||
{{ devanagari_features, 11}, required_devanagari_features, "gujr", "gjr2", ContextualShape_Gujarati, ShapeCharGlyphProp_Gujarati},
|
||||
{{ devanagari_features, 10}, required_devanagari_features, "deva", "dev2", ContextualShape_Devanagari, ShapeCharGlyphProp_Devanagari},
|
||||
{{ devanagari_features, 10}, required_devanagari_features, "deva", "dev2", ContextualShape_Devanagari, ShapeCharGlyphProp_Devanagari},
|
||||
{{ bengali_features, 11}, required_bengali_features, "beng", "bng2", ContextualShape_Bengali, ShapeCharGlyphProp_Bengali},
|
||||
{{ bengali_features, 11}, required_bengali_features, "beng", "bng2", ContextualShape_Bengali, ShapeCharGlyphProp_Bengali},
|
||||
{{ gurmukhi_features, 11}, required_gurmukhi_features, "guru", "gur2", ContextualShape_Gurmukhi, ShapeCharGlyphProp_Gurmukhi},
|
||||
{{ gurmukhi_features, 11}, required_gurmukhi_features, "guru", "gur2", ContextualShape_Gurmukhi, ShapeCharGlyphProp_Gurmukhi},
|
||||
{{ devanagari_features, 10}, required_devanagari_features, "gujr", "gjr2", ContextualShape_Gujarati, ShapeCharGlyphProp_Gujarati},
|
||||
{{ devanagari_features, 10}, required_devanagari_features, "gujr", "gjr2", ContextualShape_Gujarati, ShapeCharGlyphProp_Gujarati},
|
||||
{{ devanagari_features, 10}, required_devanagari_features, "gujr", "gjr2", ContextualShape_Gujarati, ShapeCharGlyphProp_Gujarati},
|
||||
{{ oriya_features, 10}, required_oriya_features, "orya", "ory2", ContextualShape_Oriya, ShapeCharGlyphProp_Oriya},
|
||||
{{ oriya_features, 10}, required_oriya_features, "orya", "ory2", ContextualShape_Oriya, ShapeCharGlyphProp_Oriya},
|
||||
{{ tamil_features, 9}, required_tamil_features, "taml", "tam2", ContextualShape_Tamil, ShapeCharGlyphProp_Tamil},
|
||||
{{ tamil_features, 9}, required_tamil_features, "taml", "tam2", ContextualShape_Tamil, ShapeCharGlyphProp_Tamil},
|
||||
{{ telugu_features, 12}, required_telugu_features, "telu", "tel2", ContextualShape_Telugu, ShapeCharGlyphProp_Telugu},
|
||||
{{ telugu_features, 12}, required_telugu_features, "telu", "tel2", ContextualShape_Telugu, ShapeCharGlyphProp_Telugu},
|
||||
{{ telugu_features, 12}, required_telugu_features, "knda", "knd2", ContextualShape_Kannada, ShapeCharGlyphProp_Kannada},
|
||||
{{ telugu_features, 12}, required_telugu_features, "knda", "knd2", ContextualShape_Kannada, ShapeCharGlyphProp_Kannada},
|
||||
{{ telugu_features, 12}, required_telugu_features, "mlym", "mlm2", ContextualShape_Malayalam, ShapeCharGlyphProp_Malayalam},
|
||||
{{ telugu_features, 12}, required_telugu_features, "mlym", "mlm2", ContextualShape_Malayalam, ShapeCharGlyphProp_Malayalam},
|
||||
{{ tamil_features, 8}, required_tamil_features, "taml", "tam2", ContextualShape_Tamil, ShapeCharGlyphProp_Tamil},
|
||||
{{ tamil_features, 8}, required_tamil_features, "taml", "tam2", ContextualShape_Tamil, ShapeCharGlyphProp_Tamil},
|
||||
{{ telugu_features, 11}, required_telugu_features, "telu", "tel2", ContextualShape_Telugu, ShapeCharGlyphProp_Telugu},
|
||||
{{ telugu_features, 11}, required_telugu_features, "telu", "tel2", ContextualShape_Telugu, ShapeCharGlyphProp_Telugu},
|
||||
{{ telugu_features, 11}, required_telugu_features, "knda", "knd2", ContextualShape_Kannada, ShapeCharGlyphProp_Kannada},
|
||||
{{ telugu_features, 11}, required_telugu_features, "knda", "knd2", ContextualShape_Kannada, ShapeCharGlyphProp_Kannada},
|
||||
{{ telugu_features, 11}, required_telugu_features, "mlym", "mlm2", ContextualShape_Malayalam, ShapeCharGlyphProp_Malayalam},
|
||||
{{ telugu_features, 11}, required_telugu_features, "mlym", "mlm2", ContextualShape_Malayalam, ShapeCharGlyphProp_Malayalam},
|
||||
};
|
||||
|
||||
static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph)
|
||||
|
@ -2030,6 +2025,42 @@ static void Apply_Indic_BasicForm(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *ps
|
|||
}
|
||||
}
|
||||
|
||||
static inline INT find_consonant_halant(WCHAR* pwChars, INT index, INT end, lexical_function lexical)
|
||||
{
|
||||
int i = 0;
|
||||
while (i + index < end - 1 && !(lexical(pwChars[index+i]) == lex_Consonant && (lexical(pwChars[index+i+1]) == lex_Halant || (index + i < end - 2 && lexical(pwChars[index+i+1]) == lex_Nukta && lexical(pwChars[index+i+2] == lex_Halant)))))
|
||||
i++;
|
||||
if (index + i <= end-1)
|
||||
return index + i;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void Apply_Indic_Half(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)
|
||||
{
|
||||
INT index, nextIndex;
|
||||
INT count,g_offset;
|
||||
INT prevCount = *pcGlyphs;
|
||||
|
||||
count = syllable->base - syllable->start;
|
||||
|
||||
g_offset = 0;
|
||||
index = find_consonant_halant(&pwChars[syllable->start], 0, count, lexical);
|
||||
while (index >= 0 && index < (glyph_index->base - glyph_index->start))
|
||||
{
|
||||
nextIndex = apply_GSUB_feature_to_glyph(hdc, psa, psc, pwOutGlyphs, index+glyph_index->start+g_offset, 1, pcGlyphs, "half");
|
||||
if (nextIndex > GSUB_E_NOGLYPH)
|
||||
{
|
||||
UpdateClusters(nextIndex, *pcGlyphs - prevCount, 1, cChars, pwLogClust);
|
||||
g_offset += (*pcGlyphs - prevCount);
|
||||
shift_syllable_glyph_indexs(glyph_index, index + glyph_index->start, g_offset);
|
||||
}
|
||||
|
||||
index+=2;
|
||||
index = find_consonant_halant(&pwChars[syllable->start], index, count, lexical);
|
||||
}
|
||||
}
|
||||
|
||||
static void ShapeIndicSyllables(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwChars, INT cChars, IndicSyllable *syllables, INT syllable_count, WORD *pwOutGlyphs, INT* pcGlyphs, WORD *pwLogClust, lexical_function lexical)
|
||||
{
|
||||
int c;
|
||||
|
@ -2038,6 +2069,7 @@ static void ShapeIndicSyllables(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa,
|
|||
const GSUB_Feature *nukt = load_GSUB_feature(hdc, psa, psc, "nukt");
|
||||
const GSUB_Feature *akhn = load_GSUB_feature(hdc, psa, psc, "akhn");
|
||||
const GSUB_Feature *rkrf = load_GSUB_feature(hdc, psa, psc, "rkrf");
|
||||
BOOL half = (load_GSUB_feature(hdc, psa, psc, "half") != NULL);
|
||||
IndicSyllable glyph_indexs;
|
||||
|
||||
for (c = 0; c < syllable_count; c++)
|
||||
|
@ -2067,6 +2099,8 @@ static void ShapeIndicSyllables(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa,
|
|||
TRACE("applying feature rkrf\n");
|
||||
Apply_Indic_BasicForm(hdc, psc, psa, pwChars, cChars, &syllables[c], pwOutGlyphs, pcGlyphs, pwLogClust, lexical, &glyph_indexs, rkrf);
|
||||
}
|
||||
if (half)
|
||||
Apply_Indic_Half(hdc, psc, psa, pwChars, cChars, &syllables[c], pwOutGlyphs, pcGlyphs, pwLogClust, lexical, &glyph_indexs);
|
||||
|
||||
overall_shift += glyph_indexs.end - old_end;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue