- // There is a paragraph which contains the current script.
-
- Length index = paragraphCharacterIndex;
- while( ( index < numberOfCharacters ) && ( paragraphCharacterIndex < lastScriptRunIndex ) )
- {
- if( TextAbstraction::LINE_MUST_BREAK == *( lineBreakInfoBuffer + index ) )
- {
- if( index >= scriptRun.characterRun.characterIndex )
- {
- // The Bidirectional run must have the same number of characters than the paragraph.
- BidirectionalParagraphInfoRun bidirectionalRun;
- bidirectionalRun.characterRun.characterIndex = paragraphCharacterIndex;
- bidirectionalRun.characterRun.numberOfCharacters = ( index - paragraphCharacterIndex ) + 1u; // The must break character is part of the paragrah.
-
- // Create the bidirectional info for the whole paragraph and store the index to the table with this info in the run.
- bidirectionalRun.bidirectionalInfoIndex = bidirectionalSupport.CreateInfo( textBuffer + bidirectionalRun.characterRun.characterIndex,
- bidirectionalRun.characterRun.numberOfCharacters );
-
- bidirectionalInfo.PushBack( bidirectionalRun );
- }
-
- // Update the character index of the next paragraph.
- paragraphCharacterIndex = index + 1u;
- }
- ++index;
- }
-
- // The last character is always a must-break, so there is no need to check if there is characters left.
+ // The Bidirectional run must have the same number of characters than the paragraph.
+ BidirectionalParagraphInfoRun bidirectionalRun;
+ bidirectionalRun.characterRun.characterIndex = paragraphCharacterIndex;
+ bidirectionalRun.characterRun.numberOfCharacters = (lastScriptRunIndex - paragraphCharacterIndex) + 1u; // The must break character is part of the paragrah.
+
+ // Create the bidirectional info for the whole paragraph and store the index to the table with this info in the run.
+ bidirectionalRun.bidirectionalInfoIndex = bidirectionalSupport.CreateInfo(textBuffer + bidirectionalRun.characterRun.characterIndex,
+ bidirectionalRun.characterRun.numberOfCharacters,
+ matchLayoutDirection,
+ layoutDirection);
+
+ bidirectionalRun.direction = bidirectionalSupport.GetParagraphDirection(bidirectionalRun.bidirectionalInfoIndex);
+
+ bidirectionalInfo.Insert(bidirectionalInfo.Begin() + bidiInfoIndex, bidirectionalRun);
+ ++bidiInfoIndex;