- // Find the paragraphs which contains this script run.
- // Consider:
- // 1) Different paragraphs may contain this script run.
- // ------||------------------- rtl sr ------------------------||-------------------
- // --||----- p -----||------------------ p -------------||-------- p ------||------
- //
- // 2) The paragraph which contains this script run may contain other right to left script runs.
- // -----||--- rtl sr ---||---- ltr sr ----||---------- rtl sr -----------||--------
- // -----||---------------------------------- p -----------------------------------|
-
- while( lastScriptRunIndex > paragraphCharacterIndex )
- {
- // 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.
- }