Aric Stewart : usp10: Add contextual shaping proc to the script shaping data.
Alexandre Julliard
julliard at winehq.org
Mon Aug 16 12:25:04 CDT 2010
Module: wine
Branch: master
Commit: 0401f6c088ffc3e83ea6882fa1cc080d785bc7de
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0401f6c088ffc3e83ea6882fa1cc080d785bc7de
Author: Aric Stewart <aric at codeweavers.com>
Date: Thu Aug 12 14:58:32 2010 -0500
usp10: Add contextual shaping proc to the script shaping data.
---
dlls/usp10/shape.c | 45 ++++++++++++++++++++++++------------------
dlls/usp10/usp10.c | 2 +-
dlls/usp10/usp10_internal.h | 2 +-
3 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 0a5f997..0afcf80 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -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;
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 4f7bcf1..2c75d84 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -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);
}
diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h
index 281a67a..5aeb2b6 100644
--- a/dlls/usp10/usp10_internal.h
+++ b/dlls/usp10/usp10_internal.h
@@ -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);
More information about the wine-cvs
mailing list