- if( ( 1u == numberOfLines ) &&
- ( lastLine.ascender - lastLine.descender > controlSize.height ) )
- {
- // Get the first glyph which is going to be replaced and the ellipsis glyph.
- GlyphInfo& glyphToRemove = *elidedGlyphsBuffer;
- const GlyphInfo& ellipsisGlyph = fontClient.GetEllipsisGlyph( fontClient.GetPointSize( glyphToRemove.fontId ) );
+ memcpy(elidedGlyphsBuffer, glyphs, numberOfGlyphs * sizeof(GlyphInfo));
+ memcpy(elidedPositionsBuffer, positions, numberOfGlyphs * sizeof(Vector2));
+
+ const Size& controlSize = mModel->GetControlSize();
+
+ // Set index where to set Ellipsis according to the selected position of Ellipsis.
+ // Start with this index to replace its glyph by Ellipsis, if the width is not enough, then remove more glyphs.
+ GlyphIndex startIndexOfEllipsis = 0u;
+ if(ellipsisPosition == DevelText::EllipsisPosition::START)
+ {
+ // It's the fisrt glyph in line.
+ startIndexOfEllipsis = ellipsisLine->glyphRun.glyphIndex;
+ }
+ else if(ellipsisPosition == DevelText::EllipsisPosition::MIDDLE)
+ {
+ // It's the second middle of the line in case the line split to two halves.
+ // Otherwise it's It's the last glyph in line (line before all removed lines).
+ startIndexOfEllipsis = ellipsisLine->isSplitToTwoHalves ? (ellipsisLine->glyphRunSecondHalf.glyphIndex) : (ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs - 1u);
+ }
+ else // DevelText::EllipsisPosition::END
+ {
+ // It's the last glyph in line.
+ startIndexOfEllipsis = ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs - 1u;
+ }