[Tizen] bug fixed : Characters are truncated when HorizontalAlignment.End in 17/192217/3
authorJoogab Yun <joogab.yun@samsung.com>
Tue, 30 Oct 2018 05:18:14 +0000 (14:18 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Thu, 1 Nov 2018 02:09:18 +0000 (02:09 +0000)
Multi line text on RTL environment.

Recalculate the alignmentOffset only if the line is RTL.

We need to distinguish the RTL variable for alignment and the RTL variable for the text line for position offset. So the RTL check of the text line is called isLineRTL.

ex)
When running the sample app below, the characters are truncated.

 Stage stage = Stage::GetCurrent();
 stage.SetBackgroundColor( Color::WHITE );

 TextLabel label = TextLabel::New( "Music, Film & TV, Funny, News,
Sports... Access millions of user generaed content and professional
videos from DAILYMOTION website on your SAMSUNG TV.Search, browse and
watch, get a direct access to your own or favorite accounts, watch a
selection of best" );
 label.SetSize( 1250, 600 );
 label.SetParentOrigin(ParentOrigin::TOP_LEFT);
 label.SetAnchorPoint(AnchorPoint::TOP_LEFT);
 label.SetPosition( 100.f, 700.f);
 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
 label.SetProperty(TextLabel::Property::POINT_SIZE, 30);
 label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,
"END");
 label.SetProperty(Toolkit::DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION,
true );
 label.SetProperty( Actor::Property::LAYOUT_DIRECTION,
LayoutDirection::RIGHT_TO_LEFT );

 stage.Add( label );

Change-Id: I0c1161330de073cef466d8e7119a56a9be606034

automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp
dali-toolkit/internal/text/layouts/layout-engine.cpp

index bc9d08b..5b67476 100755 (executable)
@@ -5316,7 +5316,7 @@ int UtcDaliTextAlign10(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun05 );
   fontDescriptionRuns.PushBack( fontDescriptionRun06 );
 
-  float positions[] = { -4.f, 0.f, 0.f, 0.f, 0.f, 0.f };
+  float positions[] = { 0.f, 0.f, 0.f, 0.f, 0.f, 0.f };
 
   Size textArea( 100.f, 300.f );
   AlignData data =
index 0c3d9df..7b29200 100755 (executable)
@@ -1150,7 +1150,8 @@ struct Engine::Impl
                                      bool matchSystemLanguageDirection )
   {
     line.alignmentOffset = 0.f;
-    bool isRTL = RTL == line.direction;
+    bool isLineRTL = RTL == line.direction;
+    bool isRTL = isLineRTL;
     float lineLength = line.width;
     HorizontalAlignment::Type alignment = horizontalAlignment;
 
@@ -1191,7 +1192,7 @@ struct Engine::Impl
       {
         line.alignmentOffset = 0.f;
 
-        if( isRTL )
+        if( isLineRTL )
         {
           // 'Remove' the white spaces at the end of the line (which are at the beginning in visual order)
           line.alignmentOffset -= line.extraLength;
@@ -1202,7 +1203,7 @@ struct Engine::Impl
       {
         line.alignmentOffset = 0.5f * ( boxWidth - lineLength );
 
-        if( isRTL )
+        if( isLineRTL )
         {
           line.alignmentOffset -= line.extraLength;
         }
@@ -1212,7 +1213,7 @@ struct Engine::Impl
       }
       case HorizontalAlignment::END:
       {
-        if( isRTL )
+        if( isLineRTL )
         {
           lineLength += line.extraLength;
         }