usp10: Add Oriya script.
This commit is contained in:
parent
858ecd1c54
commit
bafc5f0f30
|
@ -48,6 +48,7 @@ static void ContextualShape_Devanagari(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSI
|
|||
static void ContextualShape_Bengali(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
|
||||
static void ContextualShape_Gurmukhi(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
|
||||
static void ContextualShape_Gujarati(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
|
||||
static void ContextualShape_Oriya(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*);
|
||||
|
@ -61,6 +62,7 @@ static void ShapeCharGlyphProp_Devanagari( HDC hdc, ScriptCache *psc, SCRIPT_ANA
|
|||
static void ShapeCharGlyphProp_Bengali( 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 );
|
||||
static void ShapeCharGlyphProp_Gurmukhi( 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 );
|
||||
static void ShapeCharGlyphProp_Gujarati( 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 );
|
||||
static void ShapeCharGlyphProp_Oriya( 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 );
|
||||
|
||||
extern const unsigned short wine_shaping_table[];
|
||||
extern const unsigned short wine_shaping_forms[LAST_ARABIC_CHAR - FIRST_ARABIC_CHAR + 1][4];
|
||||
|
@ -512,6 +514,43 @@ static OPENTYPE_FEATURE_RECORD gurmukhi_features[] =
|
|||
{ MS_MAKE_TAG('c','a','l','t'), 1},
|
||||
};
|
||||
|
||||
static const char* required_oriya_features[] =
|
||||
{
|
||||
"nukt",
|
||||
"akhn",
|
||||
"rphf",
|
||||
"blwf",
|
||||
"pstf",
|
||||
"cjct",
|
||||
"pres",
|
||||
"abvs",
|
||||
"blws",
|
||||
"psts",
|
||||
"haln",
|
||||
"calt",
|
||||
NULL
|
||||
};
|
||||
|
||||
static OPENTYPE_FEATURE_RECORD oriya_features[] =
|
||||
{
|
||||
/* Localized forms */
|
||||
{ MS_MAKE_TAG('l','o','c','l'), 1},
|
||||
/* Base forms */
|
||||
{ MS_MAKE_TAG('n','u','k','t'), 1},
|
||||
{ MS_MAKE_TAG('a','k','h','n'), 1},
|
||||
{ MS_MAKE_TAG('r','p','h','f'), 1},
|
||||
{ MS_MAKE_TAG('b','l','w','f'), 1},
|
||||
{ MS_MAKE_TAG('p','s','t','f'), 1},
|
||||
{ MS_MAKE_TAG('c','j','c','t'), 1},
|
||||
/* Presentation forms */
|
||||
{ MS_MAKE_TAG('p','r','e','s'), 1},
|
||||
{ MS_MAKE_TAG('a','b','v','s'), 1},
|
||||
{ MS_MAKE_TAG('b','l','w','s'), 1},
|
||||
{ MS_MAKE_TAG('p','s','t','s'), 1},
|
||||
{ MS_MAKE_TAG('h','a','l','n'), 1},
|
||||
{ MS_MAKE_TAG('c','a','l','t'), 1},
|
||||
};
|
||||
|
||||
typedef struct ScriptShapeDataTag {
|
||||
TEXTRANGE_PROPERTIES defaultTextRange;
|
||||
const char** requiredFeatures;
|
||||
|
@ -557,6 +596,8 @@ static const ScriptShapeData ShapingData[] =
|
|||
{{ devanagari_features, 15}, required_devanagari_features, "gujr", "gjr2", ContextualShape_Gujarati, ShapeCharGlyphProp_Gujarati},
|
||||
{{ devanagari_features, 15}, required_devanagari_features, "gujr", "gjr2", ContextualShape_Gujarati, ShapeCharGlyphProp_Gujarati},
|
||||
{{ devanagari_features, 15}, required_devanagari_features, "gujr", "gjr2", ContextualShape_Gujarati, ShapeCharGlyphProp_Gujarati},
|
||||
{{ oriya_features, 13}, required_oriya_features, "orya", "ory2", ContextualShape_Oriya, ShapeCharGlyphProp_Oriya},
|
||||
{{ oriya_features, 13}, required_oriya_features, "orya", "ory2", ContextualShape_Oriya, ShapeCharGlyphProp_Oriya},
|
||||
};
|
||||
|
||||
static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph)
|
||||
|
@ -2149,6 +2190,81 @@ static void ContextualShape_Gujarati(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS
|
|||
HeapFree(GetProcessHeap(),0,input);
|
||||
}
|
||||
|
||||
static int oriya_lex(WCHAR c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 0x0B24:
|
||||
case 0x0B28:
|
||||
case 0x0B2F:
|
||||
case 0x0B5F:
|
||||
case 0x0B71:
|
||||
case 0x0B33: return lex_Consonant;
|
||||
case 0x0B30: return lex_Ra;
|
||||
case 0x0B3C: return lex_Nukta;
|
||||
case 0x0B3F:
|
||||
case 0x0B56: return lex_Mantra_above;
|
||||
case 0x0B3E:
|
||||
case 0x0B40: return lex_Mantra_post;
|
||||
case 0x0B47:
|
||||
case 0x0B57: return lex_Mantra_pre;
|
||||
case 0x0B4D: return lex_Halant;
|
||||
case 0x200C: return lex_ZWNJ;
|
||||
case 0x200D: return lex_ZWJ;
|
||||
default:
|
||||
if (c>=0x0B01 && c<=0x0B03) return lex_Modifier;
|
||||
else if (c>=0x0B05 && c<=0x0B14) return lex_Vowel;
|
||||
else if (c>=0x0B15 && c<=0x0B39) return lex_Consonant;
|
||||
else if (c>=0x0B2C && c<=0x0B2E) return lex_Consonant;
|
||||
else if (c>=0x0B32 && c<=0x0B33) return lex_Consonant;
|
||||
else if (c>=0x0B41 && c<=0x0B44) return lex_Mantra_below;
|
||||
else if (c>=0x0B48 && c<=0x0B4C) return lex_Composed_Vowel;
|
||||
else if (c>=0x0B5C && c<=0x0B5D) return lex_Consonant;
|
||||
else if (c>=0x0B60 && c<=0x0B61) return lex_Vowel;
|
||||
else if (c>=0x0B62 && c<=0x0B63) return lex_Mantra_below;
|
||||
else return lex_Generic;
|
||||
}
|
||||
}
|
||||
|
||||
static const VowelComponents Oriya_vowels[] = {
|
||||
{0x0B48, {0x0B47,0x0B56,0x0000}},
|
||||
{0x0B4B, {0x0B47,0x0B3E,0x0000}},
|
||||
{0x0B4C, {0x0B47,0x0B57,0x0000}},
|
||||
{0x0000, {0x0000,0x0000,0x0000}}};
|
||||
|
||||
static const ConsonantComponents Oriya_consonants[] = {
|
||||
{{0x0B21,0x0B3C,0x0000}, 0x0B5C},
|
||||
{{0x0B22,0x0B3C,0x0000}, 0x0B5D},
|
||||
{{0x0000,0x0000,0x0000}, 0x0000}};
|
||||
|
||||
static void ContextualShape_Oriya(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust)
|
||||
{
|
||||
int cCount = cChars;
|
||||
WCHAR *input;
|
||||
|
||||
if (*pcGlyphs != cChars)
|
||||
{
|
||||
ERR("Number of Glyphs and Chars need to match at the beginning\n");
|
||||
return;
|
||||
}
|
||||
|
||||
input = HeapAlloc(GetProcessHeap(), 0, (cChars*2) * sizeof(WCHAR));
|
||||
memcpy(input, pwcChars, cChars * sizeof(WCHAR));
|
||||
|
||||
/* Step 1: Decompose Vowels and Compose Consonents */
|
||||
DecomposeVowels(hdc, input, &cCount, Oriya_vowels);
|
||||
ComposeConsonants(hdc, input, &cCount, Oriya_consonants);
|
||||
TRACE("New composed string %s (%i)\n",debugstr_wn(input,cCount),cCount);
|
||||
|
||||
/* Step 2: Reorder within Syllables */
|
||||
Indic_ReorderCharacters( input, cCount, oriya_lex, Reorder_Like_Bengali);
|
||||
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
|
||||
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
|
||||
*pcGlyphs = cCount;
|
||||
|
||||
HeapFree(GetProcessHeap(),0,input);
|
||||
}
|
||||
|
||||
static void ShapeCharGlyphProp_Default( 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)
|
||||
{
|
||||
int i,k;
|
||||
|
@ -2527,6 +2643,11 @@ static void ShapeCharGlyphProp_Gujarati( HDC hdc, ScriptCache *psc, SCRIPT_ANALY
|
|||
ShapeCharGlyphProp_BaseIndic(hdc, psc, psa, pwcChars, cChars, pwGlyphs, cGlyphs, pwLogClust, pCharProp, pGlyphProp, gujarati_lex);
|
||||
}
|
||||
|
||||
static void ShapeCharGlyphProp_Oriya( 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 )
|
||||
{
|
||||
ShapeCharGlyphProp_BaseIndic(hdc, psc, psa, pwcChars, cChars, pwGlyphs, cGlyphs, pwLogClust, pCharProp, pGlyphProp, oriya_lex);
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -130,6 +130,7 @@ static inline void _test_items_ok(LPCWSTR string, DWORD cchString,
|
|||
#define beng_tag MS_MAKE_TAG('b','e','n','g')
|
||||
#define guru_tag MS_MAKE_TAG('g','u','r','u')
|
||||
#define gujr_tag MS_MAKE_TAG('g','u','j','r')
|
||||
#define orya_tag MS_MAKE_TAG('o','r','y','a')
|
||||
|
||||
static void test_ScriptItemize( void )
|
||||
{
|
||||
|
@ -231,6 +232,10 @@ static void test_ScriptItemize( void )
|
|||
static const itemTest t141[2] = {{{0,0,0,0,0},0,0,0,0,gujr_tag},{{0,0,0,0,0},7,0,0,0,-1}};
|
||||
static const itemTest t142[2] = {{{0,0,0,0,0},0,0,0,2,gujr_tag},{{0,0,0,0,0},7,0,0,0,-1}};
|
||||
|
||||
/* Oriya */
|
||||
static const WCHAR test15[] = {0x0b13, 0x0b21, 0x0b3c, 0x0b3f, 0x0b06};
|
||||
static const itemTest t151[2] = {{{0,0,0,0,0},0,0,0,0,orya_tag},{{0,0,0,0,0},5,0,0,0,-1}};
|
||||
static const itemTest t152[2] = {{{0,0,0,0,0},0,0,0,2,orya_tag},{{0,0,0,0,0},5,0,0,0,-1}};
|
||||
|
||||
|
||||
SCRIPT_ITEM items[15];
|
||||
|
@ -279,6 +284,7 @@ static void test_ScriptItemize( void )
|
|||
test_items_ok(test12,5,NULL,NULL,1,t121,FALSE,0);
|
||||
test_items_ok(test13,7,NULL,NULL,1,t131,FALSE,0);
|
||||
test_items_ok(test14,7,NULL,NULL,1,t141,FALSE,0);
|
||||
test_items_ok(test15,5,NULL,NULL,1,t151,FALSE,0);
|
||||
|
||||
State.uBidiLevel = 0;
|
||||
test_items_ok(test1,4,&Control,&State,1,t11,FALSE,0);
|
||||
|
@ -299,6 +305,7 @@ static void test_ScriptItemize( void )
|
|||
test_items_ok(test12,5,&Control,&State,1,t121,FALSE,0);
|
||||
test_items_ok(test13,7,&Control,&State,1,t131,FALSE,0);
|
||||
test_items_ok(test14,7,&Control,&State,1,t141,FALSE,0);
|
||||
test_items_ok(test15,5,&Control,&State,1,t151,FALSE,0);
|
||||
|
||||
State.uBidiLevel = 1;
|
||||
test_items_ok(test1,4,&Control,&State,1,t12,FALSE,0);
|
||||
|
@ -319,6 +326,7 @@ static void test_ScriptItemize( void )
|
|||
test_items_ok(test12,5,&Control,&State,1,t122,FALSE,0);
|
||||
test_items_ok(test13,7,&Control,&State,1,t132,FALSE,0);
|
||||
test_items_ok(test14,7,&Control,&State,1,t142,FALSE,0);
|
||||
test_items_ok(test15,5,&Control,&State,1,t152,FALSE,0);
|
||||
|
||||
State.uBidiLevel = 1;
|
||||
Control.fMergeNeutralItems = TRUE;
|
||||
|
@ -340,6 +348,7 @@ static void test_ScriptItemize( void )
|
|||
test_items_ok(test12,5,&Control,&State,1,t122,FALSE,0);
|
||||
test_items_ok(test13,7,&Control,&State,1,t132,FALSE,0);
|
||||
test_items_ok(test14,7,&Control,&State,1,t142,FALSE,0);
|
||||
test_items_ok(test15,5,&Control,&State,1,t152,FALSE,0);
|
||||
}
|
||||
|
||||
static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
|
||||
|
|
|
@ -85,6 +85,8 @@ static const scriptRange scriptRanges[] = {
|
|||
{ Script_Gurmukhi, 0xa00, 0xa7f, Script_Gurmukhi_Numeric, 0},
|
||||
/* Gujarati: U+0A80–U+0AFF*/
|
||||
{ Script_Gujarati, 0xa80, 0xaff, Script_Gujarati_Numeric, 0},
|
||||
/* Oriya: U+0B00–U+0B7F */
|
||||
{ Script_Oriya, 0xb00, 0xb7f, Script_Oriya_Numeric, 0},
|
||||
/* Sinhala: U+0D80–U+0DFF */
|
||||
{ Script_Sinhala, 0xd80, 0xdff, 0, 0},
|
||||
/* Thai: U+0E00–U+0E7F */
|
||||
|
@ -243,6 +245,12 @@ static const scriptData scriptInformation[] = {
|
|||
{{Script_Gujarati_Currency, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
|
||||
{LANG_GUJARATI, 0, 1, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
MS_MAKE_TAG('g','u','j','r')},
|
||||
{{Script_Oriya, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
|
||||
{LANG_ORIYA, 0, 1, 0, 1, DEFAULT_CHARSET, 0, 0, 0, 0, 1, 0, 0, 0, 0},
|
||||
MS_MAKE_TAG('o','r','y','a')},
|
||||
{{Script_Oriya_Numeric, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
|
||||
{LANG_ORIYA, 1, 1, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
MS_MAKE_TAG('o','r','y','a')},
|
||||
};
|
||||
|
||||
static const SCRIPT_PROPERTIES *script_props[] =
|
||||
|
@ -263,7 +271,8 @@ static const SCRIPT_PROPERTIES *script_props[] =
|
|||
&scriptInformation[26].props, &scriptInformation[27].props,
|
||||
&scriptInformation[28].props, &scriptInformation[29].props,
|
||||
&scriptInformation[30].props, &scriptInformation[31].props,
|
||||
&scriptInformation[32].props, &scriptInformation[33].props
|
||||
&scriptInformation[32].props, &scriptInformation[33].props,
|
||||
&scriptInformation[34].props, &scriptInformation[35].props
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
#define Script_Gujarati 31
|
||||
#define Script_Gujarati_Numeric 32
|
||||
#define Script_Gujarati_Currency 33
|
||||
#define Script_Oriya 34
|
||||
#define Script_Oriya_Numeric 35
|
||||
|
||||
#define GLYPH_BLOCK_SHIFT 8
|
||||
#define GLYPH_BLOCK_SIZE (1UL << GLYPH_BLOCK_SHIFT)
|
||||
|
|
Loading…
Reference in New Issue