+ // The character is a new paragraph.
+ // To know when there is a new paragraph is needed because if there is a white space
+ // between two scripts with different directions, it is added to the script with
+ // the same direction than the first script of the paragraph.
+ isFirstScriptToBeSet = true;
+
+ // Characters common to all scripts at the end of the paragraph are added to the last script.
+ currentScriptRun.characterRun.numberOfCharacters += numberOfAllScriptCharacters;
+
+ // Store the script run.
+ if( TextAbstraction::UNKNOWN == currentScriptRun.script )
+ {
+ currentScriptRun.script = TextAbstraction::LATIN;
+ }
+ scripts.Insert( scripts.Begin() + scriptIndex, currentScriptRun );
+ ++scriptIndex;
+
+ // Initialize the new one.
+ currentScriptRun.characterRun.characterIndex = currentScriptRun.characterRun.characterIndex + currentScriptRun.characterRun.numberOfCharacters;
+ currentScriptRun.characterRun.numberOfCharacters = 0u;
+ currentScriptRun.script = TextAbstraction::UNKNOWN;
+ numberOfAllScriptCharacters = 0u;
+ }
+
+ // Get the next character.
+ ++index;
+ endOfText = index == lastCharacter;
+ if( !endOfText )