| 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 * |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 }; | 420 }; |
| 421 | 421 |
| 422 // A two level index is almost enough for locating a range, with the | 422 // A two level index is almost enough for locating a range, with the |
| 423 // exception of u03xx and u05xx. Since we don't really care about range for | 423 // exception of u03xx and u05xx. Since we don't really care about range for |
| 424 // combining diacritical marks in our font application, they are | 424 // combining diacritical marks in our font application, they are |
| 425 // not discriminated further. Future adoption of this method for other use | 425 // not discriminated further. Future adoption of this method for other use |
| 426 // should be aware of this limitation. The implementation can be extended if | 426 // should be aware of this limitation. The implementation can be extended if |
| 427 // there is such a need. | 427 // there is such a need. |
| 428 // For Indic, Southeast Asian scripts and some other scripts between | 428 // For Indic, Southeast Asian scripts and some other scripts between |
| 429 // U+0700 and U+16FF, it's extended to the third level. | 429 // U+0700 and U+16FF, it's extended to the third level. |
| 430 unsigned int findCharUnicodeRange(UChar32 ch) | 430 unsigned findCharUnicodeRange(UChar32 ch) |
| 431 { | 431 { |
| 432 if (ch >= 0xFFFF) | 432 if (ch >= 0xFFFF) |
| 433 return 0; | 433 return 0; |
| 434 | 434 |
| 435 unsigned int range; | 435 unsigned range; |
| 436 | 436 |
| 437 //search the first table | 437 //search the first table |
| 438 range = gUnicodeSubrangeTable[0][ch >> 12]; | 438 range = gUnicodeSubrangeTable[0][ch >> 12]; |
| 439 | 439 |
| 440 if (range < cRangeTableBase) | 440 if (range < cRangeTableBase) |
| 441 // we try to get a specific range | 441 // we try to get a specific range |
| 442 return range; | 442 return range; |
| 443 | 443 |
| 444 // otherwise, we have one more table to look at | 444 // otherwise, we have one more table to look at |
| 445 range = gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x0f00) >> 8]; | 445 range = gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x0f00) >> 8]; |
| 446 if (range < cRangeTableBase) | 446 if (range < cRangeTableBase) |
| 447 return range; | 447 return range; |
| 448 if (range < cRangeTertiaryTable) | 448 if (range < cRangeTertiaryTable) |
| 449 return gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x00f0) >> 4
]; | 449 return gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x00f0) >> 4
]; |
| 450 | 450 |
| 451 // Yet another table to look at : U+0700 - U+16FF : 128 code point blocks | 451 // Yet another table to look at : U+0700 - U+16FF : 128 code point blocks |
| 452 return gUnicodeTertiaryRangeTable[(ch - 0x0700) >> 7]; | 452 return gUnicodeTertiaryRangeTable[(ch - 0x0700) >> 7]; |
| 453 } | 453 } |
| 454 | 454 |
| 455 const char* langGroupFromUnicodeRange(unsigned char unicodeRange) | 455 const char* langGroupFromUnicodeRange(unsigned char unicodeRange) |
| 456 { | 456 { |
| 457 if (cRangeSpecificItemNum > unicodeRange) | 457 if (cRangeSpecificItemNum > unicodeRange) |
| 458 return gUnicodeRangeToLangGroupTable[unicodeRange]; | 458 return gUnicodeRangeToLangGroupTable[unicodeRange]; |
| 459 return 0; | 459 return 0; |
| 460 } | 460 } |
| 461 | 461 |
| 462 } | 462 } |
| OLD | NEW |