[Tizen] modifies match align for first sentence line direciton 22/191422/1
authorJoogab Yun <joogab.yun@samsung.com>
Tue, 16 Oct 2018 06:31:35 +0000 (15:31 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Wed, 17 Oct 2018 04:31:50 +0000 (13:31 +0900)
Change-Id: Ib973c6cff79b8eb43b50e23f208e81b2e2083bde

dali-toolkit/internal/text/layouts/layout-engine.cpp

index 0c3d9df..99eda82 100755 (executable)
@@ -1111,6 +1111,9 @@ struct Engine::Impl
     const CharacterIndex lastCharacterPlusOne = startIndex + numberOfCharacters;
 
     alignmentOffset = MAX_FLOAT;
+
+    const bool firstLineDirection = matchSystemLanguageDirection == true ? lines.Begin()->direction : false;
+
     // Traverse all lines and align the glyphs.
     for( Vector<LineRun>::Iterator it = lines.Begin(), endIt = lines.End();
          it != endIt;
@@ -1136,7 +1139,8 @@ struct Engine::Impl
                                     horizontalAlignment,
                                     line,
                                     layoutDirection,
-                                    matchSystemLanguageDirection );
+                                    matchSystemLanguageDirection,
+                                    firstLineDirection );
 
       // Updates the alignment offset.
       alignmentOffset = std::min( alignmentOffset, line.alignmentOffset );
@@ -1147,17 +1151,18 @@ struct Engine::Impl
                                      HorizontalAlignment::Type horizontalAlignment,
                                      LineRun& line,
                                      Dali::LayoutDirection::Type layoutDirection,
-                                     bool matchSystemLanguageDirection )
+                                     bool matchSystemLanguageDirection,
+                                     const bool firstLineDirection )
   {
     line.alignmentOffset = 0.f;
     bool isRTL = RTL == line.direction;
     float lineLength = line.width;
     HorizontalAlignment::Type alignment = horizontalAlignment;
 
-    // match align for system language direction
+    // match align for first line direction and system language direction
     if( matchSystemLanguageDirection )
     {
-      isRTL = layoutDirection == LayoutDirection::RIGHT_TO_LEFT;
+      isRTL = ( ( RTL == firstLineDirection ) && ( layoutDirection == LayoutDirection::RIGHT_TO_LEFT ) );
     }
 
     // Swap the alignment type if the line is right to left.