Aric Stewart : usp10: Add CKJ Han and Ideographic scripts.

Alexandre Julliard julliard at winehq.org
Tue Dec 13 13:01:25 CST 2011


Module: wine
Branch: master
Commit: df2e40bc34895053d3a007c6c9d249577d457b38
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=df2e40bc34895053d3a007c6c9d249577d457b38

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Dec 12 14:50:12 2011 -0600

usp10: Add CKJ Han and Ideographic scripts.

---

 dlls/usp10/shape.c          |    5 ++++
 dlls/usp10/tests/usp10.c    |   18 +++++++++++++++
 dlls/usp10/usp10.c          |   49 ++++++++++++++++++++++++++++++++++++++++++-
 dlls/usp10/usp10_internal.h |    3 ++
 4 files changed, 74 insertions(+), 1 deletions(-)

diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 11c3658..da04361 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -570,6 +570,9 @@ static const char* required_khmer_features[] =
     NULL
 };
 
+static OPENTYPE_FEATURE_RECORD no_features[] =
+{ };
+
 typedef struct ScriptShapeDataTag {
     TEXTRANGE_PROPERTIES   defaultTextRange;
     const char**           requiredFeatures;
@@ -636,6 +639,8 @@ static const ScriptShapeData ShapingData[] =
     {{ standard_features, 2}, NULL, "talu", "", NULL, NULL},
     {{ khmer_features, 5}, required_khmer_features, "khmr", "", ContextualShape_Khmer, ShapeCharGlyphProp_Khmer},
     {{ khmer_features, 5}, required_khmer_features, "khmr", "", ContextualShape_Khmer, ShapeCharGlyphProp_Khmer},
+    {{ no_features, 0}, NULL, "hani", "", NULL, NULL},
+    {{ no_features, 0}, NULL, "hani", "", NULL, NULL},
 };
 
 static INT GSUB_is_glyph_covered(LPCVOID table , UINT glyph)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index a0985d6..d17325d 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -153,6 +153,7 @@ static inline void _test_items_ok(LPCWSTR string, DWORD cchString,
 #define tale_tag MS_MAKE_TAG('t','a','l','e')
 #define talu_tag MS_MAKE_TAG('t','a','l','u')
 #define khmr_tag MS_MAKE_TAG('k','h','m','r')
+#define hani_tag MS_MAKE_TAG('h','a','n','i')
 
 static void test_ScriptItemize( void )
 {
@@ -322,6 +323,15 @@ static void test_ScriptItemize( void )
     static const itemTest t271[2] = {{{0,0,0,0,0},0,0,0,0,khmr_tag,FALSE},{{0,0,0,0,0},8,0,0,0,-1,FALSE}};
     static const itemTest t272[2] = {{{0,0,0,0,0},0,0,0,2,khmr_tag,TRUE,{-1,1,1,1,-1}},{{0,0,0,0,0},8,0,0,0,-1,FALSE}};
 
+    /* CJK Han */
+    static const WCHAR test28[] = {0x8bed,0x7d20,0x6587,0x5b57};
+    static const itemTest t281[2] = {{{0,0,0,0,0},0,0,0,0,hani_tag,FALSE},{{0,0,0,0,0},4,0,0,0,-1,FALSE}};
+    static const itemTest t282[2] = {{{0,0,0,0,0},0,0,0,2,hani_tag,FALSE},{{0,0,0,0,0},4,0,0,0,-1,FALSE}};
+
+    /* Ideographic */
+    static const WCHAR test29[] = {0x2ff0,0x2ff3,0x2ffb,0x2ff0,0x65e5,0x65e5,0x5de5,0x7f51,0x4e02,0x4e5e};
+    static const itemTest t291[3] = {{{0,0,0,0,0},0,0,0,0,hani_tag,FALSE},{{0,0,0,0,0},4,0,0,0,hani_tag,FALSE},{{0,0,0,0,0},10,0,0,0,-1,FALSE}};
+    static const itemTest t292[3] = {{{0,0,0,0,0},0,1,1,1,hani_tag,FALSE},{{0,0,0,0,0},4,0,0,2,hani_tag,FALSE},{{0,0,0,0,0},10,0,0,0,-1,FALSE}};
 
     SCRIPT_ITEM items[15];
     SCRIPT_CONTROL  Control;
@@ -383,6 +393,8 @@ static void test_ScriptItemize( void )
     test_items_ok(test25,10,NULL,NULL,1,t251,FALSE,0);
     test_items_ok(test26,2,NULL,NULL,1,t261,FALSE,0);
     test_items_ok(test27,8,NULL,NULL,1,t271,FALSE,0);
+    test_items_ok(test28,4,NULL,NULL,1,t281,FALSE,0);
+    test_items_ok(test29,10,NULL,NULL,2,t291,FALSE,0);
 
     State.uBidiLevel = 0;
     test_items_ok(test1,4,&Control,&State,1,t11,FALSE,0);
@@ -417,6 +429,8 @@ static void test_ScriptItemize( void )
     test_items_ok(test25,10,&Control,&State,1,t251,FALSE,0);
     test_items_ok(test26,2,&Control,&State,1,t261,FALSE,0);
     test_items_ok(test27,8,&Control,&State,1,t271,FALSE,0);
+    test_items_ok(test28,4,&Control,&State,1,t281,FALSE,0);
+    test_items_ok(test29,10,&Control,&State,2,t291,FALSE,0);
 
     State.uBidiLevel = 1;
     test_items_ok(test1,4,&Control,&State,1,t12,FALSE,0);
@@ -451,6 +465,8 @@ static void test_ScriptItemize( void )
     test_items_ok(test25,10,&Control,&State,1,t252,FALSE,0);
     test_items_ok(test26,2,&Control,&State,1,t262,FALSE,0);
     test_items_ok(test27,8,&Control,&State,1,t272,FALSE,0);
+    test_items_ok(test28,4,&Control,&State,1,t282,FALSE,0);
+    test_items_ok(test29,10,&Control,&State,2,t292,FALSE,0);
 
     State.uBidiLevel = 1;
     Control.fMergeNeutralItems = TRUE;
@@ -486,6 +502,8 @@ static void test_ScriptItemize( void )
     test_items_ok(test25,10,&Control,&State,1,t252,FALSE,0);
     test_items_ok(test26,2,&Control,&State,1,t262,FALSE,0);
     test_items_ok(test27,8,&Control,&State,1,t272,FALSE,0);
+    test_items_ok(test28,4,&Control,&State,1,t282,FALSE,0);
+    test_items_ok(test29,10,&Control,&State,2,t292,FALSE,0);
 }
 
 static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index ff3ae2e..2c860cf 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -166,6 +166,34 @@ static const scriptRange scriptRanges[] = {
     { Script_Georgian,   0x2d00,  0x2d2f,  0, 0},
     /* Cyrillic Extended-A: U+2DE0–U+2DFF */
     { Script_Cyrillic,   0x2de0, 0x2dff,  0, 0},
+    /* CJK Radicals Supplement: U+2E80–U+2EFF */
+    /* Kangxi Radicals: U+2F00–U+2FDF */
+    { Script_CJK_Han,    0x2e80, 0x2fdf,  0, 0},
+    /* Ideographic Description Characters: U+2FF0–U+2FFF */
+    { Script_Ideograph  ,0x2ff0, 0x2fff,  0, 0},
+    /* CJK Symbols and Punctuation: U+3000–U+303F */
+    { Script_Ideograph  ,0x3000, 0x3004,  0, 0},
+    { Script_CJK_Han    ,0x3005, 0x3005,  0, 0},
+    { Script_Ideograph  ,0x3006, 0x3006,  0, 0},
+    { Script_CJK_Han    ,0x3007, 0x3007,  0, 0},
+    { Script_Ideograph  ,0x3008, 0x3020,  0, 0},
+    { Script_CJK_Han    ,0x3021, 0x3029,  0, 0},
+    { Script_Ideograph  ,0x302a, 0x3030,  0, 0},
+    { Script_Ideograph  ,0x3036, 0x3037,  0, 0},
+    { Script_CJK_Han    ,0x3038, 0x303b,  0, 0},
+    { Script_Ideograph  ,0x303c, 0x303f,  0, 0},
+    /* Kanbun: U+3190–U+319F */
+    { Script_Ideograph  ,0x3190, 0x319f,  0, 0},
+    /* CJK Strokes: U+31C0–U+31EF */
+    { Script_Ideograph  ,0x31c0, 0x31ef,  0, 0},
+    /* Enclosed CJK Letters and Months: U+3200–U+32FF */
+    { Script_Ideograph  ,0x3220, 0x32ff,  0, 0},
+    /* CJK Compatibility: U+3300–U+33FF*/
+    { Script_Ideograph  ,0x3300, 0x33ff,  0, 0},
+    /* CJK Unified Ideographs Extension A: U+3400–U+4DBF */
+    { Script_CJK_Han    ,0x3400, 0x4dbf,  0, 0},
+    /* CJK Unified Ideographs: U+4E00–U+9FFF */
+    { Script_CJK_Han    ,0x4e00, 0x9fff,  0, 0},
     /* Cyrillic Extended-B: U+A640–U+A69F */
     { Script_Cyrillic,   0xa640, 0xa69f,  0, 0},
     /* Modifier Tone Letters: U+A700–U+A71F */
@@ -177,6 +205,8 @@ static const scriptRange scriptRanges[] = {
     { Script_Devanagari, 0xa8e0, 0xa8ff, Script_Devanagari_Numeric, 0},
     /* Myanmar Extended-A: U+AA60–U+AA7F */
     { Script_Myanmar,    0xaa60,  0xaa7f, Script_Myanmar_Numeric, 0},
+    /* CJK Compatibility Ideographs: U+F900–U+FAFF */
+    { Script_CJK_Han    ,0xf900, 0xfaff,  0, 0},
     /* Latin Ligatures: U+FB00–U+FB06 */
     { Script_Latin,      0xfb00, 0xfb06, 0, 0},
     /* Armenian ligatures U+FB13..U+FB17 */
@@ -185,8 +215,16 @@ static const scriptRange scriptRanges[] = {
     { Script_Hebrew,     0xfb1d, 0xfb4f, 0, 0},
     /* Arabic Presentation Forms-A: U+FB50–U+FDFF*/
     { Script_Arabic,     0xfb50, 0xfdff, 0, 0},
+    /* Vertical Forms: U+FE10–U+FE1F */
+    /* Combining Half Marks: U+FE20–U+FE2F */
+    /* CJK Compatibility Forms: U+FE30–U+FE4F */
+    /* Small Form Variants: U+FE50–U+FE6F */
+    { Script_Ideograph  ,0xfe10, 0xfe6f,  0, 0},
     /* Arabic Presentation Forms-B: U+FE70–U+FEFF*/
     { Script_Arabic,     0xfe70, 0xfeff, 0, 0},
+    /* Halfwidth and Fullwidth Forms: U+FF00–FFEF */
+    { Script_Ideograph  ,0xff00, 0xff64,  Script_Numeric2, 0},
+    { Script_Ideograph  ,0xffe0, 0xffef,  0, 0},
     /* END */
     { SCRIPT_UNDEFINED,  0, 0, 0}
 };
@@ -417,6 +455,14 @@ static const scriptData scriptInformation[] = {
      {0x53, 1, 1, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      MS_MAKE_TAG('k','h','m','r'),
      {'D','a','u','n','P','e','n','h'}},
+    {{Script_CJK_Han, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
+     {LANG_ENGLISH, 0, 0, 0, 0, ANSI_CHARSET, 0, 0, 0, 0, 0, 0, 1, 0, 0},
+     MS_MAKE_TAG('h','a','n','i'),
+     {0}},
+    {{Script_Ideograph, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
+     {LANG_ENGLISH, 0, 0, 0, 0, ANSI_CHARSET, 0, 0, 0, 0, 0, 0, 1, 0, 0},
+     MS_MAKE_TAG('h','a','n','i'),
+     {0}},
 };
 
 static const SCRIPT_PROPERTIES *script_props[] =
@@ -447,7 +493,8 @@ static const SCRIPT_PROPERTIES *script_props[] =
     &scriptInformation[46].props, &scriptInformation[47].props,
     &scriptInformation[48].props, &scriptInformation[49].props,
     &scriptInformation[50].props, &scriptInformation[51].props,
-    &scriptInformation[52].props, &scriptInformation[53].props
+    &scriptInformation[52].props, &scriptInformation[53].props,
+    &scriptInformation[54].props, &scriptInformation[55].props
 };
 
 typedef struct {
diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h
index b9c9fa0..b6633f0 100644
--- a/dlls/usp10/usp10_internal.h
+++ b/dlls/usp10/usp10_internal.h
@@ -83,6 +83,9 @@
 #define Script_New_Tai_Lue_Numeric 51
 #define Script_Khmer 52
 #define Script_Khmer_Numeric 53
+/* Unicode Chapter 12 */
+#define Script_CJK_Han  54
+#define Script_Ideograph  55
 
 #define GLYPH_BLOCK_SHIFT 8
 #define GLYPH_BLOCK_SIZE  (1UL << GLYPH_BLOCK_SHIFT)




More information about the wine-cvs mailing list