dwrite: Support for Greek and Cyrillic ranges.

This commit is contained in:
Nikolay Sivov 2012-10-30 11:53:19 -04:00 committed by Alexandre Julliard
parent 05d6411884
commit bbc0137f8a
2 changed files with 48 additions and 11 deletions

View File

@ -30,8 +30,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
enum scriptcode {
Script_Arabic = 0,
Script_C1Controls = 12,
Script_Coptic = 13,
Script_Cyrillic = 16,
Script_Greek = 23,
Script_Latin = 38,
Script_Latin_Symb = 77,
Script_Symbol = 77,
Script_Unknown = (UINT16)-1
};
@ -46,15 +49,15 @@ static const struct script_range script_ranges[] = {
/* ASCII punctuation and symbols: U+0020U+002F */
/* ASCII digits: U+0030U+0039 */
/* ASCII punctuation and symbols: U+003AU+0040 */
{ Script_Latin_Symb, 0x00, 0x040 },
{ Script_Symbol, 0x00, 0x040 },
/* Latin uppercase: U+0041U+005A */
{ Script_Latin, 0x41, 0x5a },
/* ASCII punctuation and symbols: U+005BU+0060 */
{ Script_Latin_Symb, 0x5b, 0x060 },
{ Script_Symbol, 0x5b, 0x060 },
/* Latin lowercase: U+0061U+007A */
{ Script_Latin, 0x61, 0x7a },
/* ASCII punctuation and symbols, control char DEL: U+007BU+007F */
{ Script_Latin_Symb, 0x7b, 0x7f },
{ Script_Symbol, 0x7b, 0x7f },
/* C1 Controls: U+0080U+009F */
{ Script_C1Controls, 0x80, 0x9f },
/* Latin-1 Supplement: U+00A0U+00FF */
@ -63,9 +66,22 @@ static const struct script_range script_ranges[] = {
/* IPA Extensions: U+0250U+02AF */
/* Spacing Modifier Letters: U+02B0U+02FF */
{ Script_Latin, 0xa0, 0x2ff },
/* Combining Diacritical Marks: U+0300U+036F */
{ Script_Symbol, 0x300, 0x36f },
/* Greek: U+0370U+03E1 */
{ Script_Greek, 0x370, 0x3e1 },
/* Coptic: U+03E2U+03Ef */
{ Script_Coptic, 0x3e2, 0x3ef },
/* Greek: U+03F0U+03FF */
{ Script_Greek, 0x3f0, 0x3ff },
/* Cyrillic: U+0400U+04FF */
/* Cyrillic Supplement: U+0500U+052F */
/* Cyrillic Supplement range is incomplete cause it's based on Unicode 5.2
that doesn't define some Abkhaz and Azerbaijani letters, we support Unicode 6.0 range here */
{ Script_Cyrillic, 0x400, 0x52f },
/* Arabic: U+0600U+06FF */
{ Script_Arabic, 0x600, 0x6ef },
/* unsuppoted range */
/* unsupported range */
{ Script_Unknown }
};
@ -102,8 +118,8 @@ static HRESULT analyze_script(const WCHAR *text, UINT32 len, IDWriteTextAnalysis
UINT16 script = get_char_script(text[i]);
/* Script_Latin_Symb script type is ignored when preceded or followed by another script */
if (sa.script == Script_Latin_Symb) sa.script = script;
if (script == Script_Latin_Symb) script = sa.script;
if (sa.script == Script_Symbol) sa.script = script;
if (script == Script_Symbol) script = sa.script;
/* this is a length of a sequence to be reported next */
if (sa.script == script) length++;

View File

@ -399,8 +399,11 @@ struct sa_test {
enum scriptcode {
Script_Arabic = 0,
Script_C1Controls = 12,
Script_Coptic = 13,
Script_Cyrillic = 16,
Script_Greek = 23,
Script_Latin = 38,
Script_Latin_Symb = 77
Script_Symbol = 77
};
static struct sa_test sa_tests[] = {
@ -415,16 +418,16 @@ static struct sa_test sa_tests[] = {
},
{
{' ',' ',' ',' ','!','$','[','^','{','~',0}, 1,
{ { 0, 10, { Script_Latin_Symb, DWRITE_SCRIPT_SHAPES_DEFAULT } }}
{ { 0, 10, { Script_Symbol, DWRITE_SCRIPT_SHAPES_DEFAULT } }}
},
{
{' ',' ',' ','1','2',' ',0}, 1,
{ { 0, 6, { Script_Latin_Symb, DWRITE_SCRIPT_SHAPES_DEFAULT } }}
{ { 0, 6, { Script_Symbol, DWRITE_SCRIPT_SHAPES_DEFAULT } }}
},
{
/* digits only */
{'1','2',0}, 1,
{ { 0, 2, { Script_Latin_Symb, DWRITE_SCRIPT_SHAPES_DEFAULT } }}
{ { 0, 2, { Script_Symbol, DWRITE_SCRIPT_SHAPES_DEFAULT } }}
},
{
/* Arabic */
@ -484,6 +487,24 @@ static struct sa_test sa_tests[] = {
{0x2b0,0x2ba,0x2d7,0x2dd,0x2ef,0x2ff,0}, 1,
{ { 0, 6, { Script_Latin, DWRITE_SCRIPT_SHAPES_DEFAULT } }}
},
{
/* Combining Diacritical Marks */
{0x300,0x320,0x340,0x345,0x350,0x36f,0}, 1,
{ { 0, 6, { Script_Symbol, DWRITE_SCRIPT_SHAPES_DEFAULT } }}
},
{
/* Greek and Coptic */
{0x370,0x388,0x3d8,0x3e1,0x3e2,0x3fa,0x3ff,0}, 3,
{ { 0, 4, { Script_Greek, DWRITE_SCRIPT_SHAPES_DEFAULT } },
{ 4, 1, { Script_Coptic, DWRITE_SCRIPT_SHAPES_DEFAULT } },
{ 5, 2, { Script_Greek, DWRITE_SCRIPT_SHAPES_DEFAULT } }
}
},
{
/* Cyrillic and Cyrillic Supplement */
{0x400,0x40f,0x410,0x44f,0x450,0x45f,0x460,0x481,0x48a,0x4f0,0x4fa,0x4ff,0x500,0x510,0x520,0}, 1,
{ { 0, 15, { Script_Cyrillic, DWRITE_SCRIPT_SHAPES_DEFAULT } }}
},
/* keep this as end marker */
{ {0} }
};