usp10: Framework for determing glyph properties after shaping.

This commit is contained in:
Aric Stewart 2011-05-23 11:41:57 -05:00 committed by Alexandre Julliard
parent 7c8ce6c6e4
commit d26bdd9121
4 changed files with 41 additions and 29 deletions

View File

@ -44,6 +44,9 @@ static void ContextualShape_Arabic(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *p
static void ContextualShape_Syriac(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust); static void ContextualShape_Syriac(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
static void ContextualShape_Phags_pa(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust); static void ContextualShape_Phags_pa(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
typedef VOID (*ShapeCharGlyphPropProc)( HDC , ScriptCache*, SCRIPT_ANALYSIS*, const WCHAR*, const INT, const WORD*, const INT, WORD*, SCRIPT_CHARPROP*, SCRIPT_GLYPHPROP*);
extern const unsigned short wine_shaping_table[]; extern const unsigned short wine_shaping_table[];
extern const unsigned short wine_shaping_forms[LAST_ARABIC_CHAR - FIRST_ARABIC_CHAR + 1][4]; extern const unsigned short wine_shaping_forms[LAST_ARABIC_CHAR - FIRST_ARABIC_CHAR + 1][4];
@ -332,39 +335,40 @@ static const char* required_lao_features[] =
}; };
typedef struct ScriptShapeDataTag { typedef struct ScriptShapeDataTag {
TEXTRANGE_PROPERTIES defaultTextRange; TEXTRANGE_PROPERTIES defaultTextRange;
const char** requiredFeatures; const char** requiredFeatures;
CHAR otTag[5]; CHAR otTag[5];
ContextualShapingProc contextProc; ContextualShapingProc contextProc;
ShapeCharGlyphPropProc charGlyphPropProc;
} ScriptShapeData; } ScriptShapeData;
/* in order of scripts */ /* in order of scripts */
static const ScriptShapeData ShapingData[] = static const ScriptShapeData ShapingData[] =
{ {
{{ standard_features, 2}, NULL, "", NULL}, {{ standard_features, 2}, NULL, "", NULL, NULL},
{{ standard_features, 2}, NULL, "latn", NULL}, {{ standard_features, 2}, NULL, "latn", NULL, NULL},
{{ standard_features, 2}, NULL, "latn", NULL}, {{ standard_features, 2}, NULL, "latn", NULL, NULL},
{{ standard_features, 2}, NULL, "latn", NULL}, {{ standard_features, 2}, NULL, "latn", NULL, NULL},
{{ standard_features, 2}, NULL, "" , NULL}, {{ standard_features, 2}, NULL, "" , NULL, NULL},
{{ standard_features, 2}, NULL, "latn", NULL}, {{ standard_features, 2}, NULL, "latn", NULL, NULL},
{{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic}, {{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic, NULL},
{{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic}, {{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic, NULL},
{{ hebrew_features, 1}, NULL, "hebr", NULL}, {{ hebrew_features, 1}, NULL, "hebr", NULL, NULL},
{{ syriac_features, 4}, required_syriac_features, "syrc", ContextualShape_Syriac}, {{ syriac_features, 4}, required_syriac_features, "syrc", ContextualShape_Syriac, NULL},
{{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic}, {{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic, NULL},
{{ NULL, 0}, NULL, "thaa", NULL}, {{ NULL, 0}, NULL, "thaa", NULL, NULL},
{{ standard_features, 2}, NULL, "grek", NULL}, {{ standard_features, 2}, NULL, "grek", NULL, NULL},
{{ standard_features, 2}, NULL, "cyrl", NULL}, {{ standard_features, 2}, NULL, "cyrl", NULL, NULL},
{{ standard_features, 2}, NULL, "armn", NULL}, {{ standard_features, 2}, NULL, "armn", NULL, NULL},
{{ standard_features, 2}, NULL, "geor", NULL}, {{ standard_features, 2}, NULL, "geor", NULL, NULL},
{{ sinhala_features, 7}, NULL, "sinh", NULL}, {{ sinhala_features, 7}, NULL, "sinh", NULL, NULL},
{{ tibetan_features, 2}, NULL, "tibt", NULL}, {{ tibetan_features, 2}, NULL, "tibt", NULL, NULL},
{{ tibetan_features, 2}, NULL, "tibt", NULL}, {{ tibetan_features, 2}, NULL, "tibt", NULL, NULL},
{{ tibetan_features, 2}, NULL, "phag", ContextualShape_Phags_pa}, {{ tibetan_features, 2}, NULL, "phag", ContextualShape_Phags_pa, NULL},
{{ thai_features, 1}, NULL, "thai", NULL}, {{ thai_features, 1}, NULL, "thai", NULL, NULL},
{{ thai_features, 1}, NULL, "thai", NULL}, {{ thai_features, 1}, NULL, "thai", NULL, NULL},
{{ thai_features, 1}, required_lao_features, "lao", NULL}, {{ thai_features, 1}, required_lao_features, "lao", NULL, NULL},
{{ thai_features, 1}, required_lao_features, "lao", NULL}, {{ thai_features, 1}, required_lao_features, "lao", NULL, NULL},
}; };
static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph) static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph)
@ -1313,6 +1317,12 @@ static void ContextualShape_Phags_pa(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS
HeapFree(GetProcessHeap(),0,context_shape); HeapFree(GetProcessHeap(),0,context_shape);
} }
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)
{
if (ShapingData[psa->eScript].charGlyphPropProc)
ShapingData[psa->eScript].charGlyphPropProc(hdc, psc, psa, pwcChars, cChars, pwGlyphs, cGlyphs, pwLogClust, pCharProp, pGlyphProp);
}
void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust) void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust)
{ {
if (ShapingData[psa->eScript].contextProc) if (ShapingData[psa->eScript].contextProc)

View File

@ -1589,6 +1589,7 @@ HRESULT WINAPI ScriptShapeOpenType( HDC hdc, SCRIPT_CACHE *psc,
{ {
SHAPE_ContextualShaping(hdc, (ScriptCache *)*psc, psa, rChars, cChars, pwOutGlyphs, pcGlyphs, cMaxGlyphs, pwLogClust); SHAPE_ContextualShaping(hdc, (ScriptCache *)*psc, psa, rChars, cChars, pwOutGlyphs, pcGlyphs, cMaxGlyphs, pwLogClust);
SHAPE_ApplyDefaultOpentypeFeatures(hdc, (ScriptCache *)*psc, psa, pwOutGlyphs, pcGlyphs, cMaxGlyphs, cChars, pwLogClust); SHAPE_ApplyDefaultOpentypeFeatures(hdc, (ScriptCache *)*psc, psa, pwOutGlyphs, pcGlyphs, cMaxGlyphs, cChars, pwLogClust);
SHAPE_CharGlyphProp(hdc, (ScriptCache *)*psc, psa, pwcChars, cChars, pwOutGlyphs, *pcGlyphs, pwLogClust, pCharProps, pOutGlyphProps);
} }
heap_free(rChars); heap_free(rChars);
} }

View File

@ -85,3 +85,4 @@ INT BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE* plevel, int cch, B
void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust); void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
void SHAPE_ApplyDefaultOpentypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, INT cChars, WORD *pwLogClust); void SHAPE_ApplyDefaultOpentypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, INT cChars, WORD *pwLogClust);
HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa); HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa);
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);

View File

@ -86,7 +86,7 @@ typedef enum tag_SCRIPT_JUSTIFY {
SCRIPT_JUSTIFY_ARABIC_BA = 12, SCRIPT_JUSTIFY_ARABIC_BA = 12,
SCRIPT_JUSTIFY_ARABIC_BARA = 13, SCRIPT_JUSTIFY_ARABIC_BARA = 13,
SCRIPT_JUSTIFY_ARABIC_SEEN = 14, SCRIPT_JUSTIFY_ARABIC_SEEN = 14,
SCRIPT_JUSTIFY_RESERVED4 = 15, SCRIPT_JUSTIFY_ARABIC_SEEN_M = 15,
} SCRIPT_JUSTIFY; } SCRIPT_JUSTIFY;
typedef struct tag_SCRIPT_CONTROL { typedef struct tag_SCRIPT_CONTROL {