+ if( numberOfLines == linesCapacity )
+ {
+ // Reserve more space for the next lines.
+ linesBuffer = ResizeLinesBuffer( lines,
+ newLines,
+ linesCapacity,
+ updateCurrentBuffer );
+ }
+
+ UpdateTextLayout( layoutParameters,
+ layout,
+ layoutSize,
+ linesBuffer,
+ index,
+ numberOfLines );
+ } // whether to add a last line.
+
+ // Sets the positions of the glyphs.
+ SetGlyphPositions( layoutParameters.glyphsBuffer + index,
+ layout.numberOfGlyphs,
+ penY,
+ glyphPositionsBuffer + index - layoutParameters.startGlyphIndex );
+
+ // Updates the vertical pen's position.
+ penY += -layout.descender;
+
+ // Increase the glyph index.
+ index += layout.numberOfGlyphs;
+
+ } // no ellipsis
+ } // end for() traversing glyphs.
+
+ if( updateCurrentBuffer )
+ {
+ glyphPositions.Insert( glyphPositions.Begin() + layoutParameters.startGlyphIndex,
+ newGlyphPositions.Begin(),
+ newGlyphPositions.End() );
+
+ newLines.Resize( numberOfLines );
+
+ // Current text's layout size adds only the newly laid-out lines.
+ // Updates the layout size with the previously laid-out lines.
+ UpdateLayoutSize( lines,
+ layoutSize );
+
+ if( 0u != newLines.Count() )
+ {
+ const LineRun& lastLine = *( newLines.End() - 1u );
+
+ const Length characterOffset = lastLine.characterRun.characterIndex + lastLine.characterRun.numberOfCharacters;
+ const Length glyphOffset = lastLine.glyphRun.glyphIndex + lastLine.glyphRun.numberOfGlyphs;
+
+ // Update the indices of the runs before the new laid-out lines are inserted.
+ UpdateLineIndexOffsets( layoutParameters,
+ lines,
+ characterOffset,
+ glyphOffset );
+
+ // Insert the lines.
+ lines.Insert( lines.Begin() + layoutParameters.startLineIndex,
+ newLines.Begin(),
+ newLines.End() );
+ }
+ }
+ else
+ {
+ lines.Resize( numberOfLines );
+ }
+
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--LayoutText\n\n" );
+
+ return true;
+ }
+
+ void ReLayoutRightToLeftLines( const LayoutParameters& layoutParameters,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<Vector2>& glyphPositions )
+ {
+ const CharacterIndex lastCharacterIndex = startIndex + numberOfCharacters;
+
+ // Traverses the paragraphs with right to left characters.
+ for( LineIndex lineIndex = 0u; lineIndex < layoutParameters.numberOfBidirectionalInfoRuns; ++lineIndex )
+ {
+ const BidirectionalLineInfoRun& bidiLine = *( layoutParameters.lineBidirectionalInfoRunsBuffer + lineIndex );
+
+ if( startIndex >= bidiLine.characterRun.characterIndex + bidiLine.characterRun.numberOfCharacters )
+ {
+ // Do not reorder the line if it has been already reordered.
+ continue;
+ }
+
+ if( bidiLine.characterRun.characterIndex >= lastCharacterIndex )
+ {
+ // Do not reorder the lines after the last requested character.
+ break;
+ }