OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef Character_h | 31 #ifndef Character_h |
32 #define Character_h | 32 #define Character_h |
33 | 33 |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
| 35 #include "platform/fonts/CharacterProperty.h" |
35 #include "platform/text/TextDirection.h" | 36 #include "platform/text/TextDirection.h" |
36 #include "platform/text/TextPath.h" | 37 #include "platform/text/TextPath.h" |
37 #include "platform/text/TextRun.h" | 38 #include "platform/text/TextRun.h" |
38 #include "wtf/Allocator.h" | 39 #include "wtf/Allocator.h" |
39 #include "wtf/HashSet.h" | 40 #include "wtf/HashSet.h" |
40 #include "wtf/text/CharacterNames.h" | 41 #include "wtf/text/CharacterNames.h" |
41 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 class PLATFORM_EXPORT Character { | 46 class PLATFORM_EXPORT Character { |
46 STATIC_ONLY(Character); | 47 STATIC_ONLY(Character); |
47 public: | 48 public: |
48 static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simp
lePath; } | 49 static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simp
lePath; } |
49 static CodePath characterRangeCodePath(const UChar*, unsigned len); | 50 static CodePath characterRangeCodePath(const UChar*, unsigned len); |
50 | 51 |
51 static inline bool isInRange(UChar32 character, UChar32 lowerBound, UChar32
upperBound) | 52 static inline bool isInRange(UChar32 character, UChar32 lowerBound, UChar32
upperBound) |
52 { | 53 { |
53 return character >= lowerBound && character <= upperBound; | 54 return character >= lowerBound && character <= upperBound; |
54 } | 55 } |
55 | 56 |
56 static inline bool isUnicodeVariationSelector(UChar32 character) | 57 static inline bool isUnicodeVariationSelector(UChar32 character) |
57 { | 58 { |
58 // http://www.unicode.org/Public/UCD/latest/ucd/StandardizedVariants.htm
l | 59 // http://www.unicode.org/Public/UCD/latest/ucd/StandardizedVariants.htm
l |
59 return isInRange(character, 0x180B, 0x180D) // MONGOLIAN FREE VARIATION
SELECTOR ONE to THREE | 60 return isInRange(character, 0x180B, 0x180D) // MONGOLIAN FREE VARIATION
SELECTOR ONE to THREE |
60 || isInRange(character, 0xFE00, 0xFE0F) // VARIATION SELECTOR-1 to 1
6 | 61 || isInRange(character, 0xFE00, 0xFE0F) // VARIATION SELECTOR-1 to 1
6 |
61 || isInRange(character, 0xE0100, 0xE01EF); // VARIATION SELECTOR-17
to 256 | 62 || isInRange(character, 0xE0100, 0xE01EF); // VARIATION SELECTOR-17
to 256 |
62 } | 63 } |
63 | 64 |
64 static bool isCJKIdeograph(UChar32); | |
65 static bool isCJKIdeographOrSymbol(UChar32); | 65 static bool isCJKIdeographOrSymbol(UChar32); |
66 | 66 |
67 static unsigned expansionOpportunityCount(const LChar*, size_t length, TextD
irection, bool& isAfterExpansion, const TextJustify); | 67 static unsigned expansionOpportunityCount(const LChar*, size_t length, TextD
irection, bool& isAfterExpansion, const TextJustify); |
68 static unsigned expansionOpportunityCount(const UChar*, size_t length, TextD
irection, bool& isAfterExpansion, const TextJustify); | 68 static unsigned expansionOpportunityCount(const UChar*, size_t length, TextD
irection, bool& isAfterExpansion, const TextJustify); |
69 | 69 |
70 static bool isUprightInMixedVertical(UChar32 character); | 70 static bool isUprightInMixedVertical(UChar32 character); |
71 | 71 |
72 static bool treatAsSpace(UChar c) | 72 static bool treatAsSpace(UChar c) |
73 { | 73 { |
74 return c == spaceCharacter | 74 return c == spaceCharacter |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // This function returns true for 0x000B also, so that this is backward
compatible. | 125 // This function returns true for 0x000B also, so that this is backward
compatible. |
126 // Otherwise, the test LayoutTests/canvas/philip/tests/2d.text.draw.spac
e.collapse.space.html will fail | 126 // Otherwise, the test LayoutTests/canvas/philip/tests/2d.text.draw.spac
e.collapse.space.html will fail |
127 return c == 0x0009 || (c >= 0x000A && c <= 0x000D); | 127 return c == 0x0009 || (c >= 0x000A && c <= 0x000D); |
128 } | 128 } |
129 | 129 |
130 static String normalizeSpaces(const LChar*, unsigned length); | 130 static String normalizeSpaces(const LChar*, unsigned length); |
131 static String normalizeSpaces(const UChar*, unsigned length); | 131 static String normalizeSpaces(const UChar*, unsigned length); |
132 | 132 |
133 static bool isCommonOrInheritedScript(UChar32); | 133 static bool isCommonOrInheritedScript(UChar32); |
134 | 134 |
| 135 private: |
| 136 static bool hasProperty(UChar32, CharacterProperty); |
135 }; | 137 }; |
136 | 138 |
137 } // namespace blink | 139 } // namespace blink |
138 | 140 |
139 #endif | 141 #endif |
OLD | NEW |