X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fbidirectional-support.cpp;h=fd85439866997f7df025ebea979790420dee0529;hb=2ecd7e13e0dbe45f59b5150abbf7924bf780f720;hp=c9820184bea304664daf0067b9ffe7674f56b129;hpb=56d412791a44c2a79135d2293c13fddb135c9d54;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 c982018..fd85439 100644 --- a/dali-toolkit/internal/text/bidirectional-support.cpp +++ b/dali-toolkit/internal/text/bidirectional-support.cpp @@ -20,7 +20,7 @@ // EXTERNAL INCLUDES #include -#include +#include namespace Dali { @@ -162,15 +162,8 @@ void SetBidirectionalInfo( const Vector& text, } } -void ReplaceBidirectionalInfo( LogicalModel& model, - CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - Length numberOfCharactersToInsert ) -{ -} - void ReorderLines( const Vector& bidirectionalInfo, - const Vector& lineRuns, + Vector& lineRuns, Vector& lineInfoRuns ) { // Handle to the bidirectional info module in text-abstraction. @@ -202,12 +195,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; @@ -219,11 +215,14 @@ void ReorderLines( const Vector& bidirectionalInf // The memory is freed after the visual to logical to visual conversion tables are built in the logical model. lineInfoRun.visualToLogicalMap = reinterpret_cast( malloc( line.characterRun.numberOfCharacters * sizeof( CharacterIndex ) ) ); - // Reorders the line. - bidirectionalSupport.Reorder( paragraphInfo.bidirectionalInfoIndex, - line.characterRun.characterIndex - paragraphInfo.characterRun.characterIndex, - line.characterRun.numberOfCharacters, - lineInfoRun.visualToLogicalMap ); + if( NULL != lineInfoRun.visualToLogicalMap ) + { + // Reorders the line. + bidirectionalSupport.Reorder( paragraphInfo.bidirectionalInfoIndex, + line.characterRun.characterIndex - paragraphInfo.characterRun.characterIndex, + line.characterRun.numberOfCharacters, + lineInfoRun.visualToLogicalMap ); + } // Push the run into the vector. lineInfoRuns.PushBack( lineInfoRun ); @@ -231,24 +230,34 @@ void ReorderLines( const Vector& bidirectionalInf } } -void ReorderLines( LogicalModel& logicalModel, - const VisualModel& visualModel, - CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - Length numberOfCharactersToInsert ) -{ -} - bool GetMirroredText( const Vector& text, - Vector& mirroredText ) + Vector& mirroredText, + const Vector& bidirectionalInfo ) { + bool hasTextMirrored = false; + // Handle to the bidirectional info module in text-abstraction. TextAbstraction::BidirectionalSupport bidirectionalSupport = TextAbstraction::BidirectionalSupport::Get(); mirroredText = text; - return bidirectionalSupport.GetMirroredText( mirroredText.Begin(), - mirroredText.Count() ); + Character* mirroredTextBuffer = mirroredText.Begin(); + + // Traverse the paragraphs and mirror the right to left ones. + for( Vector::ConstIterator it = bidirectionalInfo.Begin(), + endIt = bidirectionalInfo.End(); + it != endIt; + ++it ) + { + const BidirectionalParagraphInfoRun& run = *it; + + const bool tmpMirrored = bidirectionalSupport.GetMirroredText( mirroredTextBuffer + run.characterRun.characterIndex, + run.characterRun.numberOfCharacters ); + + hasTextMirrored = hasTextMirrored || tmpMirrored; + } + + return hasTextMirrored; } void GetCharactersDirection( const Vector& bidirectionalInfo,