X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Ftext%2Ftext-abstraction%2Fbidirectional-support-impl.cpp;h=7142ada1847c6a703e24bcca79e470d6ff2ef011;hb=aae144428d03c9e315384225ad33c057b42ea408;hp=10ce56d13c7f8a030536ff7b06ccf38f8067b131;hpb=e7ae0138477b0f724e0a737feaf3ba118a810ef1;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp b/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp old mode 100644 new mode 100755 index 10ce56d..7142ada --- a/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp +++ b/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp @@ -18,13 +18,11 @@ // CLASS HEADER #include -// INTERNAL INCLUDES -#include - // EXTERNAL INCLUDES #include #include #include +#include namespace Dali { @@ -74,21 +72,23 @@ namespace switch( characterDirection ) { case FRIBIDI_TYPE_LTR: // Left-To-Right letter. - case FRIBIDI_TYPE_EN: // European Numeral. - case FRIBIDI_TYPE_AN: // Arabic Numeral. - case FRIBIDI_TYPE_ES: // European number Separator. - case FRIBIDI_TYPE_ET: // European number Terminator. { return LEFT_TO_RIGHT; } - case FRIBIDI_TYPE_RTL: // Right-To-Left letter. case FRIBIDI_TYPE_AL: // Arabic Letter. + case FRIBIDI_TYPE_RTL: // Right-To-Left letter. { return RIGHT_TO_LEFT; } + case FRIBIDI_TYPE_AN: // Arabic Numeral. + case FRIBIDI_TYPE_ES: // European number Separator. + case FRIBIDI_TYPE_ET: // European number Terminator. + case FRIBIDI_TYPE_EN: // European Numeral. + default : + { + return NEUTRAL; + } } - - return NEUTRAL; } } @@ -126,7 +126,9 @@ struct BidirectionalSupport::Plugin } 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(); @@ -150,7 +152,9 @@ struct BidirectionalSupport::Plugin 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) @@ -295,6 +299,8 @@ struct BidirectionalSupport::Plugin for( CharacterIndex index = 0u; index < numberOfCharacters; ++index ) { CharacterDirection& characterDirection = *( directions + index ); + CharacterDirection nextDirection = false; + characterDirection = false; // Get the bidi direction. @@ -303,14 +309,14 @@ struct BidirectionalSupport::Plugin 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; @@ -328,7 +334,9 @@ struct BidirectionalSupport::Plugin 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 ); @@ -342,7 +350,7 @@ struct BidirectionalSupport::Plugin } } - previousDirection = characterDirection; + previousDirection = nextDirection; } } @@ -386,12 +394,16 @@ TextAbstraction::BidirectionalSupport BidirectionalSupport::Get() } 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 )