}
BidiInfoIndex CreateInfo( const Character* const paragraph,
- Length numberOfCharacters )
+ Length numberOfCharacters,
+ bool matchSystemLanguageDirection,
+ LayoutDirection::Type layoutDirection )
{
// Reserve memory for the paragraph's bidirectional info.
BidirectionalInfo* bidirectionalInfo = new BidirectionalInfo();
fribidi_get_bidi_types( paragraph, numberOfCharacters, bidirectionalInfo->characterTypes );
// Retrieve the paragraph's direction.
- bidirectionalInfo->paragraphDirection = fribidi_get_par_direction( bidirectionalInfo->characterTypes, numberOfCharacters );
+ bidirectionalInfo->paragraphDirection = matchSystemLanguageDirection == true ?
+ ( layoutDirection == LayoutDirection::RIGHT_TO_LEFT ? FRIBIDI_PAR_RTL : FRIBIDI_PAR_LTR ) :
+ ( fribidi_get_par_direction( bidirectionalInfo->characterTypes, numberOfCharacters ) );
// Retrieve the embedding levels.
if (fribidi_get_par_embedding_levels( bidirectionalInfo->characterTypes, numberOfCharacters, &bidirectionalInfo->paragraphDirection, bidirectionalInfo->embeddedLevels ) == 0)
for( CharacterIndex index = 0u; index < numberOfCharacters; ++index )
{
CharacterDirection& characterDirection = *( directions + index );
+ CharacterDirection nextDirection = false;
+
characterDirection = false;
// Get the bidi direction.
if( RIGHT_TO_LEFT == bidiDirection )
{
characterDirection = true;
+ nextDirection = true;
}
else if( NEUTRAL == bidiDirection )
{
// For neutral characters it check's the next and previous directions.
// If they are equals set that direction. If they are not, sets the paragraph's direction.
// If there is no next, sets the paragraph's direction.
-
- CharacterDirection nextDirection = paragraphDirection;
+ nextDirection = paragraphDirection;
// Look for the next non-neutral character.
Length nextIndex = index + 1u;
characterDirection = previousDirection == nextDirection ? previousDirection : paragraphDirection;
// Set the direction to all the neutral characters.
+ // The indices from currentIndex + 1u to nextIndex - 1u are neutral characters.
++index;
+
for( ; index < nextIndex; ++index )
{
CharacterDirection& nextCharacterDirection = *( directions + index );
}
}
- previousDirection = characterDirection;
+ previousDirection = nextDirection;
}
}
}
BidiInfoIndex BidirectionalSupport::CreateInfo( const Character* const paragraph,
- Length numberOfCharacters )
+ Length numberOfCharacters,
+ bool matchSystemLanguageDirection,
+ Dali::LayoutDirection::Type layoutDirection )
{
CreatePlugin();
return mPlugin->CreateInfo( paragraph,
- numberOfCharacters );
+ numberOfCharacters,
+ matchSystemLanguageDirection,
+ layoutDirection );
}
void BidirectionalSupport::DestroyInfo( BidiInfoIndex bidiInfoIndex )