Go to the source code of this file.
◆ is_breaking_whitespace()
static bool is_breaking_whitespace |
( |
SkUnichar |
c | ) |
|
|
inlinestatic |
Definition at line 52 of file SkShaper_primitive.cpp.
52 {
53 switch (c) {
54 case 0x0020:
55
56 case 0x1680:
57 case 0x180E:
58 case 0x2000:
59 case 0x2001:
60 case 0x2002:
61 case 0x2003:
62 case 0x2004:
63 case 0x2005:
64 case 0x2006:
65 case 0x2007:
66 case 0x2008:
67 case 0x2009:
68 case 0x200A:
69 case 0x200B:
70 case 0x202F:
71 case 0x205F:
72 case 0x3000:
73
74 return true;
75 default:
76 return false;
77 }
78}
◆ linebreak()
static size_t linebreak |
( |
const char |
text[], |
|
|
const char |
stop[], |
|
|
const SkFont & |
font, |
|
|
SkScalar |
width, |
|
|
SkScalar * |
advance, |
|
|
size_t * |
trailing |
|
) |
| |
|
static |
Definition at line 80 of file SkShaper_primitive.cpp.
84{
86 int glyphIndex = 0;
88 const char* wordStart =
text;
89 bool prevWS = true;
90 *trailing = 0;
91
93 const char* prevText =
text;
95 accumulatedWidth += advance[glyphIndex++];
97
98 if (!currWS && prevWS) {
99 wordStart = prevText;
100 }
101 prevWS = currWS;
102
103 if (
width < accumulatedWidth) {
104 bool consumeWhitespace = false;
105 if (currWS) {
106
107 if (prevText ==
start) {
108
110 }
111 consumeWhitespace = true;
112 }
else if (wordStart !=
start) {
113
115 }
else if (prevText >
start) {
116
118 } else {
119
121 consumeWhitespace = true;
122 }
123 if (consumeWhitespace) {
127 }
128 if (trailing) {
129 *trailing =
text - prevText;
130 }
131 }
132 break;
133 }
134 }
135
137}
static float next(float f)
static bool is_breaking_whitespace(SkUnichar c)
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)