Commit 0401f6c0 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

usp10: Add contextual shaping proc to the script shaping data.

parent 2fb344c1
...@@ -37,6 +37,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(uniscribe); ...@@ -37,6 +37,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);
#define FIRST_ARABIC_CHAR 0x0600 #define FIRST_ARABIC_CHAR 0x0600
#define LAST_ARABIC_CHAR 0x06ff #define LAST_ARABIC_CHAR 0x06ff
typedef VOID (*ContextualShapingProc)(HDC, ScriptCache*, SCRIPT_ANALYSIS*,
WCHAR*, INT, WORD*, INT*, INT);
static void ContextualShape_Arabic(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs);
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];
...@@ -274,22 +279,23 @@ static OPENTYPE_FEATURE_RECORD syriac_features[] = ...@@ -274,22 +279,23 @@ static OPENTYPE_FEATURE_RECORD syriac_features[] =
typedef struct ScriptShapeDataTag { typedef struct ScriptShapeDataTag {
TEXTRANGE_PROPERTIES defaultTextRange; TEXTRANGE_PROPERTIES defaultTextRange;
CHAR otTag[5]; CHAR otTag[5];
ContextualShapingProc contextProc;
} ScriptShapeData; } ScriptShapeData;
/* in order of scripts */ /* in order of scripts */
static const ScriptShapeData ShapingData[] = static const ScriptShapeData ShapingData[] =
{ {
{{ standard_features, 2}, ""}, {{ standard_features, 2}, "", NULL},
{{ standard_features, 2}, "latn"}, {{ standard_features, 2}, "latn", NULL},
{{ standard_features, 2}, "latn"}, {{ standard_features, 2}, "latn", NULL},
{{ standard_features, 2}, "latn"}, {{ standard_features, 2}, "latn", NULL},
{{ standard_features, 2}, ""}, {{ standard_features, 2}, "" , NULL},
{{ standard_features, 2}, "latn"}, {{ standard_features, 2}, "latn", NULL},
{{ arabic_features, 6}, "arab"}, {{ arabic_features, 6}, "arab", ContextualShape_Arabic},
{{ arabic_features, 6}, "arab"}, {{ arabic_features, 6}, "arab", ContextualShape_Arabic},
{{ hebrew_features, 1}, "hebr"}, {{ hebrew_features, 1}, "hebr", NULL},
{{ syriac_features, 4}, "syrc"}, {{ syriac_features, 4}, "syrc", NULL},
{{ arabic_features, 6}, "arab"}, {{ arabic_features, 6}, "arab", ContextualShape_Arabic},
}; };
static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph) static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph)
...@@ -858,27 +864,22 @@ static inline BOOL left_join_causing(CHAR joining_type) ...@@ -858,27 +864,22 @@ static inline BOOL left_join_causing(CHAR joining_type)
return (joining_type == jtR || joining_type == jtD || joining_type == jtC); return (joining_type == jtR || joining_type == jtD || joining_type == jtC);
} }
/* SHAPE_ShapeArabicGlyphs /*
* ContextualShape_Arabic
*/ */
void SHAPE_ShapeArabicGlyphs(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs) static void ContextualShape_Arabic(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs)
{ {
CHAR *context_type; CHAR *context_type;
INT *context_shape; INT *context_shape;
INT dirR, dirL; INT dirR, dirL;
int i; int i;
if (psa->eScript != Script_Arabic &&
psa->eScript != Script_Persian &&
psa->eScript != Script_Arabic_Numeric)
return;
if (*pcGlyphs != cChars) if (*pcGlyphs != cChars)
{ {
ERR("Number of Glyphs and Chars need to match at the beginning\n"); ERR("Number of Glyphs and Chars need to match at the beginning\n");
return; return;
} }
if (!psa->fLogicalOrder && psa->fRTL) if (!psa->fLogicalOrder && psa->fRTL)
{ {
dirR = 1; dirR = 1;
...@@ -948,6 +949,12 @@ void SHAPE_ShapeArabicGlyphs(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WC ...@@ -948,6 +949,12 @@ void SHAPE_ShapeArabicGlyphs(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WC
HeapFree(GetProcessHeap(),0,context_type); HeapFree(GetProcessHeap(),0,context_type);
} }
void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs)
{
if (ShapingData[psa->eScript].contextProc)
ShapingData[psa->eScript].contextProc(hdc, psc, psa, pwcChars, cChars, pwOutGlyphs, pcGlyphs, cMaxGlyphs);
}
void SHAPE_ApplyOpenTypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, const TEXTRANGE_PROPERTIES *rpRangeProperties) void SHAPE_ApplyOpenTypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, const TEXTRANGE_PROPERTIES *rpRangeProperties)
{ {
int i; int i;
......
...@@ -1198,7 +1198,7 @@ HRESULT WINAPI ScriptShape(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars, ...@@ -1198,7 +1198,7 @@ HRESULT WINAPI ScriptShape(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars,
} }
rChars[i] = chInput; rChars[i] = chInput;
} }
SHAPE_ShapeArabicGlyphs(hdc, (ScriptCache *)*psc, psa, rChars, cChars, pwOutGlyphs, pcGlyphs, cMaxGlyphs); SHAPE_ContextualShaping(hdc, (ScriptCache *)*psc, psa, rChars, cChars, pwOutGlyphs, pcGlyphs, cMaxGlyphs);
SHAPE_ApplyDefaultOpentypeFeatures(hdc, (ScriptCache *)*psc, psa, pwOutGlyphs, pcGlyphs, cMaxGlyphs); SHAPE_ApplyDefaultOpentypeFeatures(hdc, (ScriptCache *)*psc, psa, pwOutGlyphs, pcGlyphs, cMaxGlyphs);
heap_free(rChars); heap_free(rChars);
} }
......
...@@ -57,5 +57,5 @@ BOOL BIDI_DetermineLevels( LPCWSTR lpString, INT uCount, const SCRIPT_STATE *s, ...@@ -57,5 +57,5 @@ BOOL BIDI_DetermineLevels( LPCWSTR lpString, INT uCount, const SCRIPT_STATE *s,
INT BIDI_ReorderV2lLevel(int level, int *pIndexs, const BYTE* plevel, int cch, BOOL fReverse); INT BIDI_ReorderV2lLevel(int level, int *pIndexs, const BYTE* plevel, int cch, BOOL fReverse);
INT BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE* plevel, int cch, BOOL fReverse); INT BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE* plevel, int cch, BOOL fReverse);
void SHAPE_ShapeArabicGlyphs(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs); void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs);
void SHAPE_ApplyDefaultOpentypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs); void SHAPE_ApplyDefaultOpentypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs);
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