const ScriptRun& scriptRun = *it;
const CharacterIndex lastScriptRunIndex = scriptRun.characterRun.characterIndex + scriptRun.characterRun.numberOfCharacters;
- if( TextAbstraction::IsRightToLeftScript( scriptRun.script ) && // The script is right to left.
- ( lastScriptRunIndex > paragraphCharacterIndex ) ) // It isn't part of a previous paragraph.
+ if( ( lastScriptRunIndex > paragraphCharacterIndex ) && // It isn't part of a previous paragraph.
+ TextAbstraction::IsRightToLeftScript( scriptRun.script ) ) // The script is right to left.
{
// Find the paragraphs which contains this script run.
// Consider:
}
bool GetMirroredText( const Vector<Character>& text,
- Vector<Character>& mirroredText,
- const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo )
+ const Vector<CharacterDirection>& directions,
+ const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ Vector<Character>& mirroredText )
{
bool hasTextMirrored = false;
mirroredText = text;
Character* mirroredTextBuffer = mirroredText.Begin();
+ CharacterDirection* directionsBuffer = directions.Begin();
// Traverse the paragraphs and mirror the right to left ones.
for( Vector<BidirectionalParagraphInfoRun>::ConstIterator it = bidirectionalInfo.Begin(),
it != endIt;
++it )
{
- const BidirectionalParagraphInfoRun& run = *it;
+ const BidirectionalParagraphInfoRun& paragraph = *it;
- const bool tmpMirrored = bidirectionalSupport.GetMirroredText( mirroredTextBuffer + run.characterRun.characterIndex,
- run.characterRun.numberOfCharacters );
+ const bool tmpMirrored = bidirectionalSupport.GetMirroredText( mirroredTextBuffer + paragraph.characterRun.characterIndex,
+ directionsBuffer + paragraph.characterRun.characterIndex,
+ paragraph.characterRun.numberOfCharacters );
hasTextMirrored = hasTextMirrored || tmpMirrored;
}
* @brief Replaces any character in the right to left paragraphs which could be mirrored.
*
* @param[in] text The text.
- * @param[in] mirroredText The mirroredText.
+ * @param[in] directions Vector with the direction of each paragraph.
* @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
+ * @param[out] mirroredText The mirroredText.
*
* @return @e true if a character has been replaced.
*/
bool GetMirroredText( const Vector<Character>& text,
- Vector<Character>& mirroredText,
- const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo );
+ const Vector<CharacterDirection>& directions,
+ const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ Vector<Character>& mirroredText );
/**
* @brief Retrieves the character's directions.
if( 0u != bidirectionalInfo.Count() )
{
- // This paragraph has right to left text. Some characters may need to be mirrored.
- // TODO: consider if the mirrored string can be stored as well.
-
- textMirrored = GetMirroredText( utf32Characters,
- mirroredUtf32Characters,
- bidirectionalInfo );
-
// Only set the character directions if there is right to left characters.
Vector<CharacterDirection>& directions = mLogicalModel->mCharacterDirections;
directions.Resize( numberOfCharacters );
GetCharactersDirection( bidirectionalInfo,
directions );
+
+ // This paragraph has right to left text. Some characters may need to be mirrored.
+ // TODO: consider if the mirrored string can be stored as well.
+
+ textMirrored = GetMirroredText( utf32Characters,
+ directions,
+ bidirectionalInfo,
+ mirroredUtf32Characters );
}
else
{