Lines Matching defs:cluster
59 SkScalar TextWrapper::calculateFakeSpacing(Cluster* cluster, bool autoSpacingEnable)
61 if (!autoSpacingEnable || cluster == fEndLine.endCluster()) {
64 if ((cluster - 1)->isWhitespaceBreak() || cluster->isWhitespaceBreak()) {
67 if ((cluster - 1)->isHardBreak() || cluster->isHardBreak()) {
70 if ((cluster - 1)->isCopyright() || cluster->isCopyright()) {
71 return (cluster - 1)->getFontSize() / AUTO_SPACING_WIDTH_RATIO;
73 if ((cluster->isCJK() && (cluster - 1)->isWestern()) || (cluster->isWestern() && (cluster - 1)->isCJK())) {
74 return (cluster - 1)->getFontSize() / AUTO_SPACING_WIDTH_RATIO;
79 // Since we allow cluster clipping when they don't fit
97 for (auto cluster = fEndLine.endCluster(); cluster < endOfClusters; ++cluster) {
98 auto fakeSpacing = calculateFakeSpacing(cluster, autoSpacingEnable);
100 if (cluster->isHardBreak()) {
101 if (cluster != fEndLine.endCluster()) {
106 SkScalar width = fWords.width() + fClusters.width() + cluster->width() + totalFakeSpacing;
109 if (cluster->isWhitespaceBreak()) {
112 fClusters.extend(cluster);
115 if (cluster->isTabulation()) {
116 tabAlignRet = textTabAlign.processTab(fWords, fClusters, cluster, totalFakeSpacing);
118 tabAlignRet = textTabAlign.processEndofWord(fWords, fClusters, cluster, totalFakeSpacing);
126 } else if (cluster->run().isPlaceholder()) {
134 if (cluster->width() > maxWidth && fWords.empty()) {
137 fClusters.extend(cluster);
146 textTabAlign.processEndofLine(fWords, fClusters, cluster, totalFakeSpacing);
148 // Walk further to see if there is a too long word, cluster or glyph
151 for (auto further = cluster; further != endOfClusters; ++further) {
161 // The cluster is spaces but not the end of the word in a normal sense
167 // This is a tricky flutter case: layout(width:0) places 1 cluster on each line
201 if (fWords.empty() && breaker.breakLine(cluster->width())) {
202 fClusters.extend(cluster);
209 if (cluster->isSoftBreak() || cluster->isWhitespaceBreak()) {
213 if (cluster->run().isPlaceholder()) {
221 fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, cluster->width());
222 fWords.extend(cluster);
224 if (cluster->isTabulation()) {
225 if (textTabAlign.processTab(fWords, fClusters, cluster, totalFakeSpacing)) {
228 fClusters.extend(cluster);
233 fClusters.extend(cluster);
235 if (textTabAlign.processEndofWord(fWords, fClusters, cluster, totalFakeSpacing)) {
237 fClusters.trim(cluster);
245 if (textTabAlign.processCluster(fWords, fClusters, cluster, totalFakeSpacing)) {
246 fClusters.trim(cluster);
253 if ((fHardLineBreak = cluster->isHardBreak())) {
285 // Flutter: forget the clipped cluster but keep the metrics
290 // Special case for start/end cluster since they can be clipped
294 // Skip all space cluster at the end
295 for (auto cluster = fEndLine.endCluster();
296 cluster >= fEndLine.startCluster() && cluster->isWhitespaceBreak();
297 --cluster) {
298 fEndLine.trim(cluster);
307 for (auto cluster = fClusters.endCluster(); cluster >= fClusters.startCluster(); --cluster) {
308 if (cluster->run().isPlaceholder()) {
312 if (!cluster->isWhitespaceBreak()) {
313 width += cluster->trimmedWidth(cluster->endPos());
318 width += cluster->width();
327 // End of line is always end of cluster, but need to skip \n
329 auto cluster = fEndLine.endCluster() + 1;
330 while (cluster < fEndLine.breakCluster() && cluster->isWhitespaceBreak()) {
331 width += cluster->width();
332 ++cluster;
340 auto cluster = fEndLine.breakCluster() + 1;
341 while (cluster < endOfClusters && cluster->isWhitespaceBreak() && !cluster->isTabulation()) {
342 width += cluster->width();
343 ++cluster;
353 return std::make_tuple(cluster, 0, width);
387 for (auto& cluster : parent.clusters()) {
388 auto len = cluster.width();
400 auto& cluster = parent.clusters()[ix];
401 auto len = cluster.width();
405 if (cluster.isWhitespaceBreak()) {
409 } else if (cluster.isHardBreak()) {
413 } else if (cluster.isIntraWordBreak()) {
418 cumulativeLen_ -= cluster.width();
711 for (auto cluster = fEndLine.startCluster(); cluster <= fEndLine.endCluster(); ++cluster) {
712 auto r = cluster->runOrNull();
857 // In case of a force wrapping we don't have a break cluster and have to use the end cluster
913 auto cluster = fEndLine.endCluster();
914 while (cluster != end || cluster->endPos() < end->endPos()) {
916 if (cluster->isHardBreak()) {
922 } else if (cluster->isWhitespaceBreak()) {
924 softLineMaxIntrinsicWidth += cluster->width();
927 } else if (cluster->run().isPlaceholder()) {
931 softLineMaxIntrinsicWidth += cluster->width();
932 fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, cluster->width());
935 // Nothing out of ordinary - just add this cluster to the word and to the line
936 softLineMaxIntrinsicWidth += cluster->width();
937 lastWordLength += cluster->width();
939 ++cluster;
945 // In case we could not place even a single cluster on the line
998 // Since we allow cluster clipping when they don't fit
1008 for (auto cluster = fEndLine.endCluster(); cluster < endOfClusters; ++cluster) {
1009 if (cluster->isHardBreak()) {
1011 SkScalar width = fWords.width() + fClusters.width() + cluster->width();
1013 if (cluster->isWhitespaceBreak()) {
1015 fClusters.extend(cluster);
1019 } else if (cluster->run().isPlaceholder()) {
1025 if (cluster->width() > maxWidth && fWords.empty()) {
1028 fClusters.extend(cluster);
1036 // Walk further to see if there is a too long word, cluster or glyph
1039 for (auto further = cluster; further != endOfClusters; ++further) {
1048 // The cluster is spaces but not the end of the word in a normal sense
1053 // This is a tricky flutter case: layout(width:0) places 1 cluster on each line
1087 if (cluster->width() > maxWidth) {
1088 fClusters.extend(cluster);
1094 if (cluster->run().isPlaceholder()) {
1101 fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, cluster->width());
1102 fWords.extend(cluster);
1104 fClusters.extend(cluster);
1111 if ((fHardLineBreak = cluster->isHardBreak())) {
1139 // Flutter: forget the clipped cluster but keep the metrics
1143 // Special case for start/end cluster since they can be clipped
1147 // Skip all space cluster at the end
1148 for (auto cluster = fEndLine.endCluster();
1149 cluster >= fEndLine.startCluster() && cluster->isWhitespaceBreak();
1150 --cluster) {
1151 fEndLine.trim(cluster);
1159 for (auto cluster = fClusters.endCluster(); cluster >= fClusters.startCluster(); --cluster) {
1160 if (cluster->run().isPlaceholder()) {
1164 if (!cluster->isWhitespaceBreak()) {
1165 width += cluster->trimmedWidth(cluster->endPos());
1170 width += cluster->width();
1177 // End of line is always end of cluster, but need to skip \n
1179 auto cluster = fEndLine.endCluster() + 1;
1180 while (cluster < fEndLine.breakCluster() && cluster->isWhitespaceBreak()) {
1181 width += cluster->width();
1182 ++cluster;
1189 auto cluster = fEndLine.breakCluster() + 1;
1190 while (cluster < endOfClusters && cluster->isWhitespaceBreak()) {
1191 width += cluster->width();
1192 ++cluster;
1200 return std::make_tuple(cluster, 0, width);
1250 for (auto cluster = fEndLine.startCluster(); cluster <= fEndLine.endCluster(); ++cluster) {
1251 auto r = cluster->runOrNull();
1293 // In case of a force wrapping we don't have a break cluster and have to use the end cluster
1332 auto cluster = fEndLine.endCluster();
1333 while (cluster != end || cluster->endPos() < end->endPos()) {
1335 if (cluster->isHardBreak()) {
1341 } else if (cluster->isWhitespaceBreak()) {
1343 softLineMaxIntrinsicWidth += cluster->width();
1346 } else if (cluster->run().isPlaceholder()) {
1350 softLineMaxIntrinsicWidth += cluster->width();
1351 fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, cluster->width());
1354 // Nothing out of ordinary - just add this cluster to the word and to the line
1355 softLineMaxIntrinsicWidth += cluster->width();
1356 lastWordLength += cluster->width();
1358 ++cluster;
1363 // In case we could not place even a single cluster on the line