From: Joogab Yun Date: Tue, 30 Oct 2018 05:18:14 +0000 (+0900) Subject: [Tizen] bug fixed : Characters are truncated when HorizontalAlignment.End in X-Git-Tag: accepted/tizen/5.0/unified/20181106.070355~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F17%2F192217%2F3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git [Tizen] bug fixed : Characters are truncated when HorizontalAlignment.End in 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 --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp index bc9d08b..5b67476 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp @@ -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 = diff --git a/dali-toolkit/internal/text/layouts/layout-engine.cpp b/dali-toolkit/internal/text/layouts/layout-engine.cpp index 0c3d9df..7b29200 100755 --- a/dali-toolkit/internal/text/layouts/layout-engine.cpp +++ b/dali-toolkit/internal/text/layouts/layout-engine.cpp @@ -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; }