X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fbidirectional-support.cpp;h=135f71be4231364bdeace94e106edabbddd2fa71;hp=6f74f19728dfb56f4e29d337cede0e816bd2df2a;hb=4d0611f4911028b53905712013e1034d42531e5f;hpb=3e17d9f63dedb5d669409301f8d9a3d8c393f979 diff --git a/dali-toolkit/internal/text/bidirectional-support.cpp b/dali-toolkit/internal/text/bidirectional-support.cpp index 6f74f19..135f71b 100644 --- a/dali-toolkit/internal/text/bidirectional-support.cpp +++ b/dali-toolkit/internal/text/bidirectional-support.cpp @@ -19,7 +19,8 @@ #include // EXTERNAL INCLUDES -#include +#include +#include namespace Dali { @@ -169,7 +170,7 @@ void ReplaceBidirectionalInfo( LogicalModel& model, } void ReorderLines( const Vector& bidirectionalInfo, - const Vector& lineRuns, + Vector& lineRuns, Vector& lineInfoRuns ) { // Handle to the bidirectional info module in text-abstraction. @@ -201,12 +202,15 @@ void ReorderLines( const Vector& bidirectionalInf lineIndex = firstLine + numberOfLines; // Traverse the lines and reorder them - for( Vector::ConstIterator lineIt = lineRuns.Begin() + firstLine, + for( Vector::Iterator lineIt = lineRuns.Begin() + firstLine, endLineIt = lineRuns.Begin() + firstLine + numberOfLines; lineIt != endLineIt; ++lineIt ) { - const LineRun& line = *lineIt; + LineRun& line = *lineIt; + + // Sets the paragraph's direction. + line.direction = direction; // Creates a bidirectional info for the line run. BidirectionalLineInfoRun lineInfoRun; @@ -250,6 +254,34 @@ bool GetMirroredText( const Vector& text, mirroredText.Count() ); } +void GetCharactersDirection( const Vector& bidirectionalInfo, + Vector& directions ) +{ + // Handle to the bidirectional info module in text-abstraction. + TextAbstraction::BidirectionalSupport bidirectionalSupport = TextAbstraction::BidirectionalSupport::Get(); + + CharacterIndex index = 0u; + CharacterDirection* directionsBuffer = directions.Begin(); + for( Vector::ConstIterator it = bidirectionalInfo.Begin(), + endIt = bidirectionalInfo.End(); + it != endIt; + ++it ) + { + const BidirectionalParagraphInfoRun& paragraph = *it; + + // Fills with left to right those paragraphs without right to left characters. + memset( directionsBuffer + index, false, ( paragraph.characterRun.characterIndex - index ) * sizeof( bool ) ); + index += paragraph.characterRun.numberOfCharacters; + + bidirectionalSupport.GetCharactersDirection( paragraph.bidirectionalInfoIndex, + directionsBuffer + paragraph.characterRun.characterIndex, + paragraph.characterRun.numberOfCharacters ); + } + + // Fills with left to right those paragraphs without right to left characters. + memset( directionsBuffer + index, false, ( directions.Count() - index ) * sizeof( bool ) ); +} + } // namespace Text } // namespace Toolkit