From f97c70a5601287bc10bd396d6358514d74bcc40f Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Mon, 11 Feb 2019 14:08:27 +0900 Subject: [PATCH] [Tizen] Fixed an incorrect ellipsis ex) An ellipsis may be displayed incorrectly when there are two or more new-line characters. TextLabel labe34 = TextLabel::New( "yesterday all my troubles seemed so\n\n\n\n far away now it looks" ); labe34.SetSize( 450, 100 ); labe34.SetParentOrigin(ParentOrigin::TOP_LEFT); labe34.SetAnchorPoint(AnchorPoint::TOP_LEFT); labe34.SetPosition( 100.f, 500.f); labe34.SetProperty(TextLabel::Property::POINT_SIZE, 17.6f); labe34.SetProperty( TextLabel::Property::MULTI_LINE, true ); labe34.SetProperty(TextLabel::Property::ELLIPSIS, true); stage.Add( labe34 ); Change-Id: Ib35468303dd985486de96f66cb24d244e16f5a69 --- .../utc-Dali-Text-ViewModel.cpp | 34 +++++----------------- .../internal/text/rendering/view-model.cpp | 11 ------- 2 files changed, 8 insertions(+), 37 deletions(-) mode change 100755 => 100644 automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp old mode 100755 new mode 100644 index fc87193..49d36e0 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp @@ -71,7 +71,6 @@ struct ElideData unsigned int numberOfLines; unsigned int numberOfGlyphs; float* positions; - unsigned int ignoreOfGlyphs; }; bool ElideTest( const ElideData& data ) @@ -131,7 +130,7 @@ bool ElideTest( const ElideData& data ) if( numberOfLines != 0u ) { const LineRun& lastLine = *( model->GetLines() + numberOfLines - 1u ); - const Length numberOfLastLineGlyphs = data.numberOfGlyphs - lastLine.glyphRun.glyphIndex + data.ignoreOfGlyphs; + const Length numberOfLastLineGlyphs = data.numberOfGlyphs - lastLine.glyphRun.glyphIndex; std::cout << " last line alignment offset : " << lastLine.alignmentOffset << std::endl; @@ -595,9 +594,6 @@ int UtcDaliTextViewModelElideText02(void) Size textSize04( 80.f, 10.f ); float positions04[] = { 2.f }; - Size textSize05( 180.f, 100.f ); - float positions05[] = { 0.f, 0.f }; - struct ElideData data[] = { { @@ -606,8 +602,7 @@ int UtcDaliTextViewModelElideText02(void) textSize00, 0u, 0u, - NULL, - 0u + NULL }, { "Latin script", @@ -615,8 +610,7 @@ int UtcDaliTextViewModelElideText02(void) textSize01, 5u, 42u, - positions01, - 0u + positions01 }, { "Hebrew script", @@ -624,8 +618,7 @@ int UtcDaliTextViewModelElideText02(void) textSize02, 5u, 49u, - positions02, - 0u + positions02 }, { "Arabic script", @@ -633,8 +626,7 @@ int UtcDaliTextViewModelElideText02(void) textSize03, 5u, 79u, - positions03, - 0u + positions03 }, { "Small control size, no line fits.", @@ -642,20 +634,10 @@ int UtcDaliTextViewModelElideText02(void) textSize04, 1u, 1u, - positions04, - 0u - }, - { - "Include newline character", - "yesterday\n all\n my troubles\n seemed so far\n\n away now it looks", - textSize05, - 5u, - 40, - positions05, - 5u - }, + positions04 + } }; - const unsigned int numberOfTests = 6u; + const unsigned int numberOfTests = 5u; for( unsigned int index = 0u; index < numberOfTests; ++index ) { diff --git a/dali-toolkit/internal/text/rendering/view-model.cpp b/dali-toolkit/internal/text/rendering/view-model.cpp index 27932b2..70b642f 100755 --- a/dali-toolkit/internal/text/rendering/view-model.cpp +++ b/dali-toolkit/internal/text/rendering/view-model.cpp @@ -332,12 +332,6 @@ void ViewModel::ElideGlyphs() glyphInfo = ellipsisGlyph; // Change the 'x' and 'y' position of the ellipsis glyph. - - if( position.x > firstPenX ) - { - position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth; - } - position.x += ellipsisGlyph.xBearing; position.y = penY - ellipsisGlyph.yBearing; @@ -349,11 +343,6 @@ void ViewModel::ElideGlyphs() { if( index > 0u ) { - // If the index decreases to the previous line, firstPenX must be recalculated. - if( numberOfLaidOutGlyphs - index == lastLine.glyphRun.numberOfGlyphs) - { - firstPenSet = false; - } --index; } else -- 2.7.4