X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Fview-model.cpp;h=0e8dc617815791160cbc66ba060e3bd132dd89b5;hb=893ca7b6b58b59ed4671daf867c4a319d8c9a770;hp=3543fce5499526f0edae8f6e83e32edd006a2c2c;hpb=d084a6dba7a3bf7c0db028359697934c85cc11a4;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/rendering/view-model.cpp b/dali-toolkit/internal/text/rendering/view-model.cpp index 3543fce..0e8dc61 100755 --- a/dali-toolkit/internal/text/rendering/view-model.cpp +++ b/dali-toolkit/internal/text/rendering/view-model.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,6 +153,16 @@ const ColorIndex* const ViewModel::GetColorIndices() const return mModel->GetColorIndices(); } +const Vector4* const ViewModel::GetBackgroundColors() const +{ + return mModel->GetBackgroundColors(); +} + +const ColorIndex* const ViewModel::GetBackgroundColorIndices() const +{ + return mModel->GetBackgroundColorIndices(); +} + const Vector4& ViewModel::GetDefaultColor() const { return mModel->GetDefaultColor(); @@ -203,7 +213,7 @@ const Vector4& ViewModel::GetOutlineColor() const return mModel->GetOutlineColor(); } -float ViewModel::GetOutlineWidth() const +uint16_t ViewModel::GetOutlineWidth() const { return mModel->GetOutlineWidth(); } @@ -297,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 ) + if( !firstPenSet || EqualsZero( glyphToRemove.advance ) ) { const Vector2& position = *( elidedPositionsBuffer + index ); @@ -314,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 ) ); @@ -322,7 +335,8 @@ void ViewModel::ElideGlyphs() // Calculate the width of the ellipsis glyph and check if it fits. const float ellipsisGlyphWidth = ellipsisGlyph.width + ellipsisGlyph.xBearing; - if( ellipsisGlyphWidth < removedGlypsWidth ) + // If it is the last glyph to remove, add the ellipsis glyph without checking its width. + if( ( ellipsisGlyphWidth < removedGlypsWidth ) || ( index == 0u ) ) { GlyphInfo& glyphInfo = *( elidedGlyphsBuffer + index ); Vector2& position = *( elidedPositionsBuffer + index ); @@ -332,10 +346,13 @@ 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 = firstPenX; + if (ellipsisGlyphWidth < removedGlypsWidth) + { + position.x += removedGlypsWidth - ellipsisGlyphWidth; + } } position.x += ellipsisGlyph.xBearing;