OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/fonts/Character.h" | 5 #include "platform/fonts/Character.h" |
6 | 6 |
7 #include <unicode/uniset.h> | 7 #include <unicode/uniset.h> |
8 | 8 |
9 using namespace WTF; | 9 using namespace WTF; |
10 using namespace Unicode; | 10 using namespace Unicode; |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 // The following UnicodeSet patterns were compiled from | 14 // The following UnicodeSet patterns were compiled from |
15 // http://www.unicode.org/Public/emoji/2.0//emoji-data.txt | 15 // http://www.unicode.org/Public/emoji/2.0//emoji-data.txt |
16 | 16 |
17 // FIXME crbug.com/579552: | 17 // FIXME crbug.com/579552: |
18 // These patterns should move to property group definitions in ICU. | 18 // These patterns should move to property group definitions in ICU. |
19 | 19 |
20 static const char* kEmojiTextPattern = | 20 static const char kEmojiTextPattern[] = |
21 R"([[#][*][0-9][\u00A9][\u00AE][\u203C][\u2049][\u2122][\u2139])" | 21 R"([[#][*][0-9][\u00A9][\u00AE][\u203C][\u2049][\u2122][\u2139])" |
22 R"([\u2194-\u2199][\u21A9-\u21AA][\u231A-\u231B][\u2328][\u23CF])" | 22 R"([\u2194-\u2199][\u21A9-\u21AA][\u231A-\u231B][\u2328][\u23CF])" |
23 R"([\u23E9-\u23F3][\u23F8-\u23FA][\u24C2][\u25AA-\u25AB][\u25B6][\u25C0])" | 23 R"([\u23E9-\u23F3][\u23F8-\u23FA][\u24C2][\u25AA-\u25AB][\u25B6][\u25C0])" |
24 R"([\u25FB-\u25FE][\u2600-\u2604][\u260E][\u2611][\u2614-\u2615][\u2618])" | 24 R"([\u25FB-\u25FE][\u2600-\u2604][\u260E][\u2611][\u2614-\u2615][\u2618])" |
25 R"([\u261D][\u2620][\u2622-\u2623][\u2626][\u262A][\u262E-\u262F])" | 25 R"([\u261D][\u2620][\u2622-\u2623][\u2626][\u262A][\u262E-\u262F])" |
26 R"([\u2638-\u263A][\u2648-\u2653][\u2660][\u2663][\u2665-\u2666][\u2668])" | 26 R"([\u2638-\u263A][\u2648-\u2653][\u2660][\u2663][\u2665-\u2666][\u2668])" |
27 R"([\u267B][\u267F][\u2692-\u2694][\u2696-\u2697][\u2699][\u269B-\u269C])" | 27 R"([\u267B][\u267F][\u2692-\u2694][\u2696-\u2697][\u2699][\u269B-\u269C])" |
28 R"([\u26A0-\u26A1][\u26AA-\u26AB][\u26B0-\u26B1][\u26BD-\u26BE])" | 28 R"([\u26A0-\u26A1][\u26AA-\u26AB][\u26B0-\u26B1][\u26BD-\u26BE])" |
29 R"([\u26C4-\u26C5][\u26C8][\u26CE-\u26CF][\u26D1][\u26D3-\u26D4])" | 29 R"([\u26C4-\u26C5][\u26C8][\u26CE-\u26CF][\u26D1][\u26D3-\u26D4])" |
30 R"([\u26E9-\u26EA][\u26F0-\u26F5][\u26F7-\u26FA][\u26FD][\u2702][\u2705])" | 30 R"([\u26E9-\u26EA][\u26F0-\u26F5][\u26F7-\u26FA][\u26FD][\u2702][\u2705])" |
(...skipping 10 matching lines...) Expand all Loading... |
41 R"([\U0001F4FF-\U0001F53D][\U0001F549-\U0001F54E][\U0001F550-\U0001F567])" | 41 R"([\U0001F4FF-\U0001F53D][\U0001F549-\U0001F54E][\U0001F550-\U0001F567])" |
42 R"([\U0001F56F-\U0001F570][\U0001F573-\U0001F579][\U0001F587])" | 42 R"([\U0001F56F-\U0001F570][\U0001F573-\U0001F579][\U0001F587])" |
43 R"([\U0001F58A-\U0001F58D][\U0001F590][\U0001F595-\U0001F596][\U0001F5A5])" | 43 R"([\U0001F58A-\U0001F58D][\U0001F590][\U0001F595-\U0001F596][\U0001F5A5])" |
44 R"([\U0001F5A8][\U0001F5B1-\U0001F5B2][\U0001F5BC][\U0001F5C2-\U0001F5C4])" | 44 R"([\U0001F5A8][\U0001F5B1-\U0001F5B2][\U0001F5BC][\U0001F5C2-\U0001F5C4])" |
45 R"([\U0001F5D1-\U0001F5D3][\U0001F5DC-\U0001F5DE][\U0001F5E1][\U0001F5E3])" | 45 R"([\U0001F5D1-\U0001F5D3][\U0001F5DC-\U0001F5DE][\U0001F5E1][\U0001F5E3])" |
46 R"([\U0001F5E8][\U0001F5EF][\U0001F5F3][\U0001F5FA-\U0001F64F])" | 46 R"([\U0001F5E8][\U0001F5EF][\U0001F5F3][\U0001F5FA-\U0001F64F])" |
47 R"([\U0001F680-\U0001F6C5][\U0001F6CB-\U0001F6D0][\U0001F6E0-\U0001F6E5])" | 47 R"([\U0001F680-\U0001F6C5][\U0001F6CB-\U0001F6D0][\U0001F6E0-\U0001F6E5])" |
48 R"([\U0001F6E9][\U0001F6EB-\U0001F6EC][\U0001F6F0][\U0001F6F3])" | 48 R"([\U0001F6E9][\U0001F6EB-\U0001F6EC][\U0001F6F0][\U0001F6F3])" |
49 R"([\U0001F910-\U0001F918][\U0001F980-\U0001F984][\U0001F9C0]])"; | 49 R"([\U0001F910-\U0001F918][\U0001F980-\U0001F984][\U0001F9C0]])"; |
50 | 50 |
51 static const char* kEmojiEmojiPattern = | 51 static const char kEmojiEmojiPattern[] = |
52 R"([[\u231A-\u231B][\u23E9-\u23EC][\u23F0][\u23F3][\u25FD-\u25FE])" | 52 R"([[\u231A-\u231B][\u23E9-\u23EC][\u23F0][\u23F3][\u25FD-\u25FE])" |
53 R"([\u2614-\u2615][\u2648-\u2653][\u267F][\u2693][\u26A1][\u26AA-\u26AB])" | 53 R"([\u2614-\u2615][\u2648-\u2653][\u267F][\u2693][\u26A1][\u26AA-\u26AB])" |
54 R"([\u26BD-\u26BE][\u26C4-\u26C5][\u26CE][\u26D4][\u26EA][\u26F2-\u26F3])" | 54 R"([\u26BD-\u26BE][\u26C4-\u26C5][\u26CE][\u26D4][\u26EA][\u26F2-\u26F3])" |
55 R"([\u26F5][\u26FA][\u26FD][\u2705][\u270A-\u270B][\u2728][\u274C][\u274E])" | 55 R"([\u26F5][\u26FA][\u26FD][\u2705][\u270A-\u270B][\u2728][\u274C][\u274E])" |
56 R"([\u2753-\u2755][\u2757][\u2795-\u2797][\u27B0][\u27BF][\u2B1B-\u2B1C])" | 56 R"([\u2753-\u2755][\u2757][\u2795-\u2797][\u27B0][\u27BF][\u2B1B-\u2B1C])" |
57 R"([\u2B50][\u2B55][\U0001F004][\U0001F0CF][\U0001F18E])" | 57 R"([\u2B50][\u2B55][\U0001F004][\U0001F0CF][\U0001F18E])" |
58 R"([\U0001F191-\U0001F19A][\U0001F1E6-\U0001F1FF][\U0001F201][\U0001F21A])" | 58 R"([\U0001F191-\U0001F19A][\U0001F1E6-\U0001F1FF][\U0001F201][\U0001F21A])" |
59 R"([\U0001F22F][\U0001F232-\U0001F236][\U0001F238-\U0001F23A])" | 59 R"([\U0001F22F][\U0001F232-\U0001F236][\U0001F238-\U0001F23A])" |
60 R"([\U0001F250-\U0001F251][\U0001F300-\U0001F320][\U0001F32D-\U0001F335])" | 60 R"([\U0001F250-\U0001F251][\U0001F300-\U0001F320][\U0001F32D-\U0001F335])" |
61 R"([\U0001F337-\U0001F37C][\U0001F37E-\U0001F393][\U0001F3A0-\U0001F3CA])" | 61 R"([\U0001F337-\U0001F37C][\U0001F37E-\U0001F393][\U0001F3A0-\U0001F3CA])" |
62 R"([\U0001F3CF-\U0001F3D3][\U0001F3E0-\U0001F3F0][\U0001F3F4])" | 62 R"([\U0001F3CF-\U0001F3D3][\U0001F3E0-\U0001F3F0][\U0001F3F4])" |
63 R"([\U0001F3F8-\U0001F43E][\U0001F440][\U0001F442-\U0001F4FC])" | 63 R"([\U0001F3F8-\U0001F43E][\U0001F440][\U0001F442-\U0001F4FC])" |
64 R"([\U0001F4FF-\U0001F53D][\U0001F54B-\U0001F54E][\U0001F550-\U0001F567])" | 64 R"([\U0001F4FF-\U0001F53D][\U0001F54B-\U0001F54E][\U0001F550-\U0001F567])" |
65 R"([\U0001F595-\U0001F596][\U0001F5FB-\U0001F64F][\U0001F680-\U0001F6C5])" | 65 R"([\U0001F595-\U0001F596][\U0001F5FB-\U0001F64F][\U0001F680-\U0001F6C5])" |
66 R"([\U0001F6CC][\U0001F6D0][\U0001F6EB-\U0001F6EC][\U0001F910-\U0001F918])" | 66 R"([\U0001F6CC][\U0001F6D0][\U0001F6EB-\U0001F6EC][\U0001F910-\U0001F918])" |
67 R"([\U0001F980-\U0001F984][\U0001F9C0]])"; | 67 R"([\U0001F980-\U0001F984][\U0001F9C0]])"; |
68 | 68 |
69 static const char* kEmojiModifierBasePattern = | 69 static const char kEmojiModifierBasePattern[] = |
70 R"([[\u261D][\u26F9][\u270A-\u270D][\U0001F385][\U0001F3C3-\U0001F3C4])" | 70 R"([[\u261D][\u26F9][\u270A-\u270D][\U0001F385][\U0001F3C3-\U0001F3C4])" |
71 R"([\U0001F3CA-\U0001F3CB][\U0001F442-\U0001F443][\U0001F446-\U0001F450])" | 71 R"([\U0001F3CA-\U0001F3CB][\U0001F442-\U0001F443][\U0001F446-\U0001F450])" |
72 R"([\U0001F466-\U0001F469][\U0001F46E][\U0001F470-\U0001F478][\U0001F47C])" | 72 R"([\U0001F466-\U0001F469][\U0001F46E][\U0001F470-\U0001F478][\U0001F47C])" |
73 R"([\U0001F481-\U0001F483][\U0001F485-\U0001F487][\U0001F4AA][\U0001F575])" | 73 R"([\U0001F481-\U0001F483][\U0001F485-\U0001F487][\U0001F4AA][\U0001F575])" |
74 R"([\U0001F590][\U0001F595-\U0001F596][\U0001F645-\U0001F647])" | 74 R"([\U0001F590][\U0001F595-\U0001F596][\U0001F645-\U0001F647])" |
75 R"([\U0001F64B-\U0001F64F][\U0001F6A3][\U0001F6B4-\U0001F6B6][\U0001F6C0])" | 75 R"([\U0001F64B-\U0001F64F][\U0001F6A3][\U0001F6B4-\U0001F6B6][\U0001F6C0])" |
76 R"([\U0001F918]])"; | 76 R"([\U0001F918]])"; |
77 | 77 |
78 static void applyPatternAndFreeze(icu::UnicodeSet* unicodeSet, const char* patte
rn) | 78 static void applyPatternAndFreeze(icu::UnicodeSet* unicodeSet, const char* patte
rn) |
79 { | 79 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return (ch >= '0' && ch <= '9') || ch == '#'; | 114 return (ch >= '0' && ch <= '9') || ch == '#'; |
115 } | 115 } |
116 | 116 |
117 bool Character::isRegionalIndicator(UChar32 ch) | 117 bool Character::isRegionalIndicator(UChar32 ch) |
118 { | 118 { |
119 return (ch >= 0x1F1E6 && ch <= 0x1F1FF); | 119 return (ch >= 0x1F1E6 && ch <= 0x1F1FF); |
120 } | 120 } |
121 | 121 |
122 | 122 |
123 }; // namespace blink | 123 }; // namespace blink |
OLD | NEW |