Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: Source/platform/fonts/Character.h

Issue 255323004: Rendering text-justify:distribute for 8 bit characters. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Using 2 bits for enum Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
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/text/TextDirection.h" 35 #include "platform/text/TextDirection.h"
36 #include "platform/text/TextPath.h" 36 #include "platform/text/TextPath.h"
37 #include "platform/text/TextRun.h"
37 #include "wtf/HashSet.h" 38 #include "wtf/HashSet.h"
38 #include "wtf/text/WTFString.h" 39 #include "wtf/text/WTFString.h"
39 #include "wtf/unicode/CharacterNames.h" 40 #include "wtf/unicode/CharacterNames.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 class PLATFORM_EXPORT Character { 44 class PLATFORM_EXPORT Character {
44 public: 45 public:
45 static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simp lePath; } 46 static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simp lePath; }
46 static CodePath characterRangeCodePath(const UChar*, unsigned len); 47 static CodePath characterRangeCodePath(const UChar*, unsigned len);
47 48
48 static bool isCJKIdeograph(UChar32); 49 static bool isCJKIdeograph(UChar32);
49 static bool isCJKIdeographOrSymbol(UChar32); 50 static bool isCJKIdeographOrSymbol(UChar32);
50 51
51 static unsigned expansionOpportunityCount(const LChar*, size_t length, TextD irection, bool& isAfterExpansion); 52 static unsigned expansionOpportunityCount(const LChar*, size_t length, TextD irection, bool& isAfterExpansion, const ETextJustify);
52 static unsigned expansionOpportunityCount(const UChar*, size_t length, TextD irection, bool& isAfterExpansion); 53 static unsigned expansionOpportunityCount(const UChar*, size_t length, TextD irection, bool& isAfterExpansion, const ETextJustify);
53 54
54 static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n ' || c == noBreakSpace; } 55 static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n ' || c == noBreakSpace; }
55 static bool treatAsZeroWidthSpace(UChar c) { return treatAsZeroWidthSpaceInC omplexScript(c) || c == 0x200c || c == 0x200d; } 56 static bool treatAsZeroWidthSpace(UChar c) { return treatAsZeroWidthSpaceInC omplexScript(c) || c == 0x200c || c == 0x200d; }
56 static bool treatAsZeroWidthSpaceInComplexScript(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || c == zeroWidthSpace || (c >= 0x 200e && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == zeroWidthNoBreakSpa ce || c == objectReplacementCharacter; } 57 static bool treatAsZeroWidthSpaceInComplexScript(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || c == zeroWidthSpace || (c >= 0x 200e && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == zeroWidthNoBreakSpa ce || c == objectReplacementCharacter; }
57 static bool canReceiveTextEmphasis(UChar32); 58 static bool canReceiveTextEmphasis(UChar32);
58 59
59 static inline UChar normalizeSpaces(UChar character) 60 static inline UChar normalizeSpaces(UChar character)
60 { 61 {
61 if (treatAsSpace(character)) 62 if (treatAsSpace(character))
62 return space; 63 return space;
63 64
64 if (treatAsZeroWidthSpace(character)) 65 if (treatAsZeroWidthSpace(character))
65 return zeroWidthSpace; 66 return zeroWidthSpace;
66 67
67 return character; 68 return character;
68 } 69 }
69 70
70 static String normalizeSpaces(const LChar*, unsigned length); 71 static String normalizeSpaces(const LChar*, unsigned length);
71 static String normalizeSpaces(const UChar*, unsigned length); 72 static String normalizeSpaces(const UChar*, unsigned length);
72 73
73 private: 74 private:
74 Character(); 75 Character();
75 }; 76 };
76 77
77 } 78 }
78 79
79 #endif 80 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698