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

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

Issue 957473003: Optimize complex text shaping (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase again Created 5 years, 9 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/platform/fonts/shaping/HarfBuzzShaper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 || c == characterTabulation 65 || c == characterTabulation
66 || c == newlineCharacter 66 || c == newlineCharacter
67 || c == noBreakSpace; 67 || c == noBreakSpace;
68 } 68 }
69 static bool treatAsZeroWidthSpace(UChar c) 69 static bool treatAsZeroWidthSpace(UChar c)
70 { 70 {
71 return treatAsZeroWidthSpaceInComplexScript(c) 71 return treatAsZeroWidthSpaceInComplexScript(c)
72 || c == zeroWidthNonJoiner 72 || c == zeroWidthNonJoiner
73 || c == zeroWidthJoiner; 73 || c == zeroWidthJoiner;
74 } 74 }
75 static bool treatAsZeroWidthSpaceInComplexScript(UChar c) 75 static bool treatAsZeroWidthSpaceInComplexScript(UChar32 c)
76 { 76 {
77 return c < 0x20 // ASCII Control Characters 77 return c < 0x20 // ASCII Control Characters
78 || (c >= 0x7F && c < 0xA0) // ASCII Delete .. No-break space 78 || (c >= 0x7F && c < 0xA0) // ASCII Delete .. No-break space
79 || c == softHyphen 79 || c == softHyphen
80 || c == zeroWidthSpace 80 || c == zeroWidthSpace
81 || (c >= leftToRightMark && c <= rightToLeftMark) 81 || (c >= leftToRightMark && c <= rightToLeftMark)
82 || (c >= leftToRightEmbed && c <= rightToLeftOverride) 82 || (c >= leftToRightEmbed && c <= rightToLeftOverride)
83 || c == zeroWidthNoBreakSpace 83 || c == zeroWidthNoBreakSpace
84 || c == objectReplacementCharacter; 84 || c == objectReplacementCharacter;
85 } 85 }
86 static bool treatAsZeroWidthSpaceInComplexScript(LChar c)
87 {
88 return c < 0x20 // ASCII Control Characters
89 || (c >= 0x7F && c < 0xA0) // ASCII Delete .. No-break space
90 || c == softHyphen;
91 }
86 static bool canReceiveTextEmphasis(UChar32); 92 static bool canReceiveTextEmphasis(UChar32);
87 93
88 static inline UChar normalizeSpaces(UChar character) 94 static inline UChar normalizeSpaces(UChar character)
89 { 95 {
90 if (treatAsSpace(character)) 96 if (treatAsSpace(character))
91 return space; 97 return space;
92 98
93 if (treatAsZeroWidthSpace(character)) 99 if (treatAsZeroWidthSpace(character))
94 return zeroWidthSpace; 100 return zeroWidthSpace;
95 101
(...skipping 14 matching lines...) Expand all
110 static String normalizeSpaces(const LChar*, unsigned length); 116 static String normalizeSpaces(const LChar*, unsigned length);
111 static String normalizeSpaces(const UChar*, unsigned length); 117 static String normalizeSpaces(const UChar*, unsigned length);
112 118
113 private: 119 private:
114 Character(); 120 Character();
115 }; 121 };
116 122
117 } // namespace blink 123 } // namespace blink
118 124
119 #endif 125 #endif
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/platform/fonts/shaping/HarfBuzzShaper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698