Lines Matching refs:line

50     // Get line breaks
54 // Hard line breaks clears off all the other flags
309 // Detect and mark line break runs
322 // line + spaces + clusters
323 Stretch line;
330 // This is the end of the word, the end of the line
332 line.moveTo(spaces);
333 line.moveTo(clusters);
336 this->addLine(wrappedText.get(), unicodeText->getUnicode(), line, spaces, true);
337 line = spaces;
350 // The beginning of a new line (or the first one)
355 line = empty;
376 // line + spaces + clusters + cluster
380 line.moveTo(spaces);
381 line.moveTo(clusters);
386 // Whitespaces do not extend the line width so no wrapping
389 // No wrapping - the endless line
393 // Now let's find out if we can add the cluster to the line
394 auto currentWidth = line.width() + spaces.width() + clusters.width() + cluster.width();
397 if (line.isEmpty()) {
400 line.moveTo(cluster);
402 // We break the only one word on the line by this cluster
403 line.moveTo(clusters);
406 // We move clusters + cluster on the next line
408 // (start it from a new line or squeeze the part of it on this line)
410 this->addLine(wrappedText.get(), unicodeText->getUnicode(), line, spaces, false);
411 line = spaces;
420 // Deal with the last line
422 line.moveTo(spaces);
423 line.moveTo(clusters);
426 // Empty text; we still need a line to avoid checking for empty lines every time
427 line.moveTo(cluster);
430 this->addLine(wrappedText.get(), unicodeText->getUnicode(), line, spaces, false);
453 // TODO: Fill line fOffset.fY
460 // Reorder and cut (if needed) runs so they fit the line
462 // Walk through the line's runs in visual order
508 for (auto& line : this->fVisualLines) {
512 line.fOffset.fX = (this->fActualSize.width() - line.fActualWidth) / 2.0f;
516 line.fOffset.fY = verticalOffset;
517 verticalOffset += line.fTextMetrics.height();
524 for (auto& line : fVisualLines) {
525 visitor->onBeginLine(lineIndex, line.text(), line.isHardBreak(), SkRect::MakeXYWH(0, verticalOffset, line.fActualWidth, line.fTextMetrics.height()));
526 // Select the runs that are on the line
528 for (auto& run : line.fRuns) {
529 auto diff = line.fTextMetrics.above() - run.fTextMetrics.above();
530 SkRect boundingRect = SkRect::MakeXYWH(line.fOffset.fX + run.fPositions[0].fX, line.fOffset.fY + diff, run.width(), run.fTextMetrics.height());
535 visitor->onEndLine(lineIndex, line.text(), line.trailingSpaces(), glyphCount);
536 verticalOffset += line.fTextMetrics.height();
581 for (auto& line : fVisualLines) {
582 visitor->onBeginLine(lineIndex, line.text(), line.isHardBreak(), SkRect::MakeXYWH(0, verticalOffset, line.fActualWidth, line.fTextMetrics.height()));
584 auto lineBlocks = WrappedText::limitBlocks(line.fText, SkSpan<TextIndex>(textBlocks.data(), textBlocks.size()));
588 auto diff = line.fTextMetrics.above() - run.fTextMetrics.above();
590 SkRect::MakeXYWH(line.fOffset.fX + run.fPositions[glyphRange.fStart].fX,
591 line.fOffset.fY + diff,
606 visitor->onEndLine(lineIndex, line.text(), line.trailingSpaces(), glyphCount);
607 verticalOffset += line.fTextMetrics.height();
659 auto& line = fBoxLines.back();
660 line.fTextEnd = trailingSpaces.fStart;
661 line.fTrailingSpacesEnd = trailingSpaces.fEnd;
662 SkASSERT(line.fTextByGlyph.size() == glyphCount);
663 line.fBoxGlyphs.emplace_back(SkRect::MakeXYWH(line.fBounds.fRight, line.fBounds.fTop, 0.0f, line.fBounds.height()));
664 if (line.fTextByGlyph.empty()) {
666 line.fTextByGlyph.emplace_back(lineText.fEnd);
668 line.fTextByGlyph.emplace_back(lineText.fEnd);
679 auto& line = fBoxLines.back();
680 auto start = line.fTextByGlyph.size();
681 line.fBoxGlyphs.push_back_n(glyphCount);
682 line.fTextByGlyph.push_back_n(glyphCount);
686 line.fBoxGlyphs[start + i] = SkRect::MakeXYWH(pos.fX, bounds.fTop, pos1.fX - pos.fX, bounds.height());
687 line.fTextByGlyph[start + i] = clusters[i];
692 Position SelectableText::findPosition(PositionType positionType, const BoxLine& line, SkScalar x) const {
694 position.fGlyphRange = GlyphRange(0, line.fBoxGlyphs.size() - 1);
695 position.fTextRange = line.fTextRange;
696 position.fBoundaries.fTop = line.fBounds.fTop;
697 position.fBoundaries.fBottom = line.fBounds.fBottom;
702 auto glyphBox = line.fBoxGlyphs[position.fGlyphRange.fStart];
707 auto textIndex = line.fTextByGlyph[position.fGlyphRange.fStart];
717 auto glyphBox = line.fBoxGlyphs[position.fGlyphRange.fStart];
722 auto textIndex = line.fTextByGlyph[position.fGlyphRange.fEnd];
732 position.fLineIndex = line.fIndex;
733 position.fBoundaries.fLeft = line.fBoxGlyphs[position.fGlyphRange.fStart].fLeft;
734 position.fBoundaries.fRight = line.fBoxGlyphs[position.fGlyphRange.fEnd].fRight;
742 for (auto& line : fBoxLines) {
743 if (line.fBounds.fTop > xy.fY) {
746 } else if (line.fBounds.fBottom <= xy.fY) {
750 return this->findPosition(positionType, line, xy.fX);
758 // Go to the previous line
780 // Go to the next line
802 // We are on the first line; just move to the first position
806 // Go to the previous line
819 // We are on the last line; just move to the last position
823 // Go to the next line
860 auto& line = fBoxLines[lineIndex];
861 return this->findPosition(positionType, line, line.fBounds.left());
865 auto& line = fBoxLines[lineIndex];
866 return this->findPosition(positionType, line, line.fBounds.right());
872 auto line = this->getLine(position.fLineIndex);
876 textRange.fStart = line.fTextByGlyph[glyph];
878 textRange.fEnd = line.fTextByGlyph[glyph];