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