In ElideGlyphs(), it uses x position of glyph to determine whether it is LTR or not.
Fix the problem that referring to the glyph information which position is not calculated in here.
Change-Id: Id9446f4ef66fa16058055060e2530e86bd939c9f
float positions06[] = { 90.0f, 79.0f, 70.0f, 68.0f, 62.0f, 56.0f, 51.0f, 42.0f, 28.0f, 25.0f, 14.0f, 7.0f, 0.0f };
Size textSize07( 120.0f, 50.0f );
- float positions07[] = { 0.0f, 12.0f, 22.0f, 32.0f, 42.0f, 55.0f };
+ float positions07[] = { 0.0f, 12.0f, 22.0f, 32.0f, 42.0f, 65.0f };
Size textSize08( 120.0f, 50.0f );
float positions08[] = { 0.0f, 11.0f, 22.0f, 26.0f, 29.0f, 38.0f, 44.0f, 56.0f };
float calculatedAdvance = 0.f;
- for(GlyphIndex i = 0u; i < numberOfGlyphs; ++i)
+ unsigned int numberOfGlyphsToCalculate = numberOfGlyphs;
+ if(startIndexForGlyph + numberOfGlyphs < (unsigned int)visualModel->mGlyphs.Count())
+ {
+ ++numberOfGlyphsToCalculate;
+ }
+
+ for(GlyphIndex i = 0u; i < numberOfGlyphsToCalculate; ++i)
{
const GlyphInfo& glyph = *(glyphsBuffer + startIndexForGlyph + i);
Vector2& position = *(glyphPositionsBuffer + startIndexForGlyphPositions + i);
if(updateCurrentBuffer)
{
- newGlyphPositions.Resize(layoutParameters.numberOfGlyphs);
+ // Increase Vector size by 1 to prevent out-of-bounds access during Ellipsis calculation.
+ newGlyphPositions.Resize(layoutParameters.numberOfGlyphs + 1);
glyphPositionsBuffer = newGlyphPositions.Begin();
newLines.Resize(linesCapacity);
if(updateCurrentBuffer)
{
+ // Insert up to newGlyphPositions.Begin() + layoutParameters.numberOfGlyphs (not newGlyphPositions.End())
+ // to avoid duplicating the extra element added for Ellipsis calculation.
glyphPositions.Insert(glyphPositions.Begin() + layoutParameters.startGlyphIndex,
newGlyphPositions.Begin(),
- newGlyphPositions.End());
+ newGlyphPositions.Begin() + layoutParameters.numberOfGlyphs);
glyphPositions.Resize(totalNumberOfGlyphs);
newLines.Resize(numberOfLines);