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

This commit is contained in:
Aric Stewart 2010-08-12 14:58:32 -05:00 committed by Alexandre Julliard
parent 2fb344c117
commit 0401f6c088
3 changed files with 28 additions and 21 deletions

View File

@ -37,6 +37,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);
#define FIRST_ARABIC_CHAR 0x0600
#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_forms[LAST_ARABIC_CHAR - FIRST_ARABIC_CHAR + 1][4];
@ -274,22 +279,23 @@ static OPENTYPE_FEATURE_RECORD syriac_features[] =
typedef struct ScriptShapeDataTag {
TEXTRANGE_PROPERTIES defaultTextRange;
CHAR otTag[5];
ContextualShapingProc contextProc;
} ScriptShapeData;
/* in order of scripts */
static const ScriptShapeData ShapingData[] =
{
{{ standard_features, 2}, ""},
{{ standard_features, 2}, "latn"},
{{ standard_features, 2}, "latn"},
{{ standard_features, 2}, "latn"},
{{ standard_features, 2}, ""},
{{ standard_features, 2}, "latn"},
{{ arabic_features, 6}, "arab"},
{{ arabic_features, 6}, "arab"},
{{ hebrew_features, 1}, "hebr"},
{{ syriac_features, 4}, "syrc"},
{{ arabic_features, 6}, "arab"},
{{ standard_features, 2}, "", NULL},
{{ standard_features, 2}, "latn", NULL},
{{ standard_features, 2}, "latn", NULL},
{{ standard_features, 2}, "latn", NULL},
{{ standard_features, 2}, "" , NULL},
{{ standard_features, 2}, "latn", NULL},
{{ arabic_features, 6}, "arab", ContextualShape_Arabic},
{{ arabic_features, 6}, "arab", ContextualShape_Arabic},
{{ hebrew_features, 1}, "hebr", NULL},
{{ syriac_features, 4}, "syrc", NULL},
{{ arabic_features, 6}, "arab", ContextualShape_Arabic},
};
static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph)
@ -858,27 +864,22 @@ static inline BOOL left_join_causing(CHAR joining_type)
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;
INT *context_shape;
INT dirR, dirL;
int i;
if (psa->eScript != Script_Arabic &&
psa->eScript != Script_Persian &&
psa->eScript != Script_Arabic_Numeric)
return;
if (*pcGlyphs != cChars)
{
ERR("Number of Glyphs and Chars need to match at the beginning\n");
return;
}
if (!psa->fLogicalOrder && psa->fRTL)
{
dirR = 1;
@ -948,6 +949,12 @@ void SHAPE_ShapeArabicGlyphs(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WC
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)
{
int i;

View File

@ -1198,7 +1198,7 @@ HRESULT WINAPI ScriptShape(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars,
}
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);
heap_free(rChars);
}

View File

@ -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_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);