X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Flayouts%2Flayout-engine.cpp;h=0c3d9df9d02bf945a8dfafe39eb1dc9f09ef7ca0;hb=9032944823a9afb984846ac9e79f7c8d2da764bc;hp=4ace75b8d90b25afe728548ab59983d96853d6a7;hpb=1143e3d6b82789fae32f897d3a416b32fdbf0ef3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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 4ace75b..0c3d9df --- a/dali-toolkit/internal/text/layouts/layout-engine.cpp +++ b/dali-toolkit/internal/text/layouts/layout-engine.cpp @@ -394,11 +394,19 @@ struct Engine::Impl tmpLineLayout.wsLengthEndOfLine = 0.f; } + // If calculation is end but wsLengthEndOfLine is exist, it means end of text is space. + // Merge remained length. + if ( !parameters.ignoreSpaceAfterText && glyphIndex == lastGlyphOfParagraphPlusOne-1 && tmpLineLayout.wsLengthEndOfLine > 0 ) + { + tmpLineLayout.length += tmpLineLayout.wsLengthEndOfLine; + tmpLineLayout.wsLengthEndOfLine = 0u; + } + // Save the current extra width to compare with the next one mPreviousCharacterExtraWidth = tmpExtraWidth; // Check if the accumulated length fits in the width of the box. - if( ( completelyFill || isMultiline ) && !isWhiteSpace && + if( ( completelyFill || isMultiline ) && !(parameters.ignoreSpaceAfterText && isWhiteSpace) && ( tmpExtraBearing + lineLayout.length + lineLayout.wsLengthEndOfLine + tmpLineLayout.length + tmpExtraWidth > parameters.boundingBox.width ) ) { // Current word does not fit in the box's width. @@ -1096,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; @@ -1124,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 ); @@ -1133,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: @@ -1161,6 +1181,7 @@ struct Engine::Impl break; } } + } // Calculate the horizontal line offset. @@ -1292,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 )