+ if(ellipsisPosition == DevelText::EllipsisPosition::MIDDLE)
+ {
+ //Reduce size, shift glyphs and start from ellipsis glyph
+ numberOfLaidOutGlyphs = numberOfActualLaidOutGlyphs - numberOfRemovedGlyphs;
+
+ GlyphIndex firstMiddleIndexOfElidedGlyphs = 0u;
+ GlyphIndex secondMiddleIndexOfElidedGlyphs = 0u;
+
+ bool isOnlySecondHalf = false;
+ if(isTailMode)
+ {
+ // Multi-lines case with MIDDLE
+ // In case the Ellipsis in the end of line,
+ // then this index will be the firstMiddleIndex.
+ // The secondMiddleIndex will be the fisrt index in next line.
+ // But in case there is no line after Ellipsis's line then secondMiddleIndex and endIndex equal firstMiddle
+ // Example:
+ // A: are laid out glyphs in line has Ellipsis in the end.
+ // N: are laid out glyphs in lines after removed lines.
+ // R: are removed glyphs.
+ // L: are removed glyphs when removed lines.
+ // AAAAAAAAAAAA...RRR => Here's the firstMiddleIndex (First index after last A)
+ // LLLLLLLLLLLLLLL
+ // LLLLLLLLLLLLLLL
+ // NNNNNNNNNNNNNN => Here's the secondMiddleIndex (First N)
+ // NNNNNNNNNN
+
+ firstMiddleIndexOfElidedGlyphs = indexOfEllipsis;
+ if(ellipsisNextLine != nullptr)
+ {
+ secondMiddleIndexOfElidedGlyphs = ellipsisNextLine->glyphRun.glyphIndex;
+ }
+ else
+ {
+ secondMiddleIndexOfElidedGlyphs = firstMiddleIndexOfElidedGlyphs;
+ mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(firstMiddleIndexOfElidedGlyphs);
+ }
+ }
+ else
+ {
+ // Single line case with MIDDLE
+ // In case the Ellipsis in the middle of line,
+ // Then the last index in first half will be firstMiddleIndex.
+ // And the indexOfEllipsis will be secondMiddleIndex, which is the first index in second half.
+ // Example:
+ // A: are laid out glyphs in first half of line.
+ // N: are laid out glyphs in second half of line.
+ // R: are removed glyphs.
+ // L: re removed glyphs when layouting text
+ // AAAAAAALLLLLLLLLLLRRR...NNNNN
+ // firstMiddleIndex (index of last A)
+ // secondMiddleIndex (index before first N)
+
+ firstMiddleIndexOfElidedGlyphs = (ellipsisLine->glyphRun.numberOfGlyphs > 0u) ? (ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs - 1u) : (ellipsisLine->glyphRun.glyphIndex);
+ secondMiddleIndexOfElidedGlyphs = indexOfEllipsis;
+ isOnlySecondHalf = ellipsisLine->glyphRun.numberOfGlyphs == 0u && ellipsisLine->glyphRunSecondHalf.numberOfGlyphs > 0u;
+ }
+
+ mImpl->mVisualModel->SetFirstMiddleIndexOfElidedGlyphs(firstMiddleIndexOfElidedGlyphs);
+ mImpl->mVisualModel->SetSecondMiddleIndexOfElidedGlyphs(secondMiddleIndexOfElidedGlyphs);
+
+ // The number of shifted glyphs and shifting positions will be different according to Single-line or Multi-lines.
+ // isOnlySecondHalf will be true when MIDDLE Ellipsis glyph in single line.
+ if(isOnlySecondHalf)
+ {
+ Length numberOfSecondHalfGlyphs = numberOfLaidOutGlyphs - firstMiddleIndexOfElidedGlyphs;
+
+ //Copy elided glyphs after the ellipsis glyph.
+ memcpy(glyphs + firstMiddleIndexOfElidedGlyphs, glyphs + secondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(GlyphInfo));
+ memcpy(glyphPositions + firstMiddleIndexOfElidedGlyphs, glyphPositions + secondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(Vector2));
+ }
+ else
+ {
+ Length numberOfSecondHalfGlyphs = numberOfLaidOutGlyphs - firstMiddleIndexOfElidedGlyphs + 1u;
+
+ //Copy elided glyphs after the ellipsis glyph.
+ memcpy(glyphs + firstMiddleIndexOfElidedGlyphs + 1u, glyphs + secondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(GlyphInfo));
+ memcpy(glyphPositions + firstMiddleIndexOfElidedGlyphs + 1u, glyphPositions + secondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(Vector2));
+ }
+ }
+ else if(ellipsisPosition == DevelText::EllipsisPosition::START)
+ {
+ numberOfLaidOutGlyphs = numberOfActualLaidOutGlyphs - numberOfRemovedGlyphs;
+ //Copy elided glyphs after the ellipsis glyph.
+ memcpy(glyphs, glyphs + startIndexOfEllipsis + numberOfRemovedGlyphs, numberOfLaidOutGlyphs * sizeof(GlyphInfo));
+ memcpy(glyphPositions, glyphPositions + startIndexOfEllipsis + numberOfRemovedGlyphs, numberOfLaidOutGlyphs * sizeof(Vector2));
+ mImpl->mVisualModel->SetStartIndexOfElidedGlyphs(indexOfEllipsis);
+ }
+ else // DevelText::EllipsisPosition::END
+ {
+ numberOfLaidOutGlyphs = numberOfActualLaidOutGlyphs - numberOfRemovedGlyphs;
+ mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(indexOfEllipsis);
+ }