OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Computer, Inc. | 2 * Copyright (C) 2007 Apple Computer, Inc. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Lesser General Public License for more details. | 14 * Lesser General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Lesser General Public | 16 * You should have received a copy of the GNU Lesser General Public |
17 * License along with this library; if not, write to the Free Software | 17 * License along with this library; if not, write to the Free Software |
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 US
A | 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 * | 19 * |
20 * Alternatively, the contents of this file may be used under the terms | 20 * Alternatively, the contents of this file may be used under the terms |
21 * of either the Mozilla Public License Version 1.1, found at | 21 * of either the Mozilla Public License Version 1.1, found at |
22 * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public | 22 * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public |
23 * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html | 23 * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html |
24 * (the "GPL"), in which case the provisions of the MPL or the GPL are | 24 * (the "GPL"), in which case the provisions of the MPL or the GPL are |
25 * applicable instead of those above. If you wish to allow use of your | 25 * applicable instead of those above. If you wish to allow use of your |
26 * version of this file only under the terms of one of those two | 26 * version of this file only under the terms of one of those two |
27 * licenses (the MPL or the GPL) and not to allow others to use your | 27 * licenses (the MPL or the GPL) and not to allow others to use your |
28 * version of this file under the LGPL, indicate your decision by | 28 * version of this file under the LGPL, indicate your decision by |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 * fe20 - fe2f | 170 * fe20 - fe2f |
171 * Misc - small form variants | 171 * Misc - small form variants |
172 * fe50 - fe6f | 172 * fe50 - fe6f |
173 * Misc - Specials | 173 * Misc - Specials |
174 * fff0 - ffff | 174 * fff0 - ffff |
175 *********************************************************************/ | 175 *********************************************************************/ |
176 | 176 |
177 static const unsigned cNumSubTables = 9; | 177 static const unsigned cNumSubTables = 9; |
178 static const unsigned cSubTableSize = 16; | 178 static const unsigned cSubTableSize = 16; |
179 | 179 |
180 static const unsigned char gUnicodeSubrangeTable[cNumSubTables][cSubTableSize] =
{ | 180 static const unsigned char gUnicodeSubrangeTable[cNumSubTables][cSubTableSize] = |
181 { | 181 { |
182 // table for X--- | 182 { |
183 cRangeTableBase + 1, //u0xxx | 183 // table for X--- |
184 cRangeTableBase + 2, //u1xxx | 184 cRangeTableBase + 1, // u0xxx |
185 cRangeTableBase + 3, //u2xxx | 185 cRangeTableBase + 2, // u1xxx |
186 cRangeSetCJK, //u3xxx | 186 cRangeTableBase + 3, // u2xxx |
187 cRangeSetCJK, //u4xxx | 187 cRangeSetCJK, // u3xxx |
188 cRangeSetCJK, //u5xxx | 188 cRangeSetCJK, // u4xxx |
189 cRangeSetCJK, //u6xxx | 189 cRangeSetCJK, // u5xxx |
190 cRangeSetCJK, //u7xxx | 190 cRangeSetCJK, // u6xxx |
191 cRangeSetCJK, //u8xxx | 191 cRangeSetCJK, // u7xxx |
192 cRangeSetCJK, //u9xxx | 192 cRangeSetCJK, // u8xxx |
193 cRangeTableBase + 4, //uaxxx | 193 cRangeSetCJK, // u9xxx |
194 cRangeKorean, //ubxxx | 194 cRangeTableBase + 4, // uaxxx |
195 cRangeKorean, //ucxxx | 195 cRangeKorean, // ubxxx |
196 cRangeTableBase + 5, //udxxx | 196 cRangeKorean, // ucxxx |
197 cRangePrivate, //uexxx | 197 cRangeTableBase + 5, // udxxx |
198 cRangeTableBase + 6 //ufxxx | 198 cRangePrivate, // uexxx |
199 }, | 199 cRangeTableBase + 6 // ufxxx |
200 { | 200 }, |
201 //table for 0X-- | 201 { |
202 cRangeSetLatin, //u00xx | 202 // table for 0X-- |
203 cRangeSetLatin, //u01xx | 203 cRangeSetLatin, // u00xx |
204 cRangeSetLatin, //u02xx | 204 cRangeSetLatin, // u01xx |
205 cRangeGreek, //u03xx XXX 0300-036f is in fact cRangeCombiningDiacri
ticalMarks | 205 cRangeSetLatin, // u02xx |
206 cRangeCyrillic, //u04xx | 206 cRangeGreek, // u03xx XXX 0300-036f is in fact |
207 cRangeTableBase + | 207 // cRangeCombiningDiacriticalMarks |
208 7, //u05xx, includes Cyrillic supplement, Hebrew, and Armenian | 208 cRangeCyrillic, // u04xx |
209 cRangeArabic, //u06xx | 209 cRangeTableBase + |
210 cRangeTertiaryTable, //u07xx | 210 7, // u05xx, includes Cyrillic supplement, Hebrew, and Armenian |
211 cRangeUnassigned, //u08xx | 211 cRangeArabic, // u06xx |
212 cRangeTertiaryTable, //u09xx | 212 cRangeTertiaryTable, // u07xx |
213 cRangeTertiaryTable, //u0axx | 213 cRangeUnassigned, // u08xx |
214 cRangeTertiaryTable, //u0bxx | 214 cRangeTertiaryTable, // u09xx |
215 cRangeTertiaryTable, //u0cxx | 215 cRangeTertiaryTable, // u0axx |
216 cRangeTertiaryTable, //u0dxx | 216 cRangeTertiaryTable, // u0bxx |
217 cRangeTertiaryTable, //u0exx | 217 cRangeTertiaryTable, // u0cxx |
218 cRangeTibetan, //u0fxx | 218 cRangeTertiaryTable, // u0dxx |
219 }, | 219 cRangeTertiaryTable, // u0exx |
220 { | 220 cRangeTibetan, // u0fxx |
221 //table for 1x-- | 221 }, |
222 cRangeTertiaryTable, //u10xx | 222 { |
223 cRangeKorean, //u11xx | 223 // table for 1x-- |
224 cRangeEthiopic, //u12xx | 224 cRangeTertiaryTable, // u10xx |
225 cRangeTertiaryTable, //u13xx | 225 cRangeKorean, // u11xx |
226 cRangeCanadian, //u14xx | 226 cRangeEthiopic, // u12xx |
227 cRangeCanadian, //u15xx | 227 cRangeTertiaryTable, // u13xx |
228 cRangeTertiaryTable, //u16xx | 228 cRangeCanadian, // u14xx |
229 cRangeKhmer, //u17xx | 229 cRangeCanadian, // u15xx |
230 cRangeMongolian, //u18xx | 230 cRangeTertiaryTable, // u16xx |
231 cRangeUnassigned, //u19xx | 231 cRangeKhmer, // u17xx |
232 cRangeUnassigned, //u1axx | 232 cRangeMongolian, // u18xx |
233 cRangeUnassigned, //u1bxx | 233 cRangeUnassigned, // u19xx |
234 cRangeUnassigned, //u1cxx | 234 cRangeUnassigned, // u1axx |
235 cRangeUnassigned, //u1dxx | 235 cRangeUnassigned, // u1bxx |
236 cRangeSetLatin, //u1exx | 236 cRangeUnassigned, // u1cxx |
237 cRangeGreek, //u1fxx | 237 cRangeUnassigned, // u1dxx |
238 }, | 238 cRangeSetLatin, // u1exx |
239 { | 239 cRangeGreek, // u1fxx |
240 //table for 2x-- | 240 }, |
241 cRangeSetLatin, //u20xx | 241 { |
242 cRangeSetLatin, //u21xx | 242 // table for 2x-- |
243 cRangeMathOperators, //u22xx | 243 cRangeSetLatin, // u20xx |
244 cRangeMiscTechnical, //u23xx | 244 cRangeSetLatin, // u21xx |
245 cRangeControlOpticalEnclose, //u24xx | 245 cRangeMathOperators, // u22xx |
246 cRangeBoxBlockGeometrics, //u25xx | 246 cRangeMiscTechnical, // u23xx |
247 cRangeMiscSymbols, //u26xx | 247 cRangeControlOpticalEnclose, // u24xx |
248 cRangeDingbats, //u27xx | 248 cRangeBoxBlockGeometrics, // u25xx |
249 cRangeBraillePattern, //u28xx | 249 cRangeMiscSymbols, // u26xx |
250 cRangeUnassigned, //u29xx | 250 cRangeDingbats, // u27xx |
251 cRangeUnassigned, //u2axx | 251 cRangeBraillePattern, // u28xx |
252 cRangeUnassigned, //u2bxx | 252 cRangeUnassigned, // u29xx |
253 cRangeUnassigned, //u2cxx | 253 cRangeUnassigned, // u2axx |
254 cRangeUnassigned, //u2dxx | 254 cRangeUnassigned, // u2bxx |
255 cRangeSetCJK, //u2exx | 255 cRangeUnassigned, // u2cxx |
256 cRangeSetCJK, //u2fxx | 256 cRangeUnassigned, // u2dxx |
257 }, | 257 cRangeSetCJK, // u2exx |
258 { | 258 cRangeSetCJK, // u2fxx |
259 //table for ax-- | 259 }, |
260 cRangeYi, //ua0xx | 260 { |
261 cRangeYi, //ua1xx | 261 // table for ax-- |
262 cRangeYi, //ua2xx | 262 cRangeYi, // ua0xx |
263 cRangeYi, //ua3xx | 263 cRangeYi, // ua1xx |
264 cRangeYi, //ua4xx | 264 cRangeYi, // ua2xx |
265 cRangeUnassigned, //ua5xx | 265 cRangeYi, // ua3xx |
266 cRangeUnassigned, //ua6xx | 266 cRangeYi, // ua4xx |
267 cRangeUnassigned, //ua7xx | 267 cRangeUnassigned, // ua5xx |
268 cRangeUnassigned, //ua8xx | 268 cRangeUnassigned, // ua6xx |
269 cRangeUnassigned, //ua9xx | 269 cRangeUnassigned, // ua7xx |
270 cRangeUnassigned, //uaaxx | 270 cRangeUnassigned, // ua8xx |
271 cRangeUnassigned, //uabxx | 271 cRangeUnassigned, // ua9xx |
272 cRangeKorean, //uacxx | 272 cRangeUnassigned, // uaaxx |
273 cRangeKorean, //uadxx | 273 cRangeUnassigned, // uabxx |
274 cRangeKorean, //uaexx | 274 cRangeKorean, // uacxx |
275 cRangeKorean, //uafxx | 275 cRangeKorean, // uadxx |
276 }, | 276 cRangeKorean, // uaexx |
277 { | 277 cRangeKorean, // uafxx |
278 //table for dx-- | 278 }, |
279 cRangeKorean, //ud0xx | 279 { |
280 cRangeKorean, //ud1xx | 280 // table for dx-- |
281 cRangeKorean, //ud2xx | 281 cRangeKorean, // ud0xx |
282 cRangeKorean, //ud3xx | 282 cRangeKorean, // ud1xx |
283 cRangeKorean, //ud4xx | 283 cRangeKorean, // ud2xx |
284 cRangeKorean, //ud5xx | 284 cRangeKorean, // ud3xx |
285 cRangeKorean, //ud6xx | 285 cRangeKorean, // ud4xx |
286 cRangeKorean, //ud7xx | 286 cRangeKorean, // ud5xx |
287 cRangeSurrogate, //ud8xx | 287 cRangeKorean, // ud6xx |
288 cRangeSurrogate, //ud9xx | 288 cRangeKorean, // ud7xx |
289 cRangeSurrogate, //udaxx | 289 cRangeSurrogate, // ud8xx |
290 cRangeSurrogate, //udbxx | 290 cRangeSurrogate, // ud9xx |
291 cRangeSurrogate, //udcxx | 291 cRangeSurrogate, // udaxx |
292 cRangeSurrogate, //uddxx | 292 cRangeSurrogate, // udbxx |
293 cRangeSurrogate, //udexx | 293 cRangeSurrogate, // udcxx |
294 cRangeSurrogate, //udfxx | 294 cRangeSurrogate, // uddxx |
295 }, | 295 cRangeSurrogate, // udexx |
296 { | 296 cRangeSurrogate, // udfxx |
297 // table for fx-- | 297 }, |
298 cRangePrivate, //uf0xx | 298 { |
299 cRangePrivate, //uf1xx | 299 // table for fx-- |
300 cRangePrivate, //uf2xx | 300 cRangePrivate, // uf0xx |
301 cRangePrivate, //uf3xx | 301 cRangePrivate, // uf1xx |
302 cRangePrivate, //uf4xx | 302 cRangePrivate, // uf2xx |
303 cRangePrivate, //uf5xx | 303 cRangePrivate, // uf3xx |
304 cRangePrivate, //uf6xx | 304 cRangePrivate, // uf4xx |
305 cRangePrivate, //uf7xx | 305 cRangePrivate, // uf5xx |
306 cRangePrivate, //uf8xx | 306 cRangePrivate, // uf6xx |
307 cRangeSetCJK, //uf9xx | 307 cRangePrivate, // uf7xx |
308 cRangeSetCJK, //ufaxx | 308 cRangePrivate, // uf8xx |
309 cRangeArabic, //ufbxx, includes alphabic presentation form | 309 cRangeSetCJK, // uf9xx |
310 cRangeArabic, //ufcxx | 310 cRangeSetCJK, // ufaxx |
311 cRangeArabic, //ufdxx | 311 cRangeArabic, // ufbxx, includes alphabic presentation form |
312 cRangeArabic, //ufexx, includes Combining half marks, | 312 cRangeArabic, // ufcxx |
313 // CJK compatibility forms, | 313 cRangeArabic, // ufdxx |
314 // CJK compatibility forms, | 314 cRangeArabic, // ufexx, includes Combining half marks, |
315 // small form variants | 315 // CJK compatibility forms, |
316 cRangeTableBase + | 316 // CJK compatibility forms, |
317 8, //uffxx, halfwidth and fullwidth forms, includes Specials | 317 // small form variants |
318 }, | 318 cRangeTableBase + |
319 { | 319 8, // uffxx, halfwidth and fullwidth forms, includes Specials |
320 //table for 0x0500 - 0x05ff | 320 }, |
321 cRangeCyrillic, //u050x | 321 { |
322 cRangeCyrillic, //u051x | 322 // table for 0x0500 - 0x05ff |
323 cRangeCyrillic, //u052x | 323 cRangeCyrillic, // u050x |
324 cRangeArmenian, //u053x | 324 cRangeCyrillic, // u051x |
325 cRangeArmenian, //u054x | 325 cRangeCyrillic, // u052x |
326 cRangeArmenian, //u055x | 326 cRangeArmenian, // u053x |
327 cRangeArmenian, //u056x | 327 cRangeArmenian, // u054x |
328 cRangeArmenian, //u057x | 328 cRangeArmenian, // u055x |
329 cRangeArmenian, //u058x | 329 cRangeArmenian, // u056x |
330 cRangeHebrew, //u059x | 330 cRangeArmenian, // u057x |
331 cRangeHebrew, //u05ax | 331 cRangeArmenian, // u058x |
332 cRangeHebrew, //u05bx | 332 cRangeHebrew, // u059x |
333 cRangeHebrew, //u05cx | 333 cRangeHebrew, // u05ax |
334 cRangeHebrew, //u05dx | 334 cRangeHebrew, // u05bx |
335 cRangeHebrew, //u05ex | 335 cRangeHebrew, // u05cx |
336 cRangeHebrew, //u05fx | 336 cRangeHebrew, // u05dx |
337 }, | 337 cRangeHebrew, // u05ex |
338 { | 338 cRangeHebrew, // u05fx |
339 //table for 0xff00 - 0xffff | 339 }, |
340 cRangeSetCJK, //uff0x, fullwidth latin | 340 { |
341 cRangeSetCJK, //uff1x, fullwidth latin | 341 // table for 0xff00 - 0xffff |
342 cRangeSetCJK, //uff2x, fullwidth latin | 342 cRangeSetCJK, // uff0x, fullwidth latin |
343 cRangeSetCJK, //uff3x, fullwidth latin | 343 cRangeSetCJK, // uff1x, fullwidth latin |
344 cRangeSetCJK, //uff4x, fullwidth latin | 344 cRangeSetCJK, // uff2x, fullwidth latin |
345 cRangeSetCJK, //uff5x, fullwidth latin | 345 cRangeSetCJK, // uff3x, fullwidth latin |
346 cRangeSetCJK, //uff6x, halfwidth katakana | 346 cRangeSetCJK, // uff4x, fullwidth latin |
347 cRangeSetCJK, //uff7x, halfwidth katakana | 347 cRangeSetCJK, // uff5x, fullwidth latin |
348 cRangeSetCJK, //uff8x, halfwidth katakana | 348 cRangeSetCJK, // uff6x, halfwidth katakana |
349 cRangeSetCJK, //uff9x, halfwidth katakana | 349 cRangeSetCJK, // uff7x, halfwidth katakana |
350 cRangeSetCJK, //uffax, halfwidth hangul jamo | 350 cRangeSetCJK, // uff8x, halfwidth katakana |
351 cRangeSetCJK, //uffbx, halfwidth hangul jamo | 351 cRangeSetCJK, // uff9x, halfwidth katakana |
352 cRangeSetCJK, //uffcx, halfwidth hangul jamo | 352 cRangeSetCJK, // uffax, halfwidth hangul jamo |
353 cRangeSetCJK, //uffdx, halfwidth hangul jamo | 353 cRangeSetCJK, // uffbx, halfwidth hangul jamo |
354 cRangeSetCJK, //uffex, fullwidth symbols | 354 cRangeSetCJK, // uffcx, halfwidth hangul jamo |
355 cRangeSpecials, //ufffx, Specials | 355 cRangeSetCJK, // uffdx, halfwidth hangul jamo |
356 }, | 356 cRangeSetCJK, // uffex, fullwidth symbols |
| 357 cRangeSpecials, // ufffx, Specials |
| 358 }, |
357 }; | 359 }; |
358 | 360 |
359 // Most scripts between U+0700 and U+16FF are assigned a chunk of 128 (0x80) | 361 // Most scripts between U+0700 and U+16FF are assigned a chunk of 128 (0x80) |
360 // code points so that the number of entries in the tertiary range | 362 // code points so that the number of entries in the tertiary range |
361 // table for that range is obtained by dividing (0x1700 - 0x0700) by 128. | 363 // table for that range is obtained by dividing (0x1700 - 0x0700) by 128. |
362 // Exceptions: Ethiopic, Tibetan, Hangul Jamo and Canadian aboriginal | 364 // Exceptions: Ethiopic, Tibetan, Hangul Jamo and Canadian aboriginal |
363 // syllabaries take multiple chunks and Ogham and Runic share a single chunk. | 365 // syllabaries take multiple chunks and Ogham and Runic share a single chunk. |
364 static const unsigned cTertiaryTableSize = ((0x1700 - 0x0700) / 0x80); | 366 static const unsigned cTertiaryTableSize = ((0x1700 - 0x0700) / 0x80); |
365 | 367 |
366 static const unsigned char gUnicodeTertiaryRangeTable[cTertiaryTableSize] = { | 368 static const unsigned char gUnicodeTertiaryRangeTable[cTertiaryTableSize] = { |
367 //table for 0x0700 - 0x1600 | 369 // table for 0x0700 - 0x1600 |
368 cRangeSyriac, //u070x | 370 cRangeSyriac, // u070x |
369 cRangeThaana, //u078x | 371 cRangeThaana, // u078x |
370 cRangeUnassigned, //u080x place holder(resolved in the 2ndary tab.) | 372 cRangeUnassigned, // u080x place holder(resolved in the 2ndary tab.) |
371 cRangeUnassigned, //u088x place holder(resolved in the 2ndary tab.) | 373 cRangeUnassigned, // u088x place holder(resolved in the 2ndary tab.) |
372 cRangeDevanagari, //u090x | 374 cRangeDevanagari, // u090x |
373 cRangeBengali, //u098x | 375 cRangeBengali, // u098x |
374 cRangeGurmukhi, //u0a0x | 376 cRangeGurmukhi, // u0a0x |
375 cRangeGujarati, //u0a8x | 377 cRangeGujarati, // u0a8x |
376 cRangeOriya, //u0b0x | 378 cRangeOriya, // u0b0x |
377 cRangeTamil, //u0b8x | 379 cRangeTamil, // u0b8x |
378 cRangeTelugu, //u0c0x | 380 cRangeTelugu, // u0c0x |
379 cRangeKannada, //u0c8x | 381 cRangeKannada, // u0c8x |
380 cRangeMalayalam, //u0d0x | 382 cRangeMalayalam, // u0d0x |
381 cRangeSinhala, //u0d8x | 383 cRangeSinhala, // u0d8x |
382 cRangeThai, //u0e0x | 384 cRangeThai, // u0e0x |
383 cRangeLao, //u0e8x | 385 cRangeLao, // u0e8x |
384 cRangeTibetan, //u0f0x place holder(resolved in the 2ndary tab.) | 386 cRangeTibetan, // u0f0x place holder(resolved in the 2ndary tab.) |
385 cRangeTibetan, //u0f8x place holder(resolved in the 2ndary tab.) | 387 cRangeTibetan, // u0f8x place holder(resolved in the 2ndary tab.) |
386 cRangeMyanmar, //u100x | 388 cRangeMyanmar, // u100x |
387 cRangeGeorgian, //u108x | 389 cRangeGeorgian, // u108x |
388 cRangeKorean, //u110x place holder(resolved in the 2ndary tab.) | 390 cRangeKorean, // u110x place holder(resolved in the 2ndary tab.) |
389 cRangeKorean, //u118x place holder(resolved in the 2ndary tab.) | 391 cRangeKorean, // u118x place holder(resolved in the 2ndary tab.) |
390 cRangeEthiopic, //u120x place holder(resolved in the 2ndary tab.) | 392 cRangeEthiopic, // u120x place holder(resolved in the 2ndary tab.) |
391 cRangeEthiopic, //u128x place holder(resolved in the 2ndary tab.) | 393 cRangeEthiopic, // u128x place holder(resolved in the 2ndary tab.) |
392 cRangeEthiopic, //u130x | 394 cRangeEthiopic, // u130x |
393 cRangeCherokee, //u138x | 395 cRangeCherokee, // u138x |
394 cRangeCanadian, //u140x place holder(resolved in the 2ndary tab.) | 396 cRangeCanadian, // u140x place holder(resolved in the 2ndary tab.) |
395 cRangeCanadian, //u148x place holder(resolved in the 2ndary tab.) | 397 cRangeCanadian, // u148x place holder(resolved in the 2ndary tab.) |
396 cRangeCanadian, //u150x place holder(resolved in the 2ndary tab.) | 398 cRangeCanadian, // u150x place holder(resolved in the 2ndary tab.) |
397 cRangeCanadian, //u158x place holder(resolved in the 2ndary tab.) | 399 cRangeCanadian, // u158x place holder(resolved in the 2ndary tab.) |
398 cRangeCanadian, //u160x | 400 cRangeCanadian, // u160x |
399 cRangeOghamRunic, //u168x this contains two scripts, Ogham & Runic | 401 cRangeOghamRunic, // u168x this contains two scripts, Ogham & Runic |
400 }; | 402 }; |
401 | 403 |
402 // A two level index is almost enough for locating a range, with the | 404 // A two level index is almost enough for locating a range, with the |
403 // exception of u03xx and u05xx. Since we don't really care about range for | 405 // exception of u03xx and u05xx. Since we don't really care about range for |
404 // combining diacritical marks in our font application, they are | 406 // combining diacritical marks in our font application, they are |
405 // not discriminated further. Future adoption of this method for other use | 407 // not discriminated further. Future adoption of this method for other use |
406 // should be aware of this limitation. The implementation can be extended if | 408 // should be aware of this limitation. The implementation can be extended if |
407 // there is such a need. | 409 // there is such a need. |
408 // For Indic, Southeast Asian scripts and some other scripts between | 410 // For Indic, Southeast Asian scripts and some other scripts between |
409 // U+0700 and U+16FF, it's extended to the third level. | 411 // U+0700 and U+16FF, it's extended to the third level. |
410 unsigned findCharUnicodeRange(UChar32 ch) { | 412 unsigned findCharUnicodeRange(UChar32 ch) { |
411 if (ch >= 0xFFFF) | 413 if (ch >= 0xFFFF) |
412 return 0; | 414 return 0; |
413 | 415 |
414 unsigned range; | 416 unsigned range; |
415 | 417 |
416 //search the first table | 418 // search the first table |
417 range = gUnicodeSubrangeTable[0][ch >> 12]; | 419 range = gUnicodeSubrangeTable[0][ch >> 12]; |
418 | 420 |
419 if (range < cRangeTableBase) | 421 if (range < cRangeTableBase) |
420 // we try to get a specific range | 422 // we try to get a specific range |
421 return range; | 423 return range; |
422 | 424 |
423 // otherwise, we have one more table to look at | 425 // otherwise, we have one more table to look at |
424 range = gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x0f00) >> 8]; | 426 range = gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x0f00) >> 8]; |
425 if (range < cRangeTableBase) | 427 if (range < cRangeTableBase) |
426 return range; | 428 return range; |
427 if (range < cRangeTertiaryTable) | 429 if (range < cRangeTertiaryTable) |
428 return gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x00f0) >> 4]; | 430 return gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x00f0) >> 4]; |
429 | 431 |
430 // Yet another table to look at : U+0700 - U+16FF : 128 code point blocks | 432 // Yet another table to look at : U+0700 - U+16FF : 128 code point blocks |
431 return gUnicodeTertiaryRangeTable[(ch - 0x0700) >> 7]; | 433 return gUnicodeTertiaryRangeTable[(ch - 0x0700) >> 7]; |
432 } | 434 } |
433 | 435 |
434 } // namespace blink | 436 } // namespace blink |
OLD | NEW |