Multiple text background color support for left-to-right text only in TextField
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / rendering / view-model.cpp
index 0a977f3..c79dbd4 100755 (executable)
@@ -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();
@@ -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 || glyphToRemove.advance == 0.f )
             {
               const Vector2& position = *( elidedPositionsBuffer + index );
 
@@ -332,6 +342,11 @@ 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;