OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkOTTable_name.h" | 8 #include "SkOTTable_name.h" |
9 | 9 |
10 #include "SkEndian.h" | 10 #include "SkEndian.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 unsigned c2 = SkEndian_SwapBE16(*src++); | 24 unsigned c2 = SkEndian_SwapBE16(*src++); |
25 SkASSERT(SkUTF16_IsLowSurrogate(c2)); | 25 SkASSERT(SkUTF16_IsLowSurrogate(c2)); |
26 | 26 |
27 c = (c << 10) + c2 + (0x10000 - (0xD800 << 10) - 0xDC00); | 27 c = (c << 10) + c2 + (0x10000 - (0xD800 << 10) - 0xDC00); |
28 } | 28 } |
29 *srcPtr = src; | 29 *srcPtr = src; |
30 return c; | 30 return c; |
31 } | 31 } |
32 | 32 |
33 static void SkStringFromUTF16BE(const uint16_t* utf16be, size_t length, SkString
& utf8) { | 33 static void SkStringFromUTF16BE(const uint16_t* utf16be, size_t length, SkString
& utf8) { |
34 SkASSERT(utf16be != NULL); | 34 SkASSERT(utf16be != nullptr); |
35 | 35 |
36 utf8.reset(); | 36 utf8.reset(); |
37 size_t numberOf16BitValues = length / 2; | 37 size_t numberOf16BitValues = length / 2; |
38 const uint16_t* end = utf16be + numberOf16BitValues; | 38 const uint16_t* end = utf16be + numberOf16BitValues; |
39 while (utf16be < end) { | 39 while (utf16be < end) { |
40 utf8.appendUnichar(SkUTF16BE_NextUnichar(&utf16be)); | 40 utf8.appendUnichar(SkUTF16BE_NextUnichar(&utf16be)); |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 /** UnicodeFromMacRoman[macRomanPoint - 0x80] -> unicodeCodePoint. | 44 /** UnicodeFromMacRoman[macRomanPoint - 0x80] -> unicodeCodePoint. |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 BCP47FromLanguageID, SK_ARRAY_COUNT(BCP47FromLanguageID), target, sizeof
(target)); | 525 BCP47FromLanguageID, SK_ARRAY_COUNT(BCP47FromLanguageID), target, sizeof
(target)); |
526 if (languageIndex >= 0) { | 526 if (languageIndex >= 0) { |
527 record.language = BCP47FromLanguageID[languageIndex].bcp47; | 527 record.language = BCP47FromLanguageID[languageIndex].bcp47; |
528 return true; | 528 return true; |
529 } | 529 } |
530 | 530 |
531 // Unknown language, return the BCP 47 code 'und' for 'undetermined'. | 531 // Unknown language, return the BCP 47 code 'und' for 'undetermined'. |
532 record.language = "und"; | 532 record.language = "und"; |
533 return true; | 533 return true; |
534 } | 534 } |
OLD | NEW |