+ else
+ {
+ const bool isLastLine = index + layout.numberOfGlyphs == layoutParameters.totalNumberOfGlyphs;
+
+ LineRun lineRun;
+ lineRun.glyphRun.glyphIndex = index;
+ lineRun.glyphRun.numberOfGlyphs = layout.numberOfGlyphs;
+ lineRun.characterRun.characterIndex = layout.characterIndex;
+ lineRun.characterRun.numberOfCharacters = layout.numberOfCharacters;
+ if( isLastLine && !layoutParameters.isLastNewParagraph )
+ {
+ const float width = layout.extraBearing + layout.length + layout.extraWidth + layout.wsLengthEndOfLine;
+ if( MULTI_LINE_BOX == mLayout )
+ {
+ lineRun.width = ( width > layoutParameters.boundingBox.width ) ? layoutParameters.boundingBox.width : width;
+ }
+ else
+ {
+ lineRun.width = width;
+ }
+
+ lineRun.extraLength = 0.f;
+ }
+ else
+ {
+ lineRun.width = layout.extraBearing + layout.length + layout.extraWidth;
+ lineRun.extraLength = ( layout.wsLengthEndOfLine > 0.f ) ? layout.wsLengthEndOfLine - layout.extraWidth : 0.f;
+ }
+ lineRun.ascender = layout.ascender;
+ lineRun.descender = layout.descender;
+ lineRun.direction = !RTL;
+ lineRun.ellipsis = false;
+
+ lines.PushBack( lineRun );
+
+ // Update the actual size.
+ if( lineRun.width > actualSize.width )
+ {
+ actualSize.width = lineRun.width;
+ }
+
+ actualSize.height += ( lineRun.ascender + -lineRun.descender );
+
+ SetGlyphPositions( layoutParameters.glyphsBuffer + index,
+ layout.numberOfGlyphs,
+ penY,
+ glyphPositions.Begin() + index );
+
+ penY += -layout.descender;
+
+ // Increase the glyph index.
+ index += layout.numberOfGlyphs;
+
+ if( isLastLine &&
+ layoutParameters.isLastNewParagraph &&
+ ( mLayout == MULTI_LINE_BOX ) )
+ {
+ // Need to add a new line with no characters but with height to increase the actualSize.height
+ const GlyphInfo& glyphInfo = *( layoutParameters.glyphsBuffer + layoutParameters.totalNumberOfGlyphs - 1u );
+
+ Text::FontMetrics fontMetrics;
+ mFontClient.GetFontMetrics( glyphInfo.fontId, fontMetrics );
+
+ LineRun lineRun;
+ lineRun.glyphRun.glyphIndex = 0u;
+ lineRun.glyphRun.numberOfGlyphs = 0u;
+ lineRun.characterRun.characterIndex = 0u;
+ lineRun.characterRun.numberOfCharacters = 0u;
+ lineRun.width = 0.f;
+ lineRun.ascender = fontMetrics.ascender;
+ lineRun.descender = fontMetrics.descender;
+ lineRun.extraLength = 0.f;
+ lineRun.alignmentOffset = 0.f;
+ lineRun.direction = !RTL;
+ lineRun.ellipsis = false;
+
+ actualSize.height += ( lineRun.ascender + -lineRun.descender );
+
+ lines.PushBack( lineRun );
+ }
+ }
+ } // end for() traversing glyphs.