From f0297c0a6b916f97737e3e1b46b6368cfb59b997 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Wed, 15 Jan 2020 15:11:27 +0900 Subject: [PATCH] Ellipsis sometimes appears incorrect when mixed with RTL + LTR MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit sample) textRTL = TextLabel::New("فصل 3 قسط 6 - Line of Duty"); textRTL.SetAnchorPoint( AnchorPoint::TOP_LEFT ); textRTL.SetSize( 320, 200.f); textRTL.SetProperty( TextLabel::Property::POINT_SIZE, 20.f); textRTL.SetPosition( 50.f, 300.f); stage.Add( textRTL ); Change-Id: Ice8186431b6914286a99366a8c3347529dbb0c1c --- .../src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp | 6 +++--- dali-toolkit/internal/text/rendering/view-model.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) 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 index 8d7c717..74be44b 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp @@ -586,10 +586,10 @@ int UtcDaliTextViewModelElideText02(void) float positions01[] = { 0.f, 8.f, 16.f, 26.f, 33.f, 41.f, 45.f, 54.f, 64.0f }; Size textSize02( 80.f, 100.f ); - float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 10.0f }; + float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 13.0f }; Size textSize03( 80.f, 100.f ); - float positions03[] = { 74.f, 69.f, 66.f, 61.f, 53.f, 51.f, 47.f, 46.f, 41.f, 31.f, 28.f, 20.f, 7.f }; + float positions03[] = { 74.f, 69.f, 66.f, 61.f, 53.f, 51.f, 47.f, 46.f, 41.f, 31.f, 28.f, 14.f, 7.f }; Size textSize04( 80.f, 10.f ); float positions04[] = { 2.f }; @@ -625,7 +625,7 @@ int UtcDaliTextViewModelElideText02(void) "عل النفط ديسمبر الإمداد بال, بين وترك شعار هو. لمّ من المبرمة النفط بالسيطرة, أم يتم تحرّك وبغطاء, عدم في لإعادة وإقامة رجوعهم.", textSize03, 5u, - 74u, + 73u, positions03 }, { diff --git a/dali-toolkit/internal/text/rendering/view-model.cpp b/dali-toolkit/internal/text/rendering/view-model.cpp index c79dbd4..3046f45 100755 --- a/dali-toolkit/internal/text/rendering/view-model.cpp +++ b/dali-toolkit/internal/text/rendering/view-model.cpp @@ -307,7 +307,7 @@ void ViewModel::ElideGlyphs() // Need to reshape the glyph as the font may be different in size. const GlyphInfo& ellipsisGlyph = fontClient.GetEllipsisGlyph( fontClient.GetPointSize( glyphToRemove.fontId ) ); - if( !firstPenSet || glyphToRemove.advance == 0.f ) + if( !firstPenSet || EqualsZero( glyphToRemove.advance ) ) { const Vector2& position = *( elidedPositionsBuffer + index ); @@ -324,7 +324,10 @@ void ViewModel::ElideGlyphs() removedGlypsWidth = -ellipsisGlyph.xBearing; - firstPenSet = true; + if( !EqualsZero( firstPenX ) ) + { + firstPenSet = true; + } } removedGlypsWidth += std::min( glyphToRemove.advance, ( glyphToRemove.xBearing + glyphToRemove.width ) ); -- 2.7.4