]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/IndicClassTables.cpp
ICU-6.2.9.tar.gz
[apple/icu.git] / icuSources / layout / IndicClassTables.cpp
CommitLineData
b75a7d8f 1/*
b75a7d8f 2 *
374ca955 3 * (C) Copyright IBM Corp. 1998-2004 - 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
13U_NAMESPACE_BEGIN
14
15#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
16
17enum
18{
19 // Split matra table indices
20 _x1 = 1 << IndicClassTable::CF_INDEX_SHIFT,
21 _x2 = 2 << IndicClassTable::CF_INDEX_SHIFT,
22 _x3 = 3 << IndicClassTable::CF_INDEX_SHIFT,
23 _x4 = 4 << IndicClassTable::CF_INDEX_SHIFT,
24 _x5 = 5 << IndicClassTable::CF_INDEX_SHIFT,
25 _x6 = 6 << IndicClassTable::CF_INDEX_SHIFT,
26 _x7 = 7 << IndicClassTable::CF_INDEX_SHIFT,
27 _x8 = 8 << IndicClassTable::CF_INDEX_SHIFT,
28 _x9 = 9 << IndicClassTable::CF_INDEX_SHIFT,
29
30 // simple classes
31 _xx = IndicClassTable::CC_RESERVED,
374ca955
A
32 _ma = IndicClassTable::CC_VOWEL_MODIFIER | IndicClassTable::CF_POS_ABOVE,
33 _mp = IndicClassTable::CC_VOWEL_MODIFIER | IndicClassTable::CF_POS_AFTER,
34 _sa = IndicClassTable::CC_STRESS_MARK | IndicClassTable::CF_POS_ABOVE,
35 _sb = IndicClassTable::CC_STRESS_MARK | IndicClassTable::CF_POS_BELOW,
b75a7d8f 36 _iv = IndicClassTable::CC_INDEPENDENT_VOWEL,
374ca955 37 _i2 = IndicClassTable::CC_INDEPENDENT_VOWEL_2,
b75a7d8f
A
38 _ct = IndicClassTable::CC_CONSONANT | IndicClassTable::CF_CONSONANT,
39 _cn = IndicClassTable::CC_CONSONANT_WITH_NUKTA | IndicClassTable::CF_CONSONANT,
40 _nu = IndicClassTable::CC_NUKTA,
41 _dv = IndicClassTable::CC_DEPENDENT_VOWEL,
374ca955
A
42 _dl = _dv | IndicClassTable::CF_POS_BEFORE,
43 _db = _dv | IndicClassTable::CF_POS_BELOW,
44 _da = _dv | IndicClassTable::CF_POS_ABOVE,
45 _dr = _dv | IndicClassTable::CF_POS_AFTER,
b75a7d8f 46 _lm = _dv | IndicClassTable::CF_LENGTH_MARK,
374ca955
A
47 _l1 = IndicClassTable::CC_SPLIT_VOWEL_PIECE_1 | IndicClassTable::CF_POS_BEFORE,
48 _a1 = IndicClassTable::CC_SPLIT_VOWEL_PIECE_1 | IndicClassTable::CF_POS_ABOVE,
49 _r2 = IndicClassTable::CC_SPLIT_VOWEL_PIECE_2 | IndicClassTable::CF_POS_AFTER,
50 _m2 = IndicClassTable::CC_SPLIT_VOWEL_PIECE_2 | IndicClassTable::CF_LENGTH_MARK,
51 _m3 = IndicClassTable::CC_SPLIT_VOWEL_PIECE_3 | IndicClassTable::CF_LENGTH_MARK,
b75a7d8f
A
52 _vr = IndicClassTable::CC_VIRAMA,
53
54 // split matras
55 _s1 = _dv | _x1,
56 _s2 = _dv | _x2,
57 _s3 = _dv | _x3,
58 _s4 = _dv | _x4,
59 _s5 = _dv | _x5,
60 _s6 = _dv | _x6,
61 _s7 = _dv | _x7,
62 _s8 = _dv | _x8,
63 _s9 = _dv | _x9,
64
65 // consonants with special forms
66 // NOTE: this assumes that no consonants with nukta have
67 // special forms... (Bengali RA?)
68 _bb = _ct | IndicClassTable::CF_BELOW_BASE,
69 _pb = _ct | IndicClassTable::CF_POST_BASE,
70 _vt = _bb | IndicClassTable::CF_VATTU,
71 _rv = _vt | IndicClassTable::CF_REPH,
72 _rp = _pb | IndicClassTable::CF_REPH,
73 _rb = _bb | IndicClassTable::CF_REPH
74};
75
76//
77// Character class tables
78//
79static const IndicClassTable::CharClass devaCharClasses[] =
80{
374ca955 81 _xx, _ma, _ma, _mp, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, // 0900 - 090F
b75a7d8f
A
82 _iv, _iv, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0910 - 091F
83 _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _cn, _ct, _ct, _ct, _ct, _ct, _ct, // 0920 - 092F
374ca955 84 _rv, _cn, _ct, _ct, _cn, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, // 0930 - 093F
b75a7d8f 85 _dr, _db, _db, _db, _db, _da, _da, _da, _da, _dr, _dr, _dr, _dr, _vr, _xx, _xx, // 0940 - 094F
374ca955 86 _xx, _sa, _sb, _sa, _sa, _xx, _xx, _xx, _cn, _cn, _cn, _cn, _cn, _cn, _cn, _cn, // 0950 - 095F
b75a7d8f
A
87 _iv, _iv, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0960 - 096F
88 _xx // 0970
89};
90
91static const IndicClassTable::CharClass bengCharClasses[] =
92{
374ca955 93 _xx, _ma, _mp, _mp, _xx, _i2, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _i2, // 0980 - 098F
b75a7d8f
A
94 _iv, _xx, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0990 - 099F
95 _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _bb, _ct, _ct, _pb, // 09A0 - 09AF
374ca955
A
96 _rv, _xx, _ct, _xx, _xx, _xx, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _r2, _dl, // 09B0 - 09BF
97 _dr, _db, _db, _db, _db, _xx, _xx, _l1, _dl, _xx, _xx, _s1, _s2, _vr, _xx, _xx, // 09C0 - 09CF
98 _xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _cn, // 09D0 - 09DF
b75a7d8f
A
99 _iv, _iv, _dv, _dv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 09E0 - 09EF
100 _ct, _ct, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 09F0 - 09FA
101};
102
103static const IndicClassTable::CharClass punjCharClasses[] =
104{
374ca955 105 _xx, _ma, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _xx, _iv, // 0A00 - 0A0F
b75a7d8f
A
106 _iv, _xx, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0A10 - 0A1F
107 _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _bb, // 0A20 - 0A2F
108 _vt, _xx, _ct, _ct, _xx, _bb, _ct, _xx, _ct, _bb, _xx, _xx, _nu, _xx, _dr, _dl, // 0A30 - 0A3F
109 _dr, _db, _db, _xx, _xx, _xx, _xx, _da, _da, _xx, _xx, _da, _da, _vr, _xx, _xx, // 0A40 - 0A4F
110 _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _cn, _cn, _cn, _cn, _xx, _cn, _xx, // 0A50 - 0A5F
111 _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0A60 - 0A6F
112 _ma, _ma, _ct, _ct, _xx // 0A70 - 0A74
113};
114
115static const IndicClassTable::CharClass gujrCharClasses[] =
116{
117 _xx, _ma, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _xx, _iv, // 0A80 - 0A8F
118 _iv, _iv, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0A90 - 0A9F
119 _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _ct, // 0AA0 - 0AAF
120 _rv, _xx, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, // 0AB0 - 0ABF
121 _dr, _db, _db, _db, _db, _da, _xx, _da, _da, _dr, _xx, _dr, _dr, _vr, _xx, _xx, // 0AC0 - 0ACF
122 _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0AD0 - 0ADF
123 _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0AE0 - 0AEF
124};
125
126static const IndicClassTable::CharClass oryaCharClasses[] =
127{
128 _xx, _ma, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _iv, // 0B00 - 0B0F
129 _iv, _xx, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0B10 - 0B1F
130 _ct, _ct, _ct, _ct, _bb, _ct, _ct, _ct, _bb, _xx, _ct, _ct, _bb, _bb, _bb, _pb, // 0B20 - 0B2F
374ca955
A
131 _rv, _xx, _bb, _bb, _xx, _xx, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _r2, _da, // 0B30 - 0B3F
132 _dr, _db, _db, _db, _xx, _xx, _xx, _l1, _s1, _xx, _xx, _s2, _s3, _vr, _xx, _xx, // 0B40 - 0B4F
133 _xx, _xx, _xx, _xx, _xx, _xx, _m2, _m2, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _cn, // 0B50 - 0B5F
b75a7d8f
A
134 _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0B60 - 0B6F
135 _xx // 0B70
136};
137
138static const IndicClassTable::CharClass tamlCharClasses[] =
139{
140 _xx, _xx, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _iv, _iv, // 0B80 - 0B8F
141 _iv, _xx, _iv, _iv, _iv, _ct, _xx, _xx, _xx, _ct, _ct, _xx, _ct, _xx, _ct, _ct, // 0B90 - 0B9F
142 _xx, _xx, _xx, _ct, _ct, _xx, _xx, _xx, _ct, _ct, _ct, _xx, _xx, _xx, _ct, _ct, // 0BA0 - 0BAF
374ca955
A
143 _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0BB0 - 0BBF
144 _da, _dr, _dr, _xx, _xx, _xx, _l1, _l1, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, // 0BC0 - 0BCF
145 _xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0BD0 - 0BDF
b75a7d8f
A
146 _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0BE0 - 0BEF
147 _xx, _xx, _xx // 0BF0 - 0BF2
148};
149
150// FIXME: Should some of the bb's be pb's? (KA, NA, MA, YA, VA, etc. (approx 13))
151static const IndicClassTable::CharClass teluCharClasses[] =
152{
153 _xx, _mp, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0C00 - 0C0F
154 _iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, // 0C10 - 0C1F
155 _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, // 0C20 - 0C2F
156 _bb, _ct, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _da, _da, // 0C30 - 0C3F
374ca955
A
157 _da, _dr, _dr, _dr, _dr, _xx, _a1, _da, _s1, _xx, _da, _da, _da, _vr, _xx, _xx, // 0C40 - 0C4F
158 _xx, _xx, _xx, _xx, _xx, _da, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0C50 - 0C5F
b75a7d8f
A
159 _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0C60 - 0C6F
160};
161
374ca955
A
162// U+CC3 and U+CC4 are _lm here not _dr since the Kannada rendering
163// rules want them below and to the right of the entire cluster
164//
165// There's some information about this in:
166//
167// http://brahmi.sourceforge.net/docs/KannadaComputing.html
b75a7d8f
A
168static const IndicClassTable::CharClass kndaCharClasses[] =
169{
170 _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, // 0C80 - 0C8F
171 _iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, // 0C90 - 0C9F
172 _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, // 0CA0 - 0CAF
173 _rb, _ct, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _dr, _da, // 0CB0 - 0CBF
374ca955
A
174 _s1, _dr, _r2, _lm, _lm, _xx, _a1, _s2, _s3, _xx, _s4, _s5, _da, _vr, _xx, _xx, // 0CC0 - 0CCF
175 _xx, _xx, _xx, _xx, _xx, _m3, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _ct, _xx, // 0CD0 - 0CDF
b75a7d8f
A
176 _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0CE0 - 0CEF
177};
178
179// FIXME: this is correct for old-style Malayalam (MAL) but not for reformed Malayalam (MLR)
180// FIXME: should there be a REPH for old-style Malayalam?
181static const IndicClassTable::CharClass mlymCharClasses[] =
182{
183 _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0D00 - 0D0F
184 _iv, _xx, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _bb, // 0D10 - 0D1F
374ca955
A
185 _ct, _ct, _ct, _bb, _ct, _bb, _bb, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _pb, // 0D20 - 0D2F
186 _pb, _cn, _bb, _ct, _ct, _pb, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0D30 - 0D3F
187 _dr, _dr, _dr, _dr, _xx, _xx, _l1, _l1, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, // 0D40 - 0D4F
188 _xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0D50 - 0D5F
b75a7d8f
A
189 _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0D60 - 0D6F
190};
191
192//
193// Split matra tables
194//
195static const SplitMatra bengSplitTable[] = {{0x09C7, 0x09BE}, {0x09C7, 0x09D7}};
196
197static const SplitMatra oryaSplitTable[] = {{0x0B47, 0x0B56}, {0x0B47, 0x0B3E}, {0x0B47, 0x0B57}};
198
199static const SplitMatra tamlSplitTable[] = {{0x0BC6, 0x0BBE}, {0x0BC7, 0x0BBE}, {0x0BC6, 0x0BD7}};
200
201static const SplitMatra teluSplitTable[] = {{0x0C46, 0x0C56}};
202
203static const SplitMatra kndaSplitTable[] = {{0x0CBF, 0x0CD5}, {0x0CC6, 0x0CD5}, {0x0CC6, 0x0CD6}, {0x0CC6, 0x0CC2},
204 {0x0CC6, 0x0CC2, 0x0CD5}};
205
206static const SplitMatra mlymSplitTable[] = {{0x0D46, 0x0D3E}, {0x0D47, 0x0D3E}, {0x0D46, 0x0D57}};
207
208//
209// Script Flags
210//
211
212// FIXME: post 'GSUB' reordering of MATRA_PRE's for Malayalam and Tamil
213// FIXME: reformed Malayalam needs to reorder VATTU to before base glyph...
214// FIXME: eyelash RA only for Devanagari??
215#define DEVA_SCRIPT_FLAGS (IndicClassTable::SF_EYELASH_RA | IndicClassTable::SF_NO_POST_BASE_LIMIT)
216#define BENG_SCRIPT_FLAGS (IndicClassTable::SF_REPH_AFTER_BELOW | IndicClassTable::SF_NO_POST_BASE_LIMIT)
217#define PUNJ_SCRIPT_FLAGS (IndicClassTable::SF_NO_POST_BASE_LIMIT)
218#define GUJR_SCRIPT_FLAGS (IndicClassTable::SF_NO_POST_BASE_LIMIT)
219#define ORYA_SCRIPT_FLAGS (IndicClassTable::SF_REPH_AFTER_BELOW | IndicClassTable::SF_NO_POST_BASE_LIMIT)
220#define TAML_SCRIPT_FLAGS (IndicClassTable::SF_MPRE_FIXUP | IndicClassTable::SF_NO_POST_BASE_LIMIT)
221#define TELU_SCRIPT_FLAGS (IndicClassTable::SF_MATRAS_AFTER_BASE | 3)
222#define KNDA_SCRIPT_FLAGS (IndicClassTable::SF_MATRAS_AFTER_BASE | 3)
223#define MLYM_SCRIPT_FLAGS (IndicClassTable::SF_MPRE_FIXUP | IndicClassTable::SF_NO_POST_BASE_LIMIT)
224
225//
226// Indic Class Tables
227//
228static const IndicClassTable devaClassTable = {0x0900, 0x0970, 2, DEVA_SCRIPT_FLAGS, devaCharClasses, NULL};
229
230static const IndicClassTable bengClassTable = {0x0980, 0x09FA, 3, BENG_SCRIPT_FLAGS, bengCharClasses, bengSplitTable};
231
232static const IndicClassTable punjClassTable = {0x0A00, 0x0A74, 2, PUNJ_SCRIPT_FLAGS, punjCharClasses, NULL};
233
234static const IndicClassTable gujrClassTable = {0x0A80, 0x0AEF, 2, GUJR_SCRIPT_FLAGS, gujrCharClasses, NULL};
235
236static const IndicClassTable oryaClassTable = {0x0B00, 0x0B70, 3, ORYA_SCRIPT_FLAGS, oryaCharClasses, oryaSplitTable};
237
238static const IndicClassTable tamlClassTable = {0x0B80, 0x0BF2, 3, TAML_SCRIPT_FLAGS, tamlCharClasses, tamlSplitTable};
239
240static const IndicClassTable teluClassTable = {0x0C00, 0x0C6F, 3, TELU_SCRIPT_FLAGS, teluCharClasses, teluSplitTable};
241
242static const IndicClassTable kndaClassTable = {0x0C80, 0x0CEF, 4, KNDA_SCRIPT_FLAGS, kndaCharClasses, kndaSplitTable};
243
244static const IndicClassTable mlymClassTable = {0x0D00, 0x0D6F, 3, MLYM_SCRIPT_FLAGS, mlymCharClasses, mlymSplitTable};
245
246//
247// IndicClassTable addresses
248//
374ca955 249static const IndicClassTable * const indicClassTables[] = {
b75a7d8f
A
250 NULL, /* 'zyyy' (COMMON) */
251 NULL, /* 'qaai' (INHERITED) */
252 NULL, /* 'arab' (ARABIC) */
253 NULL, /* 'armn' (ARMENIAN) */
254 &bengClassTable, /* 'beng' (BENGALI) */
255 NULL, /* 'bopo' (BOPOMOFO) */
256 NULL, /* 'cher' (CHEROKEE) */
257 NULL, /* 'qaac' (COPTIC) */
258 NULL, /* 'cyrl' (CYRILLIC) */
259 NULL, /* 'dsrt' (DESERET) */
260 &devaClassTable, /* 'deva' (DEVANAGARI) */
261 NULL, /* 'ethi' (ETHIOPIC) */
262 NULL, /* 'geor' (GEORGIAN) */
263 NULL, /* 'goth' (GOTHIC) */
264 NULL, /* 'grek' (GREEK) */
265 &gujrClassTable, /* 'gujr' (GUJARATI) */
266 &punjClassTable, /* 'guru' (GURMUKHI) */
267 NULL, /* 'hani' (HAN) */
268 NULL, /* 'hang' (HANGUL) */
269 NULL, /* 'hebr' (HEBREW) */
270 NULL, /* 'hira' (HIRAGANA) */
271 &kndaClassTable, /* 'knda' (KANNADA) */
272 NULL, /* 'kata' (KATAKANA) */
273 NULL, /* 'khmr' (KHMER) */
274 NULL, /* 'laoo' (LAO) */
275 NULL, /* 'latn' (LATIN) */
276 &mlymClassTable, /* 'mlym' (MALAYALAM) */
277 NULL, /* 'mong' (MONGOLIAN) */
278 NULL, /* 'mymr' (MYANMAR) */
279 NULL, /* 'ogam' (OGHAM) */
280 NULL, /* 'ital' (OLD-ITALIC) */
281 &oryaClassTable, /* 'orya' (ORIYA) */
282 NULL, /* 'runr' (RUNIC) */
283 NULL, /* 'sinh' (SINHALA) */
284 NULL, /* 'syrc' (SYRIAC) */
285 &tamlClassTable, /* 'taml' (TAMIL) */
286 &teluClassTable, /* 'telu' (TELUGU) */
287 NULL, /* 'thaa' (THAANA) */
288 NULL, /* 'thai' (THAI) */
289 NULL, /* 'tibt' (TIBETAN) */
290 NULL, /* 'cans' (CANADIAN-ABORIGINAL) */
291 NULL, /* 'yiii' (YI) */
292 NULL, /* 'tglg' (TAGALOG) */
293 NULL, /* 'hano' (HANUNOO) */
294 NULL, /* 'buhd' (BUHID) */
295 NULL, /* 'tagb' (TAGBANWA) */
296 NULL, /* 'brai' (BRAILLE) */
297 NULL, /* 'cprt' (CYPRIOT) */
298 NULL, /* 'limb' (LIMBU) */
299 NULL, /* 'linb' (LINEAR_B) */
300 NULL, /* 'osma' (OSMANYA) */
301 NULL, /* 'shaw' (SHAVIAN) */
302 NULL, /* 'tale' (TAI_LE) */
374ca955
A
303 NULL, /* 'ugar' (UGARITIC) */
304 NULL /* 'hrkt' (KATAKANA_OR_HIRAGANA) */
b75a7d8f
A
305};
306
307IndicClassTable::CharClass IndicClassTable::getCharClass(LEUnicode ch) const
308{
309 if (ch == C_SIGN_ZWJ) {
310 return CF_CONSONANT | CC_ZERO_WIDTH_MARK;
311 }
312
313 if (ch == C_SIGN_ZWNJ) {
314 return CC_ZERO_WIDTH_MARK;
315 }
316
317 if (ch < firstChar || ch > lastChar) {
318 return CC_RESERVED;
319 }
320
321 return classTable[ch - firstChar];
322}
323
324const IndicClassTable *IndicClassTable::getScriptClassTable(le_int32 scriptCode)
325{
326 if (scriptCode < 0 || scriptCode >= scriptCodeCount) {
327 return NULL;
328 }
329
330 return indicClassTables[scriptCode];
331}
332
333le_int32 IndicReordering::getWorstCaseExpansion(le_int32 scriptCode)
334{
335 const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
336
337 if (classTable == NULL) {
338 return 1;
339 }
340
341 return classTable->getWorstCaseExpansion();
342}
343
344U_NAMESPACE_END