X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fbidirectional-support.cpp;h=c9820184bea304664daf0067b9ffe7674f56b129;hb=08563381e540b243e31b03c45d74ce49258cd730;hp=14fb1a754544e4cba684d4499a4ecc6dc2bfb583;hpb=fc2392c09ab526295f52c430ead7879e1e91a096;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/bidirectional-support.cpp b/dali-toolkit/internal/text/bidirectional-support.cpp index 14fb1a7..c982018 100644 --- a/dali-toolkit/internal/text/bidirectional-support.cpp +++ b/dali-toolkit/internal/text/bidirectional-support.cpp @@ -19,6 +19,7 @@ #include // EXTERNAL INCLUDES +#include #include namespace Dali @@ -185,6 +186,7 @@ void ReorderLines( const Vector& bidirectionalInf ++it ) { const BidirectionalParagraphInfoRun& paragraphInfo = *it; + const CharacterDirection direction = bidirectionalSupport.GetParagraphDirection( paragraphInfo.bidirectionalInfoIndex ); // Get the lines for this paragraph. unsigned int firstLine = 0u; @@ -211,6 +213,7 @@ void ReorderLines( const Vector& bidirectionalInf BidirectionalLineInfoRun lineInfoRun; lineInfoRun.characterRun.characterIndex = line.characterRun.characterIndex; lineInfoRun.characterRun.numberOfCharacters = line.characterRun.numberOfCharacters; + lineInfoRun.direction = direction; // Allocate space for the conversion maps. // The memory is freed after the visual to logical to visual conversion tables are built in the logical model. @@ -218,7 +221,7 @@ void ReorderLines( const Vector& bidirectionalInf // Reorders the line. bidirectionalSupport.Reorder( paragraphInfo.bidirectionalInfoIndex, - line.characterRun.characterIndex, + line.characterRun.characterIndex - paragraphInfo.characterRun.characterIndex, line.characterRun.numberOfCharacters, lineInfoRun.visualToLogicalMap ); @@ -236,6 +239,46 @@ void ReorderLines( LogicalModel& logicalModel, { } +bool GetMirroredText( const Vector& text, + Vector& mirroredText ) +{ + // Handle to the bidirectional info module in text-abstraction. + TextAbstraction::BidirectionalSupport bidirectionalSupport = TextAbstraction::BidirectionalSupport::Get(); + + mirroredText = text; + + return bidirectionalSupport.GetMirroredText( mirroredText.Begin(), + 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