usp10: Handle new OpenType tags for Microsoft Indic fonts.
This commit is contained in:
parent
c5f41f89f3
commit
2bd19a89ff
|
@ -376,6 +376,7 @@ typedef struct ScriptShapeDataTag {
|
||||||
TEXTRANGE_PROPERTIES defaultTextRange;
|
TEXTRANGE_PROPERTIES defaultTextRange;
|
||||||
const char** requiredFeatures;
|
const char** requiredFeatures;
|
||||||
CHAR otTag[5];
|
CHAR otTag[5];
|
||||||
|
CHAR newOtTag[5];
|
||||||
ContextualShapingProc contextProc;
|
ContextualShapingProc contextProc;
|
||||||
ShapeCharGlyphPropProc charGlyphPropProc;
|
ShapeCharGlyphPropProc charGlyphPropProc;
|
||||||
} ScriptShapeData;
|
} ScriptShapeData;
|
||||||
|
@ -383,30 +384,30 @@ typedef struct ScriptShapeDataTag {
|
||||||
/* in order of scripts */
|
/* in order of scripts */
|
||||||
static const ScriptShapeData ShapingData[] =
|
static const ScriptShapeData ShapingData[] =
|
||||||
{
|
{
|
||||||
{{ standard_features, 2}, NULL, "", NULL, NULL},
|
{{ standard_features, 2}, NULL, "", "", NULL, NULL},
|
||||||
{{ standard_features, 2}, NULL, "latn", NULL, NULL},
|
{{ standard_features, 2}, NULL, "latn", "", NULL, NULL},
|
||||||
{{ standard_features, 2}, NULL, "latn", NULL, NULL},
|
{{ standard_features, 2}, NULL, "latn", "", NULL, NULL},
|
||||||
{{ standard_features, 2}, NULL, "latn", NULL, NULL},
|
{{ standard_features, 2}, NULL, "latn", "", NULL, NULL},
|
||||||
{{ standard_features, 2}, NULL, "" , NULL, NULL},
|
{{ standard_features, 2}, NULL, "" , "", NULL, NULL},
|
||||||
{{ standard_features, 2}, NULL, "latn", NULL, NULL},
|
{{ standard_features, 2}, NULL, "latn", "", NULL, NULL},
|
||||||
{{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic, ShapeCharGlyphProp_Arabic},
|
{{ arabic_features, 6}, required_arabic_features, "arab", "", ContextualShape_Arabic, ShapeCharGlyphProp_Arabic},
|
||||||
{{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic, ShapeCharGlyphProp_Arabic},
|
{{ arabic_features, 6}, required_arabic_features, "arab", "", ContextualShape_Arabic, ShapeCharGlyphProp_Arabic},
|
||||||
{{ hebrew_features, 1}, NULL, "hebr", NULL, NULL},
|
{{ hebrew_features, 1}, NULL, "hebr", "", NULL, NULL},
|
||||||
{{ syriac_features, 4}, required_syriac_features, "syrc", ContextualShape_Syriac, ShapeCharGlyphProp_None},
|
{{ syriac_features, 4}, required_syriac_features, "syrc", "", ContextualShape_Syriac, ShapeCharGlyphProp_None},
|
||||||
{{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic, ShapeCharGlyphProp_Arabic},
|
{{ arabic_features, 6}, required_arabic_features, "arab", "", ContextualShape_Arabic, ShapeCharGlyphProp_Arabic},
|
||||||
{{ NULL, 0}, NULL, "thaa", NULL, ShapeCharGlyphProp_None},
|
{{ NULL, 0}, NULL, "thaa", "", NULL, ShapeCharGlyphProp_None},
|
||||||
{{ standard_features, 2}, NULL, "grek", NULL, NULL},
|
{{ standard_features, 2}, NULL, "grek", "", NULL, NULL},
|
||||||
{{ standard_features, 2}, NULL, "cyrl", NULL, NULL},
|
{{ standard_features, 2}, NULL, "cyrl", "", NULL, NULL},
|
||||||
{{ standard_features, 2}, NULL, "armn", NULL, NULL},
|
{{ standard_features, 2}, NULL, "armn", "", NULL, NULL},
|
||||||
{{ standard_features, 2}, NULL, "geor", NULL, NULL},
|
{{ standard_features, 2}, NULL, "geor", "", NULL, NULL},
|
||||||
{{ sinhala_features, 7}, NULL, "sinh", NULL, NULL},
|
{{ sinhala_features, 7}, NULL, "sinh", "", NULL, NULL},
|
||||||
{{ tibetan_features, 2}, NULL, "tibt", NULL, ShapeCharGlyphProp_Tibet},
|
{{ tibetan_features, 2}, NULL, "tibt", "", NULL, ShapeCharGlyphProp_Tibet},
|
||||||
{{ tibetan_features, 2}, NULL, "tibt", NULL, ShapeCharGlyphProp_Tibet},
|
{{ tibetan_features, 2}, NULL, "tibt", "", NULL, ShapeCharGlyphProp_Tibet},
|
||||||
{{ tibetan_features, 2}, NULL, "phag", ContextualShape_Phags_pa, ShapeCharGlyphProp_Thai},
|
{{ tibetan_features, 2}, NULL, "phag", "", ContextualShape_Phags_pa, ShapeCharGlyphProp_Thai},
|
||||||
{{ thai_features, 1}, NULL, "thai", NULL, ShapeCharGlyphProp_Thai},
|
{{ thai_features, 1}, NULL, "thai", "", NULL, ShapeCharGlyphProp_Thai},
|
||||||
{{ thai_features, 1}, NULL, "thai", NULL, ShapeCharGlyphProp_Thai},
|
{{ 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},
|
||||||
{{ thai_features, 1}, required_lao_features, "lao", NULL, ShapeCharGlyphProp_Thai},
|
{{ thai_features, 1}, required_lao_features, "lao", "", NULL, ShapeCharGlyphProp_Thai},
|
||||||
};
|
};
|
||||||
|
|
||||||
static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph)
|
static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph)
|
||||||
|
@ -816,12 +817,20 @@ static INT GSUB_apply_feature(const GSUB_Header * header, const GSUB_Feature* fe
|
||||||
return out_index;
|
return out_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* get_opentype_script(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc)
|
static const char* get_opentype_script(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, BOOL tryNew)
|
||||||
{
|
{
|
||||||
UINT charset;
|
UINT charset;
|
||||||
|
|
||||||
if (psc->userScript != 0)
|
if (psc->userScript != 0)
|
||||||
|
{
|
||||||
|
if (tryNew && ShapingData[psa->eScript].newOtTag[0] != 0 && strncmp((char*)&psc->userScript,ShapingData[psa->eScript].otTag,4)==0)
|
||||||
|
return ShapingData[psa->eScript].newOtTag;
|
||||||
|
else
|
||||||
return (char*)&psc->userScript;
|
return (char*)&psc->userScript;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tryNew && ShapingData[psa->eScript].newOtTag[0] != 0)
|
||||||
|
return ShapingData[psa->eScript].newOtTag;
|
||||||
|
|
||||||
if (ShapingData[psa->eScript].otTag[0] != 0)
|
if (ShapingData[psa->eScript].otTag[0] != 0)
|
||||||
return ShapingData[psa->eScript].otTag;
|
return ShapingData[psa->eScript].otTag;
|
||||||
|
@ -866,8 +875,12 @@ static LPCVOID load_GSUB_feature(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc
|
||||||
{
|
{
|
||||||
const GSUB_Script *script;
|
const GSUB_Script *script;
|
||||||
const GSUB_LangSys *language;
|
const GSUB_LangSys *language;
|
||||||
|
int attempt = 2;
|
||||||
|
|
||||||
script = GSUB_get_script_table(psc->GSUB_Table, get_opentype_script(hdc,psa,psc));
|
do
|
||||||
|
{
|
||||||
|
script = GSUB_get_script_table(psc->GSUB_Table, get_opentype_script(hdc,psa,psc,(attempt==2)));
|
||||||
|
attempt--;
|
||||||
if (script)
|
if (script)
|
||||||
{
|
{
|
||||||
if (psc->userLang != 0)
|
if (psc->userLang != 0)
|
||||||
|
@ -877,6 +890,7 @@ static LPCVOID load_GSUB_feature(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc
|
||||||
if (language)
|
if (language)
|
||||||
feature = GSUB_get_feature(psc->GSUB_Table, language, feat);
|
feature = GSUB_get_feature(psc->GSUB_Table, language, feat);
|
||||||
}
|
}
|
||||||
|
} while(attempt && !feature);
|
||||||
|
|
||||||
/* try in the default (latin) table */
|
/* try in the default (latin) table */
|
||||||
if (!feature)
|
if (!feature)
|
||||||
|
|
Loading…
Reference in New Issue