Nikolay Sivov : dwrite: Support for Greek and Cyrillic ranges.
Alexandre Julliard
julliard at winehq.org
Tue Oct 30 13:27:35 CDT 2012
Module: wine
Branch: master
Commit: bbc0137f8a125a51df2fdd8066c587194de9972d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bbc0137f8a125a51df2fdd8066c587194de9972d
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Oct 30 11:53:19 2012 -0400
dwrite: Support for Greek and Cyrillic ranges.
---
dlls/dwrite/analyzer.c | 30 +++++++++++++++++++++++-------
dlls/dwrite/tests/analyzer.c | 29 +++++++++++++++++++++++++----
2 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index 3e22f84..541914b 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -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+0020–U+002F */
/* ASCII digits: U+0030–U+0039 */
/* ASCII punctuation and symbols: U+003A–U+0040 */
- { Script_Latin_Symb, 0x00, 0x040 },
+ { Script_Symbol, 0x00, 0x040 },
/* Latin uppercase: U+0041–U+005A */
{ Script_Latin, 0x41, 0x5a },
/* ASCII punctuation and symbols: U+005B–U+0060 */
- { Script_Latin_Symb, 0x5b, 0x060 },
+ { Script_Symbol, 0x5b, 0x060 },
/* Latin lowercase: U+0061–U+007A */
{ Script_Latin, 0x61, 0x7a },
/* ASCII punctuation and symbols, control char DEL: U+007B–U+007F */
- { Script_Latin_Symb, 0x7b, 0x7f },
+ { Script_Symbol, 0x7b, 0x7f },
/* C1 Controls: U+0080–U+009F */
{ Script_C1Controls, 0x80, 0x9f },
/* Latin-1 Supplement: U+00A0–U+00FF */
@@ -63,9 +66,22 @@ static const struct script_range script_ranges[] = {
/* IPA Extensions: U+0250–U+02AF */
/* Spacing Modifier Letters: U+02B0–U+02FF */
{ Script_Latin, 0xa0, 0x2ff },
+ /* Combining Diacritical Marks: U+0300–U+036F */
+ { Script_Symbol, 0x300, 0x36f },
+ /* Greek: U+0370–U+03E1 */
+ { Script_Greek, 0x370, 0x3e1 },
+ /* Coptic: U+03E2–U+03Ef */
+ { Script_Coptic, 0x3e2, 0x3ef },
+ /* Greek: U+03F0–U+03FF */
+ { Script_Greek, 0x3f0, 0x3ff },
+ /* Cyrillic: U+0400–U+04FF */
+ /* Cyrillic Supplement: U+0500–U+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+0600–U+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++;
diff --git a/dlls/dwrite/tests/analyzer.c b/dlls/dwrite/tests/analyzer.c
index d68cbcd..c610357 100644
--- a/dlls/dwrite/tests/analyzer.c
+++ b/dlls/dwrite/tests/analyzer.c
@@ -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} }
};
More information about the wine-cvs
mailing list