From d26bdd9121876c9d4aaf40ac022cbe57dc95420b Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Mon, 23 May 2011 11:41:57 -0500 Subject: [PATCH] usp10: Framework for determing glyph properties after shaping. --- dlls/usp10/shape.c | 66 +++++++++++++++++++++---------------- dlls/usp10/usp10.c | 1 + dlls/usp10/usp10_internal.h | 1 + include/usp10.h | 2 +- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c index 0afb7aa434c..8838050916a 100644 --- a/dlls/usp10/shape.c +++ b/dlls/usp10/shape.c @@ -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_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_forms[LAST_ARABIC_CHAR - FIRST_ARABIC_CHAR + 1][4]; @@ -332,39 +335,40 @@ static const char* required_lao_features[] = }; typedef struct ScriptShapeDataTag { - TEXTRANGE_PROPERTIES defaultTextRange; - const char** requiredFeatures; - CHAR otTag[5]; - ContextualShapingProc contextProc; + TEXTRANGE_PROPERTIES defaultTextRange; + const char** requiredFeatures; + CHAR otTag[5]; + ContextualShapingProc contextProc; + ShapeCharGlyphPropProc charGlyphPropProc; } ScriptShapeData; /* in order of scripts */ static const ScriptShapeData ShapingData[] = { - {{ standard_features, 2}, NULL, "", NULL}, - {{ standard_features, 2}, NULL, "latn", NULL}, - {{ standard_features, 2}, NULL, "latn", NULL}, - {{ standard_features, 2}, NULL, "latn", NULL}, - {{ standard_features, 2}, NULL, "" , NULL}, - {{ standard_features, 2}, NULL, "latn", NULL}, - {{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic}, - {{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic}, - {{ hebrew_features, 1}, NULL, "hebr", NULL}, - {{ syriac_features, 4}, required_syriac_features, "syrc", ContextualShape_Syriac}, - {{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic}, - {{ NULL, 0}, NULL, "thaa", NULL}, - {{ standard_features, 2}, NULL, "grek", NULL}, - {{ standard_features, 2}, NULL, "cyrl", NULL}, - {{ standard_features, 2}, NULL, "armn", NULL}, - {{ standard_features, 2}, NULL, "geor", NULL}, - {{ sinhala_features, 7}, NULL, "sinh", NULL}, - {{ tibetan_features, 2}, NULL, "tibt", NULL}, - {{ tibetan_features, 2}, NULL, "tibt", NULL}, - {{ tibetan_features, 2}, NULL, "phag", ContextualShape_Phags_pa}, - {{ thai_features, 1}, NULL, "thai", NULL}, - {{ thai_features, 1}, NULL, "thai", NULL}, - {{ thai_features, 1}, required_lao_features, "lao", NULL}, - {{ thai_features, 1}, required_lao_features, "lao", 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, "" , NULL, NULL}, + {{ standard_features, 2}, NULL, "latn", NULL, NULL}, + {{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic, NULL}, + {{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic, NULL}, + {{ hebrew_features, 1}, NULL, "hebr", NULL, NULL}, + {{ syriac_features, 4}, required_syriac_features, "syrc", ContextualShape_Syriac, NULL}, + {{ arabic_features, 6}, required_arabic_features, "arab", ContextualShape_Arabic, NULL}, + {{ NULL, 0}, NULL, "thaa", NULL, NULL}, + {{ standard_features, 2}, NULL, "grek", NULL, NULL}, + {{ standard_features, 2}, NULL, "cyrl", NULL, NULL}, + {{ standard_features, 2}, NULL, "armn", NULL, NULL}, + {{ standard_features, 2}, NULL, "geor", NULL, NULL}, + {{ sinhala_features, 7}, NULL, "sinh", NULL, NULL}, + {{ tibetan_features, 2}, NULL, "tibt", NULL, NULL}, + {{ tibetan_features, 2}, NULL, "tibt", NULL, NULL}, + {{ tibetan_features, 2}, NULL, "phag", ContextualShape_Phags_pa, NULL}, + {{ thai_features, 1}, NULL, "thai", NULL, NULL}, + {{ thai_features, 1}, NULL, "thai", NULL, NULL}, + {{ thai_features, 1}, required_lao_features, "lao", NULL, NULL}, + {{ thai_features, 1}, required_lao_features, "lao", NULL, NULL}, }; 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); } +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) { if (ShapingData[psa->eScript].contextProc) diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 97f73a75ad6..0ab9ab9a307 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -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_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); } diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h index a61e56ec5f0..f6df10a1dd9 100644 --- a/dlls/usp10/usp10_internal.h +++ b/dlls/usp10/usp10_internal.h @@ -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_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); +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); diff --git a/include/usp10.h b/include/usp10.h index 19401763ef1..e84eeb73823 100644 --- a/include/usp10.h +++ b/include/usp10.h @@ -86,7 +86,7 @@ typedef enum tag_SCRIPT_JUSTIFY { SCRIPT_JUSTIFY_ARABIC_BA = 12, SCRIPT_JUSTIFY_ARABIC_BARA = 13, SCRIPT_JUSTIFY_ARABIC_SEEN = 14, - SCRIPT_JUSTIFY_RESERVED4 = 15, + SCRIPT_JUSTIFY_ARABIC_SEEN_M = 15, } SCRIPT_JUSTIFY; typedef struct tag_SCRIPT_CONTROL {