+ if(lastCharacter <= paragraph.characterRun.characterIndex)
+ {
+ // Do not get the character directions beyond startIndex + numberOfCharacters.
+ break;
+ }
+
+ // Set the directions of any previous left to right characters.
+ const Length numberOfLeftToRightCharacters = paragraph.characterRun.characterIndex - index;
+ if(numberOfLeftToRightCharacters > 0u)
+ {
+ memset(directionsBuffer + index - startIndex, false, numberOfLeftToRightCharacters * sizeof(bool));
+ }
+
+ // Set the directions of the bidirectional text.
+ bidirectionalSupport.GetCharactersDirection(paragraph.bidirectionalInfoIndex,
+ directionsBuffer + paragraph.characterRun.characterIndex - startIndex,
+ paragraph.characterRun.numberOfCharacters);
+
+ // Update the index.
+ index += paragraph.characterRun.numberOfCharacters + numberOfLeftToRightCharacters;
+ }
+
+ // Fills with left to right those paragraphs without right to left characters.
+ memset(directionsBuffer + index - startIndex, false, (lastCharacter - index) * sizeof(bool));
+
+ // If the direction info is updated, it needs to be inserted in the model.
+ if(updateCurrentBuffer)
+ {
+ // Insert the directions in the given buffer.
+ directions.Insert(directions.Begin() + startIndex,
+ newDirections.Begin(),
+ newDirections.End());
+ directions.Resize(totalNumberOfCharacters);
+ }