2 using System.Globalization;
5 namespace Mono.Globalization.Unicode
8 // Represents a text element that consists of either contraction or
10 internal class TextElementSequence
12 public readonly char [] Sources;
13 public readonly byte [] SortKey;
15 public TextElementSequence (char [] sources, byte [] sortkey)
17 Sources = new char [sources.Length];
18 Array.Copy (sources, Sources, sources.Length);
20 SortKey = new byte [sortkey.Length];
21 Array.Copy (sortkey, SortKey, sortkey.Length);
25 internal /*static*/ class MSCompatUnicodeTableUtil
27 public static readonly CodePointIndexer Ignorable;
28 public static readonly CodePointIndexer Category;
29 public static readonly CodePointIndexer Level1;
30 public static readonly CodePointIndexer Level2;
31 public static readonly CodePointIndexer Level3;
32 public static readonly CodePointIndexer WidthCompat;
33 public static readonly CodePointIndexer CjkCHS;
34 public static readonly CodePointIndexer Cjk;
36 static MSCompatUnicodeTableUtil ()
38 // FIXME: those ranges could be more compact, but since
39 // I haven't filled all the table yet, I keep it safer.
40 int [] ignoreStarts = new int [] {
42 int [] ignoreEnds = new int [] {
43 0x3400, 0xA500, 0x10000};
44 int [] catStarts = new int [] {
45 0, 0x1E00, 0x3000, 0x4E00, 0xAC00, 0xF900};
46 int [] catEnds = new int [] {
47 0x1200, 0x2800, 0x3400, 0xA000, 0xD7B0, 0x10000};
48 int [] lv1Starts = new int [] {
49 0, 0x1E00, 0x3000, 0x4E00, 0xAC00, 0xF900};
50 int [] lv1Ends = new int [] {
51 0x1200, 0x2800, 0x3400, 0xA000, 0xD7B0, 0x10000};
52 int [] lv2Starts = new int [] {0, 0x1E00, 0x3000, 0xFB00};
53 int [] lv2Ends = new int [] {0xF00, 0x2800, 0x3400, 0x10000};
54 int [] lv3Starts = new int [] {0, 0x1E00, 0x3000, 0xFB00};
55 int [] lv3Ends = new int [] {0x1200, 0x2800, 0x3400, 0x10000};
56 int [] widthStarts = new int [] {0, 0x2000, 0x3100, 0xFF00};
57 int [] widthEnds = new int [] {0x300, 0x2200, 0x3200, 0x10000};
58 int [] chsStarts = new int [] {
59 0x3100, 0x4E00, 0xE800}; // FIXME: really?
60 int [] chsEnds = new int [] {
61 0x3400, 0xA000, 0x10000};
62 int [] cjkStarts = new int [] {0x3100, 0x4E00, 0xF900};
63 int [] cjkEnds = new int [] {0x3400, 0xA000, 0xFB00};
65 Ignorable = new CodePointIndexer (ignoreStarts, ignoreEnds, -1, -1);
66 Category = new CodePointIndexer (catStarts, catEnds, 0, 0);
67 Level1 = new CodePointIndexer (lv1Starts, lv1Ends, 0, 0);
68 Level2 = new CodePointIndexer (lv2Starts, lv2Ends, 0, 0);
69 Level3 = new CodePointIndexer (lv3Starts, lv3Ends, 0, 0);
70 WidthCompat = new CodePointIndexer (widthStarts, widthEnds, 0, 0);
71 CjkCHS = new CodePointIndexer (chsStarts, chsEnds, -1, -1);
72 Cjk = new CodePointIndexer (cjkStarts, cjkEnds, -1, -1);