]>
Commit | Line | Data |
---|---|---|
b75a7d8f | 1 | /* |
b75a7d8f | 2 | * |
73c04bcf | 3 | * (C) Copyright IBM Corp. 1998-2006 - All Rights Reserved |
b75a7d8f A |
4 | * |
5 | */ | |
6 | ||
7 | #include "LETypes.h" | |
8 | #include "LEScripts.h" | |
9 | #include "OpenTypeTables.h" | |
10 | #include "OpenTypeUtilities.h" | |
11 | #include "IndicReordering.h" | |
12 | ||
13 | U_NAMESPACE_BEGIN | |
14 | ||
73c04bcf A |
15 | // Split matra table indices |
16 | #define _x1 (1 << CF_INDEX_SHIFT) | |
17 | #define _x2 (2 << CF_INDEX_SHIFT) | |
18 | #define _x3 (3 << CF_INDEX_SHIFT) | |
19 | #define _x4 (4 << CF_INDEX_SHIFT) | |
20 | #define _x5 (5 << CF_INDEX_SHIFT) | |
21 | #define _x6 (6 << CF_INDEX_SHIFT) | |
22 | #define _x7 (7 << CF_INDEX_SHIFT) | |
23 | #define _x8 (8 << CF_INDEX_SHIFT) | |
24 | #define _x9 (9 << CF_INDEX_SHIFT) | |
25 | ||
26 | // simple classes | |
27 | #define _xx (CC_RESERVED) | |
28 | #define _ma (CC_VOWEL_MODIFIER | CF_POS_ABOVE) | |
29 | #define _mp (CC_VOWEL_MODIFIER | CF_POS_AFTER) | |
30 | #define _sa (CC_STRESS_MARK | CF_POS_ABOVE) | |
31 | #define _sb (CC_STRESS_MARK | CF_POS_BELOW) | |
32 | #define _iv (CC_INDEPENDENT_VOWEL) | |
33 | #define _i2 (CC_INDEPENDENT_VOWEL_2) | |
34 | #define _i3 (CC_INDEPENDENT_VOWEL_3) | |
35 | #define _ct (CC_CONSONANT | CF_CONSONANT) | |
36 | #define _cn (CC_CONSONANT_WITH_NUKTA | CF_CONSONANT) | |
37 | #define _nu (CC_NUKTA) | |
38 | #define _dv (CC_DEPENDENT_VOWEL) | |
39 | #define _dl (_dv | CF_POS_BEFORE) | |
40 | #define _db (_dv | CF_POS_BELOW) | |
41 | #define _da (_dv | CF_POS_ABOVE) | |
42 | #define _dr (_dv | CF_POS_AFTER) | |
43 | #define _lm (_dv | CF_LENGTH_MARK) | |
44 | #define _l1 (CC_SPLIT_VOWEL_PIECE_1 | CF_POS_BEFORE) | |
45 | #define _a1 (CC_SPLIT_VOWEL_PIECE_1 | CF_POS_ABOVE) | |
46 | #define _b2 (CC_SPLIT_VOWEL_PIECE_2 | CF_POS_BELOW) | |
47 | #define _r2 (CC_SPLIT_VOWEL_PIECE_2 | CF_POS_AFTER) | |
48 | #define _m2 (CC_SPLIT_VOWEL_PIECE_2 | CF_LENGTH_MARK) | |
49 | #define _m3 (CC_SPLIT_VOWEL_PIECE_3 | CF_LENGTH_MARK) | |
50 | #define _vr (CC_VIRAMA) | |
51 | ||
52 | // split matras | |
53 | #define _s1 (_dv | _x1) | |
54 | #define _s2 (_dv | _x2) | |
55 | #define _s3 (_dv | _x3) | |
56 | #define _s4 (_dv | _x4) | |
57 | #define _s5 (_dv | _x5) | |
58 | #define _s6 (_dv | _x6) | |
59 | #define _s7 (_dv | _x7) | |
60 | #define _s8 (_dv | _x8) | |
61 | #define _s9 (_dv | _x9) | |
62 | ||
63 | // consonants with special forms | |
64 | // NOTE: this assumes that no consonants with nukta have | |
65 | // special forms... (Bengali RA?) | |
66 | #define _bb (_ct | CF_BELOW_BASE) | |
67 | #define _pb (_ct | CF_POST_BASE) | |
68 | #define _vt (_bb | CF_VATTU) | |
69 | #define _rv (_vt | CF_REPH) | |
70 | #define _rp (_pb | CF_REPH) | |
71 | #define _rb (_bb | CF_REPH) | |
b75a7d8f A |
72 | |
73 | // | |
74 | // Character class tables | |
75 | // | |
76 | static const IndicClassTable::CharClass devaCharClasses[] = | |
77 | { | |
374ca955 | 78 | _xx, _ma, _ma, _mp, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, // 0900 - 090F |
b75a7d8f A |
79 | _iv, _iv, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0910 - 091F |
80 | _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _cn, _ct, _ct, _ct, _ct, _ct, _ct, // 0920 - 092F | |
374ca955 | 81 | _rv, _cn, _ct, _ct, _cn, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, // 0930 - 093F |
b75a7d8f | 82 | _dr, _db, _db, _db, _db, _da, _da, _da, _da, _dr, _dr, _dr, _dr, _vr, _xx, _xx, // 0940 - 094F |
374ca955 | 83 | _xx, _sa, _sb, _sa, _sa, _xx, _xx, _xx, _cn, _cn, _cn, _cn, _cn, _cn, _cn, _cn, // 0950 - 095F |
b75a7d8f A |
84 | _iv, _iv, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0960 - 096F |
85 | _xx // 0970 | |
86 | }; | |
87 | ||
88 | static const IndicClassTable::CharClass bengCharClasses[] = | |
89 | { | |
374ca955 | 90 | _xx, _ma, _mp, _mp, _xx, _i2, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _i2, // 0980 - 098F |
b75a7d8f A |
91 | _iv, _xx, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0990 - 099F |
92 | _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _bb, _ct, _ct, _pb, // 09A0 - 09AF | |
374ca955 A |
93 | _rv, _xx, _ct, _xx, _xx, _xx, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _r2, _dl, // 09B0 - 09BF |
94 | _dr, _db, _db, _db, _db, _xx, _xx, _l1, _dl, _xx, _xx, _s1, _s2, _vr, _xx, _xx, // 09C0 - 09CF | |
95 | _xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _cn, // 09D0 - 09DF | |
b75a7d8f A |
96 | _iv, _iv, _dv, _dv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 09E0 - 09EF |
97 | _ct, _ct, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 09F0 - 09FA | |
98 | }; | |
99 | ||
100 | static const IndicClassTable::CharClass punjCharClasses[] = | |
101 | { | |
374ca955 | 102 | _xx, _ma, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _xx, _iv, // 0A00 - 0A0F |
73c04bcf | 103 | _iv, _xx, _xx, _i3, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0A10 - 0A1F |
b75a7d8f | 104 | _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _bb, // 0A20 - 0A2F |
73c04bcf A |
105 | _vt, _xx, _ct, _cn, _xx, _bb, _cn, _xx, _ct, _bb, _xx, _xx, _nu, _xx, _dr, _dl, // 0A30 - 0A3F |
106 | _dr, _b2, _db, _xx, _xx, _xx, _xx, _da, _da, _xx, _xx, _a1, _da, _vr, _xx, _xx, // 0A40 - 0A4F | |
107 | _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _cn, _cn, _cn, _ct, _xx, _cn, _xx, // 0A50 - 0A5F | |
b75a7d8f | 108 | _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0A60 - 0A6F |
73c04bcf | 109 | _ma, _ma, _xx, _xx, _xx // 0A70 - 0A74 |
b75a7d8f A |
110 | }; |
111 | ||
112 | static const IndicClassTable::CharClass gujrCharClasses[] = | |
113 | { | |
114 | _xx, _ma, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _xx, _iv, // 0A80 - 0A8F | |
115 | _iv, _iv, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0A90 - 0A9F | |
116 | _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _ct, // 0AA0 - 0AAF | |
117 | _rv, _xx, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, // 0AB0 - 0ABF | |
118 | _dr, _db, _db, _db, _db, _da, _xx, _da, _da, _dr, _xx, _dr, _dr, _vr, _xx, _xx, // 0AC0 - 0ACF | |
119 | _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0AD0 - 0ADF | |
120 | _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0AE0 - 0AEF | |
121 | }; | |
122 | ||
123 | static const IndicClassTable::CharClass oryaCharClasses[] = | |
124 | { | |
73c04bcf | 125 | _xx, _ma, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _iv, // 0B00 - 0B0F |
b75a7d8f A |
126 | _iv, _xx, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0B10 - 0B1F |
127 | _ct, _ct, _ct, _ct, _bb, _ct, _ct, _ct, _bb, _xx, _ct, _ct, _bb, _bb, _bb, _pb, // 0B20 - 0B2F | |
73c04bcf | 128 | _rb, _xx, _bb, _bb, _xx, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _r2, _da, // 0B30 - 0B3F |
374ca955 A |
129 | _dr, _db, _db, _db, _xx, _xx, _xx, _l1, _s1, _xx, _xx, _s2, _s3, _vr, _xx, _xx, // 0B40 - 0B4F |
130 | _xx, _xx, _xx, _xx, _xx, _xx, _m2, _m2, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _cn, // 0B50 - 0B5F | |
b75a7d8f | 131 | _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0B60 - 0B6F |
73c04bcf | 132 | _xx, _ct // 0B70 - 0B71 |
b75a7d8f A |
133 | }; |
134 | ||
135 | static const IndicClassTable::CharClass tamlCharClasses[] = | |
136 | { | |
73c04bcf | 137 | _xx, _xx, _ma, _xx, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _iv, _iv, // 0B80 - 0B8F |
b75a7d8f A |
138 | _iv, _xx, _iv, _iv, _iv, _ct, _xx, _xx, _xx, _ct, _ct, _xx, _ct, _xx, _ct, _ct, // 0B90 - 0B9F |
139 | _xx, _xx, _xx, _ct, _ct, _xx, _xx, _xx, _ct, _ct, _ct, _xx, _xx, _xx, _ct, _ct, // 0BA0 - 0BAF | |
374ca955 A |
140 | _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0BB0 - 0BBF |
141 | _da, _dr, _dr, _xx, _xx, _xx, _l1, _l1, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, // 0BC0 - 0BCF | |
142 | _xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0BD0 - 0BDF | |
b75a7d8f A |
143 | _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0BE0 - 0BEF |
144 | _xx, _xx, _xx // 0BF0 - 0BF2 | |
145 | }; | |
146 | ||
147 | // FIXME: Should some of the bb's be pb's? (KA, NA, MA, YA, VA, etc. (approx 13)) | |
148 | static const IndicClassTable::CharClass teluCharClasses[] = | |
149 | { | |
150 | _xx, _mp, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0C00 - 0C0F | |
151 | _iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, // 0C10 - 0C1F | |
152 | _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, // 0C20 - 0C2F | |
153 | _bb, _ct, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _da, _da, // 0C30 - 0C3F | |
374ca955 A |
154 | _da, _dr, _dr, _dr, _dr, _xx, _a1, _da, _s1, _xx, _da, _da, _da, _vr, _xx, _xx, // 0C40 - 0C4F |
155 | _xx, _xx, _xx, _xx, _xx, _da, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0C50 - 0C5F | |
b75a7d8f A |
156 | _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0C60 - 0C6F |
157 | }; | |
158 | ||
374ca955 A |
159 | // U+CC3 and U+CC4 are _lm here not _dr since the Kannada rendering |
160 | // rules want them below and to the right of the entire cluster | |
161 | // | |
162 | // There's some information about this in: | |
163 | // | |
164 | // http://brahmi.sourceforge.net/docs/KannadaComputing.html | |
b75a7d8f A |
165 | static const IndicClassTable::CharClass kndaCharClasses[] = |
166 | { | |
167 | _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, // 0C80 - 0C8F | |
168 | _iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, // 0C90 - 0C9F | |
169 | _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, // 0CA0 - 0CAF | |
170 | _rb, _ct, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _dr, _da, // 0CB0 - 0CBF | |
374ca955 A |
171 | _s1, _dr, _r2, _lm, _lm, _xx, _a1, _s2, _s3, _xx, _s4, _s5, _da, _vr, _xx, _xx, // 0CC0 - 0CCF |
172 | _xx, _xx, _xx, _xx, _xx, _m3, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _ct, _xx, // 0CD0 - 0CDF | |
b75a7d8f A |
173 | _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0CE0 - 0CEF |
174 | }; | |
175 | ||
176 | // FIXME: this is correct for old-style Malayalam (MAL) but not for reformed Malayalam (MLR) | |
177 | // FIXME: should there be a REPH for old-style Malayalam? | |
178 | static const IndicClassTable::CharClass mlymCharClasses[] = | |
179 | { | |
180 | _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0D00 - 0D0F | |
181 | _iv, _xx, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _bb, // 0D10 - 0D1F | |
374ca955 A |
182 | _ct, _ct, _ct, _bb, _ct, _bb, _bb, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _pb, // 0D20 - 0D2F |
183 | _pb, _cn, _bb, _ct, _ct, _pb, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0D30 - 0D3F | |
184 | _dr, _dr, _dr, _dr, _xx, _xx, _l1, _l1, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, // 0D40 - 0D4F | |
185 | _xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0D50 - 0D5F | |
b75a7d8f A |
186 | _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0D60 - 0D6F |
187 | }; | |
73c04bcf A |
188 | |
189 | static const IndicClassTable::CharClass sinhCharClasses[] = | |
190 | { | |
191 | _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, // 0D80 - 0D8F | |
192 | _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _ct, _ct, _ct, _ct, _ct, _ct, // 0D90 - 0D9F | |
193 | _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0DA0 - 0DAF | |
194 | _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _xx, _xx, // 0DB0 - 0DBF | |
195 | _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _vr, _xx, _xx, _xx, _xx, _dr, // 0DC0 - 0DCF | |
196 | _dr, _dr, _da, _da, _db, _xx, _db, _xx, _dr, _dl, _s1, _dl, _s2, _s3, _s4, _dr, // 0DD0 - 0DDF | |
197 | _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0DE0 - 0DEF | |
198 | _xx, _xx, _dr, _dr, _xx // 0DF0 - 0DF4 | |
199 | }; | |
b75a7d8f A |
200 | |
201 | // | |
202 | // Split matra tables | |
203 | // | |
204 | static const SplitMatra bengSplitTable[] = {{0x09C7, 0x09BE}, {0x09C7, 0x09D7}}; | |
205 | ||
206 | static const SplitMatra oryaSplitTable[] = {{0x0B47, 0x0B56}, {0x0B47, 0x0B3E}, {0x0B47, 0x0B57}}; | |
207 | ||
208 | static const SplitMatra tamlSplitTable[] = {{0x0BC6, 0x0BBE}, {0x0BC7, 0x0BBE}, {0x0BC6, 0x0BD7}}; | |
209 | ||
210 | static const SplitMatra teluSplitTable[] = {{0x0C46, 0x0C56}}; | |
211 | ||
212 | static const SplitMatra kndaSplitTable[] = {{0x0CBF, 0x0CD5}, {0x0CC6, 0x0CD5}, {0x0CC6, 0x0CD6}, {0x0CC6, 0x0CC2}, | |
73c04bcf | 213 | {0x0CC6, 0x0CC2, 0x0CD5}}; |
b75a7d8f A |
214 | |
215 | static const SplitMatra mlymSplitTable[] = {{0x0D46, 0x0D3E}, {0x0D47, 0x0D3E}, {0x0D46, 0x0D57}}; | |
216 | ||
73c04bcf A |
217 | |
218 | static const SplitMatra sinhSplitTable[] = {{0x0DD9, 0x0DCA}, {0x0DD9, 0x0DCF}, {0x0DD9, 0x0DCF,0x0DCA}, | |
219 | {0x0DD9, 0x0DDF}}; | |
b75a7d8f A |
220 | // |
221 | // Script Flags | |
222 | // | |
223 | ||
224 | // FIXME: post 'GSUB' reordering of MATRA_PRE's for Malayalam and Tamil | |
225 | // FIXME: reformed Malayalam needs to reorder VATTU to before base glyph... | |
226 | // FIXME: eyelash RA only for Devanagari?? | |
73c04bcf A |
227 | #define DEVA_SCRIPT_FLAGS (SF_EYELASH_RA | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH) |
228 | #define BENG_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH) | |
229 | #define PUNJ_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH) | |
230 | #define GUJR_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH) | |
231 | #define ORYA_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH) | |
232 | #define TAML_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH) | |
233 | #define TELU_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | SF_FILTER_ZERO_WIDTH | 3) | |
234 | #define KNDA_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | SF_FILTER_ZERO_WIDTH | 3) | |
235 | #define MLYM_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH) | |
236 | #define SINH_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT) | |
b75a7d8f A |
237 | |
238 | // | |
239 | // Indic Class Tables | |
240 | // | |
241 | static const IndicClassTable devaClassTable = {0x0900, 0x0970, 2, DEVA_SCRIPT_FLAGS, devaCharClasses, NULL}; | |
242 | ||
243 | static const IndicClassTable bengClassTable = {0x0980, 0x09FA, 3, BENG_SCRIPT_FLAGS, bengCharClasses, bengSplitTable}; | |
244 | ||
245 | static const IndicClassTable punjClassTable = {0x0A00, 0x0A74, 2, PUNJ_SCRIPT_FLAGS, punjCharClasses, NULL}; | |
246 | ||
247 | static const IndicClassTable gujrClassTable = {0x0A80, 0x0AEF, 2, GUJR_SCRIPT_FLAGS, gujrCharClasses, NULL}; | |
248 | ||
73c04bcf | 249 | static const IndicClassTable oryaClassTable = {0x0B00, 0x0B71, 3, ORYA_SCRIPT_FLAGS, oryaCharClasses, oryaSplitTable}; |
b75a7d8f A |
250 | |
251 | static const IndicClassTable tamlClassTable = {0x0B80, 0x0BF2, 3, TAML_SCRIPT_FLAGS, tamlCharClasses, tamlSplitTable}; | |
252 | ||
253 | static const IndicClassTable teluClassTable = {0x0C00, 0x0C6F, 3, TELU_SCRIPT_FLAGS, teluCharClasses, teluSplitTable}; | |
254 | ||
255 | static const IndicClassTable kndaClassTable = {0x0C80, 0x0CEF, 4, KNDA_SCRIPT_FLAGS, kndaCharClasses, kndaSplitTable}; | |
256 | ||
257 | static const IndicClassTable mlymClassTable = {0x0D00, 0x0D6F, 3, MLYM_SCRIPT_FLAGS, mlymCharClasses, mlymSplitTable}; | |
258 | ||
73c04bcf A |
259 | static const IndicClassTable sinhClassTable = {0x0D80, 0x0DF4, 3, SINH_SCRIPT_FLAGS, sinhCharClasses, sinhSplitTable}; |
260 | ||
b75a7d8f A |
261 | // |
262 | // IndicClassTable addresses | |
263 | // | |
73c04bcf | 264 | static const IndicClassTable * const indicClassTables[scriptCodeCount] = { |
b75a7d8f A |
265 | NULL, /* 'zyyy' (COMMON) */ |
266 | NULL, /* 'qaai' (INHERITED) */ | |
267 | NULL, /* 'arab' (ARABIC) */ | |
268 | NULL, /* 'armn' (ARMENIAN) */ | |
269 | &bengClassTable, /* 'beng' (BENGALI) */ | |
270 | NULL, /* 'bopo' (BOPOMOFO) */ | |
271 | NULL, /* 'cher' (CHEROKEE) */ | |
73c04bcf | 272 | NULL, /* 'copt' (COPTIC) */ |
b75a7d8f A |
273 | NULL, /* 'cyrl' (CYRILLIC) */ |
274 | NULL, /* 'dsrt' (DESERET) */ | |
275 | &devaClassTable, /* 'deva' (DEVANAGARI) */ | |
276 | NULL, /* 'ethi' (ETHIOPIC) */ | |
277 | NULL, /* 'geor' (GEORGIAN) */ | |
278 | NULL, /* 'goth' (GOTHIC) */ | |
279 | NULL, /* 'grek' (GREEK) */ | |
280 | &gujrClassTable, /* 'gujr' (GUJARATI) */ | |
281 | &punjClassTable, /* 'guru' (GURMUKHI) */ | |
282 | NULL, /* 'hani' (HAN) */ | |
283 | NULL, /* 'hang' (HANGUL) */ | |
284 | NULL, /* 'hebr' (HEBREW) */ | |
285 | NULL, /* 'hira' (HIRAGANA) */ | |
286 | &kndaClassTable, /* 'knda' (KANNADA) */ | |
287 | NULL, /* 'kata' (KATAKANA) */ | |
288 | NULL, /* 'khmr' (KHMER) */ | |
289 | NULL, /* 'laoo' (LAO) */ | |
290 | NULL, /* 'latn' (LATIN) */ | |
291 | &mlymClassTable, /* 'mlym' (MALAYALAM) */ | |
292 | NULL, /* 'mong' (MONGOLIAN) */ | |
293 | NULL, /* 'mymr' (MYANMAR) */ | |
294 | NULL, /* 'ogam' (OGHAM) */ | |
295 | NULL, /* 'ital' (OLD-ITALIC) */ | |
296 | &oryaClassTable, /* 'orya' (ORIYA) */ | |
297 | NULL, /* 'runr' (RUNIC) */ | |
73c04bcf | 298 | &sinhClassTable, /* 'sinh' (SINHALA) */ |
b75a7d8f A |
299 | NULL, /* 'syrc' (SYRIAC) */ |
300 | &tamlClassTable, /* 'taml' (TAMIL) */ | |
301 | &teluClassTable, /* 'telu' (TELUGU) */ | |
302 | NULL, /* 'thaa' (THAANA) */ | |
303 | NULL, /* 'thai' (THAI) */ | |
304 | NULL, /* 'tibt' (TIBETAN) */ | |
305 | NULL, /* 'cans' (CANADIAN-ABORIGINAL) */ | |
306 | NULL, /* 'yiii' (YI) */ | |
307 | NULL, /* 'tglg' (TAGALOG) */ | |
308 | NULL, /* 'hano' (HANUNOO) */ | |
309 | NULL, /* 'buhd' (BUHID) */ | |
310 | NULL, /* 'tagb' (TAGBANWA) */ | |
311 | NULL, /* 'brai' (BRAILLE) */ | |
312 | NULL, /* 'cprt' (CYPRIOT) */ | |
313 | NULL, /* 'limb' (LIMBU) */ | |
314 | NULL, /* 'linb' (LINEAR_B) */ | |
315 | NULL, /* 'osma' (OSMANYA) */ | |
316 | NULL, /* 'shaw' (SHAVIAN) */ | |
317 | NULL, /* 'tale' (TAI_LE) */ | |
374ca955 | 318 | NULL, /* 'ugar' (UGARITIC) */ |
73c04bcf A |
319 | NULL, /* 'hrkt' (KATAKANA_OR_HIRAGANA) */ |
320 | NULL, /* 'bugi' (BUGINESE) */ | |
321 | NULL, /* 'glag' (GLAGOLITIC) */ | |
322 | NULL, /* 'khar' (KHAROSHTHI) */ | |
323 | NULL, /* 'sylo' (SYLOTI_NAGRI) */ | |
324 | NULL, /* 'talu' (NEW_TAI_LUE) */ | |
325 | NULL, /* 'tfng' (TIFINAGH) */ | |
326 | NULL, /* 'xpeo' (OLD_PERSIAN) */ | |
327 | NULL, /* 'bali' (BALINESE) */ | |
328 | NULL, /* 'batk' (BATK) */ | |
329 | NULL, /* 'blis' (BLIS) */ | |
330 | NULL, /* 'brah' (BRAH) */ | |
331 | NULL, /* 'cham' (CHAM) */ | |
332 | NULL, /* 'cirt' (CIRT) */ | |
333 | NULL, /* 'cyrs' (CYRS) */ | |
334 | NULL, /* 'egyd' (EGYD) */ | |
335 | NULL, /* 'egyh' (EGYH) */ | |
336 | NULL, /* 'egyp' (EGYP) */ | |
337 | NULL, /* 'geok' (GEOK) */ | |
338 | NULL, /* 'hans' (HANS) */ | |
339 | NULL, /* 'hant' (HANT) */ | |
340 | NULL, /* 'hmng' (HMNG) */ | |
341 | NULL, /* 'hung' (HUNG) */ | |
342 | NULL, /* 'inds' (INDS) */ | |
343 | NULL, /* 'java' (JAVA) */ | |
344 | NULL, /* 'kali' (KALI) */ | |
345 | NULL, /* 'latf' (LATF) */ | |
346 | NULL, /* 'latg' (LATG) */ | |
347 | NULL, /* 'lepc' (LEPC) */ | |
348 | NULL, /* 'lina' (LINA) */ | |
349 | NULL, /* 'mand' (MAND) */ | |
350 | NULL, /* 'maya' (MAYA) */ | |
351 | NULL, /* 'mero' (MERO) */ | |
352 | NULL, /* 'nko ' (NKO) */ | |
353 | NULL, /* 'orkh' (ORKH) */ | |
354 | NULL, /* 'perm' (PERM) */ | |
355 | NULL, /* 'phag' (PHAGS_PA) */ | |
356 | NULL, /* 'phnx' (PHOENICIAN) */ | |
357 | NULL, /* 'plrd' (PLRD) */ | |
358 | NULL, /* 'roro' (RORO) */ | |
359 | NULL, /* 'sara' (SARA) */ | |
360 | NULL, /* 'syre' (SYRE) */ | |
361 | NULL, /* 'syrj' (SYRJ) */ | |
362 | NULL, /* 'syrn' (SYRN) */ | |
363 | NULL, /* 'teng' (TENG) */ | |
364 | NULL, /* 'vai ' (VAII) */ | |
365 | NULL, /* 'visp' (VISP) */ | |
366 | NULL, /* 'xsux' (CUNEIFORM) */ | |
367 | NULL, /* 'zxxx' (ZXXX) */ | |
368 | NULL /* 'zzzz' (UNKNOWN) */ | |
b75a7d8f A |
369 | }; |
370 | ||
371 | IndicClassTable::CharClass IndicClassTable::getCharClass(LEUnicode ch) const | |
372 | { | |
373 | if (ch == C_SIGN_ZWJ) { | |
374 | return CF_CONSONANT | CC_ZERO_WIDTH_MARK; | |
375 | } | |
376 | ||
377 | if (ch == C_SIGN_ZWNJ) { | |
378 | return CC_ZERO_WIDTH_MARK; | |
379 | } | |
380 | ||
381 | if (ch < firstChar || ch > lastChar) { | |
382 | return CC_RESERVED; | |
383 | } | |
384 | ||
385 | return classTable[ch - firstChar]; | |
386 | } | |
387 | ||
388 | const IndicClassTable *IndicClassTable::getScriptClassTable(le_int32 scriptCode) | |
389 | { | |
390 | if (scriptCode < 0 || scriptCode >= scriptCodeCount) { | |
391 | return NULL; | |
392 | } | |
393 | ||
394 | return indicClassTables[scriptCode]; | |
395 | } | |
396 | ||
397 | le_int32 IndicReordering::getWorstCaseExpansion(le_int32 scriptCode) | |
398 | { | |
399 | const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode); | |
400 | ||
401 | if (classTable == NULL) { | |
402 | return 1; | |
403 | } | |
404 | ||
405 | return classTable->getWorstCaseExpansion(); | |
406 | } | |
407 | ||
73c04bcf A |
408 | le_bool IndicReordering::getFilterZeroWidth(le_int32 scriptCode) |
409 | { | |
410 | const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode); | |
411 | ||
412 | if (classTable == NULL) { | |
413 | return TRUE; | |
414 | } | |
415 | ||
416 | return classTable->getFilterZeroWidth(); | |
417 | } | |
418 | ||
b75a7d8f | 419 | U_NAMESPACE_END |