Module: wine Branch: master Commit: 2fe60ff696cd7a0ba3716a15f45a5c3d22d3c035 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2fe60ff696cd7a0ba3716a15f4...
Author: Aric Stewart aric@codeweavers.com Date: Sun Nov 20 21:05:22 2011 -0700
usp10: Windows breaks punctuation into 2 different script types.
---
dlls/usp10/shape.c | 1 + dlls/usp10/tests/usp10.c | 11 +++++++++++ dlls/usp10/usp10.c | 11 ++++++++++- dlls/usp10/usp10_internal.h | 1 + 4 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c index 3662bc8..dd4d23b 100644 --- a/dlls/usp10/shape.c +++ b/dlls/usp10/shape.c @@ -583,6 +583,7 @@ static const ScriptShapeData ShapingData[] = {{ devanagari_features, 6}, required_telugu_features, "mlym", "mlm2", ContextualShape_Malayalam, ShapeCharGlyphProp_Malayalam}, {{ devanagari_features, 6}, required_telugu_features, "mlym", "mlm2", ContextualShape_Malayalam, ShapeCharGlyphProp_Malayalam}, {{ standard_features, 2}, NULL, "" , "", NULL, NULL}, + {{ standard_features, 2}, NULL, "latn" , "", 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 ede7603..b29f592 100644 --- a/dlls/usp10/tests/usp10.c +++ b/dlls/usp10/tests/usp10.c @@ -285,6 +285,13 @@ static void test_ScriptItemize( void ) static const WCHAR test21[] = {0x0710, 0x0712, 0x0308, 0x0712, 0x0714,0}; static const itemTest t211[2] = {{{0,0,0,0,0},0,1,1,1,syrc_tag,FALSE},{{0,0,0,0,0},5,0,0,0,-1,FALSE}};
+ /* Latin Punctuation */ + static const WCHAR test22[] = {'#','$',',','!','"','*',0}; + static const itemTest t221[3] = {{{0,0,0,0,0},0,0,0,0,latn_tag,FALSE},{{0,0,0,0,0},3,0,0,0,0,FALSE},{{0,0,0,0,0},6,0,0,0,-1,FALSE}}; + static const itemTest t222[3] = {{{0,0,0,0,0},0,1,1,1,latn_tag,FALSE},{{0,0,0,0,0},3,1,1,1,0,FALSE},{{0,0,0,0,0},6,0,0,0,-1,FALSE}}; + static const itemTest t223[2] = {{{0,0,0,0,0},0,1,1,1,latn_tag,FALSE},{{0,0,0,0,0},6,0,0,0,-1,FALSE}}; + + SCRIPT_ITEM items[15]; SCRIPT_CONTROL Control; SCRIPT_STATE State; @@ -339,6 +346,7 @@ static void test_ScriptItemize( void ) test_items_ok(test19,6,NULL,NULL,1,t191,FALSE,0); test_items_ok(test20,5,NULL,NULL,2,t201,FALSE,0); test_items_ok(test21,5,NULL,NULL,1,t211,FALSE,0); + test_items_ok(test22,6,NULL,NULL,2,t221,FALSE,0);
State.uBidiLevel = 0; test_items_ok(test1,4,&Control,&State,1,t11,FALSE,0); @@ -367,6 +375,7 @@ static void test_ScriptItemize( void ) test_items_ok(test19,6,&Control,&State,1,t191,FALSE,0); test_items_ok(test20,5,&Control,&State,2,t201,FALSE,0); test_items_ok(test21,5,&Control,&State,1,t211,FALSE,0); + test_items_ok(test22,6,&Control,&State,2,t221,FALSE,0);
State.uBidiLevel = 1; test_items_ok(test1,4,&Control,&State,1,t12,FALSE,0); @@ -395,6 +404,7 @@ static void test_ScriptItemize( void ) test_items_ok(test19,6,&Control,&State,1,t192,FALSE,0); test_items_ok(test20,5,&Control,&State,2,t202,FALSE,0); test_items_ok(test21,5,&Control,&State,1,t211,FALSE,0); + test_items_ok(test22,6,&Control,&State,2,t222,FALSE,1);
State.uBidiLevel = 1; Control.fMergeNeutralItems = TRUE; @@ -424,6 +434,7 @@ static void test_ScriptItemize( void ) test_items_ok(test19,6,&Control,&State,1,t192,FALSE,0); test_items_ok(test20,5,&Control,&State,2,t202,FALSE,0); test_items_ok(test21,5,&Control,&State,1,t211,FALSE,0); + test_items_ok(test22,6,&Control,&State,1,t223,FALSE,2); }
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 ae3a7b4..72c00cf 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -362,6 +362,10 @@ static const scriptData scriptInformation[] = { {LANG_ENGLISH, 0, 1, 0, 1, ANSI_CHARSET, 0, 0, 0, 0, 0, 1, 1, 0, 0}, 0x00000000, {0}}, + {{Script_Punctuation2, 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, 0, 0, 0}, + MS_MAKE_TAG('l','a','t','n'), + {0}}, };
static const SCRIPT_PROPERTIES *script_props[] = @@ -522,14 +526,19 @@ static WCHAR mirror_char( WCHAR ch )
static WORD get_char_script( WCHAR ch) { + static const WCHAR latin_punc[] = {'#','$','&',''',',',';','<','>','?','@','\','^','_','`','{','|','}','~', 0x00a0, 0}; WORD type = 0; int i;
if (ch == 0xc || ch == 0x20 || ch == 0x202f) return Script_CR;
+ /* These punctuation are seperated out as Latin punctuation */ + if (strchrW(latin_punc,ch)) + return Script_Punctuation2; + /* These chars are itemized as Punctuation by Windows */ - if (ch == 0x2212 || ch == 0x2044 || ch == 0x00a0) + if (ch == 0x2212 || ch == 0x2044) return Script_Punctuation;
GetStringTypeW(CT_CTYPE1, &ch, 1, &type); diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h index d6c910f..fc9bb7f 100644 --- a/dlls/usp10/usp10_internal.h +++ b/dlls/usp10/usp10_internal.h @@ -73,6 +73,7 @@ #define Script_Malayalam_Numeric 43 /* More supplemental */ #define Script_Diacritical 44 +#define Script_Punctuation2 45
#define GLYPH_BLOCK_SHIFT 8 #define GLYPH_BLOCK_SIZE (1UL << GLYPH_BLOCK_SHIFT)