+ // Add an extra line if the last character is a new paragraph character and the last line doesn't have zero characters.
+ if( layoutParameters.isLastNewParagraph )
+ {
+ Length numberOfLines = lines.Count();
+ if( 0u != numberOfLines )
+ {
+ const LineRun& lastLine = *( lines.End() - 1u );
+
+ if( 0u != lastLine.characterRun.numberOfCharacters )
+ {
+ // Need to add a new line with no characters but with height to increase the layoutSize.height
+ LineRun newLine;
+ Initialize( newLine );
+ lines.PushBack( newLine );
+
+ UpdateTextLayout( layoutParameters,
+ lastLine.characterRun.characterIndex + lastLine.characterRun.numberOfCharacters,
+ lastLine.glyphRun.glyphIndex + lastLine.glyphRun.numberOfGlyphs,
+ layoutSize,
+ lines.Begin(),
+ numberOfLines );
+ }
+ }
+ }
+
+ // Calculates the layout size.
+ UpdateLayoutSize( lines,
+ layoutSize );
+
+ // Nothing else do if there are no glyphs to layout.