X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Flayouts%2Flayout-engine.cpp;h=0c3d9df9d02bf945a8dfafe39eb1dc9f09ef7ca0;hp=061707a7bffd434c422e2877b4a8a0b262d78b7f;hb=35bc4b3cfcdfb094a15cd8089ad1c19830287018;hpb=5dd8d9b17470720a322865f56925acce5f25fee7 diff --git a/dali-toolkit/internal/text/layouts/layout-engine.cpp b/dali-toolkit/internal/text/layouts/layout-engine.cpp old mode 100644 new mode 100755 index 061707a..0c3d9df --- a/dali-toolkit/internal/text/layouts/layout-engine.cpp +++ b/dali-toolkit/internal/text/layouts/layout-engine.cpp @@ -1104,7 +1104,9 @@ struct Engine::Impl Length numberOfCharacters, Text::HorizontalAlignment::Type horizontalAlignment, Vector& lines, - float& alignmentOffset ) + float& alignmentOffset, + Dali::LayoutDirection::Type layoutDirection, + bool matchSystemLanguageDirection ) { const CharacterIndex lastCharacterPlusOne = startIndex + numberOfCharacters; @@ -1132,7 +1134,9 @@ struct Engine::Impl // the box width, line length, and the paragraph's direction. CalculateHorizontalAlignment( size.width, horizontalAlignment, - line ); + line, + layoutDirection, + matchSystemLanguageDirection ); // Updates the alignment offset. alignmentOffset = std::min( alignmentOffset, line.alignmentOffset ); @@ -1141,16 +1145,24 @@ struct Engine::Impl void CalculateHorizontalAlignment( float boxWidth, HorizontalAlignment::Type horizontalAlignment, - LineRun& line ) + LineRun& line, + Dali::LayoutDirection::Type layoutDirection, + bool matchSystemLanguageDirection ) { line.alignmentOffset = 0.f; - const bool isRTL = RTL == line.direction; + bool isRTL = RTL == line.direction; float lineLength = line.width; - HorizontalAlignment::Type alignment = horizontalAlignment; + + // match align for system language direction + if( matchSystemLanguageDirection ) + { + isRTL = layoutDirection == LayoutDirection::RIGHT_TO_LEFT; + } + + // Swap the alignment type if the line is right to left. if( isRTL ) { - // Swap the alignment type if the line is right to left. switch( alignment ) { case HorizontalAlignment::BEGIN: @@ -1169,6 +1181,7 @@ struct Engine::Impl break; } } + } // Calculate the horizontal line offset. @@ -1300,14 +1313,18 @@ void Engine::Align( const Size& size, Length numberOfCharacters, Text::HorizontalAlignment::Type horizontalAlignment, Vector& lines, - float& alignmentOffset ) + float& alignmentOffset, + Dali::LayoutDirection::Type layoutDirection, + bool matchSystemLanguageDirection ) { mImpl->Align( size, startIndex, numberOfCharacters, horizontalAlignment, lines, - alignmentOffset ); + alignmentOffset, + layoutDirection, + matchSystemLanguageDirection ); } void Engine::SetDefaultLineSpacing( float lineSpacing )