MCPcopy Create free account
hub / github.com/Snapchat/Valdi / append

Method append

snap_drawing/src/snap_drawing/cpp/Text/TextLayoutBuilder.cpp:490–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488
489bool TextLayoutBuilder::shouldProcessEllipsisAfterLineHeightUpdate() const {
490 return _position.y + _currentLineMetrics.height() > _maxSize.height;
491}
492
493void TextLayoutBuilder::processUnidirectionalRun(const TextLayoutSpecs& specs,
494 const Ref<Font>& originalFont,
495 const Character* characters,
496 size_t charactersLength,
497 TextScript script,
498 bool isRTL) {
499 if (_reachedMaxLines) {
500 return;
501 }
502
503 auto shapeResult = shape(specs, characters, charactersLength, script, isRTL);
504 if (specs.replacementSize) {
505 auto glyphStartIndex = shapeResult.glyphsStart - _glyphs.data();
506 auto glyphEndIndex = shapeResult.glyphsEnd - _glyphs.data();
507 for (auto glyphIndex = glyphStartIndex; glyphIndex < glyphEndIndex; glyphIndex++) {
508 _glyphs[glyphIndex].advanceX = glyphIndex == glyphStartIndex ? specs.replacementSize->width : 0.0f;
509 }
510 }
511
512 const auto* shapedGlyphIt = shapeResult.glyphsStart;
513 const auto& fontMetrics = specs.font->metrics();
514 const auto* backgroundStyle = getBackgroundStyle(specs.backgroundStyleIndex);
515 const auto backgroundHorizontalPadding =
516 backgroundStyle != nullptr ? backgroundStyle->horizontalPadding() : static_cast<Scalar>(0);
517 LineMetrics lineMetrics;
518
519 // Resolve all the segments of our blob.
520 // We emit one segment per line.
521
522 while (shapedGlyphIt < shapeResult.glyphsEnd && !_reachedMaxLines) {

Callers

nothing calls this directly

Calls 3

utf8ToUnicodeFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected