Ellipsis sometimes appears incorrect when mixed with RTL + LTR
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / rendering / view-model.cpp
index 7c2d156..3046f45 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 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.
@@ -71,6 +71,11 @@ VerticalAlignment::Type ViewModel::GetVerticalAlignment() const
   return mModel->GetVerticalAlignment();
 }
 
+DevelText::VerticalLineAlignment::Type ViewModel::GetVerticalLineAlignment() const
+{
+  return mModel->GetVerticalLineAlignment();
+}
+
 bool ViewModel::IsTextElideEnabled() const
 {
   return mModel->IsTextElideEnabled();
@@ -148,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();
@@ -163,6 +178,11 @@ const Vector4& ViewModel::GetShadowColor() const
   return mModel->GetShadowColor();
 }
 
+const float& ViewModel::GetShadowBlurRadius() const
+{
+  return mModel->GetShadowBlurRadius();
+}
+
 const Vector4& ViewModel::GetUnderlineColor() const
 {
   return mModel->GetUnderlineColor();
@@ -193,11 +213,21 @@ const Vector4& ViewModel::GetOutlineColor() const
   return mModel->GetOutlineColor();
 }
 
-float ViewModel::GetOutlineWidth() const
+uint16_t ViewModel::GetOutlineWidth() const
 {
   return mModel->GetOutlineWidth();
 }
 
+const Vector4& ViewModel::GetBackgroundColor() const
+{
+  return mModel->GetBackgroundColor();
+}
+
+bool ViewModel::IsBackgroundEnabled() const
+{
+  return mModel->IsBackgroundEnabled();
+}
+
 void ViewModel::ElideGlyphs()
 {
   mIsTextElided = false;
@@ -277,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 );
 
@@ -294,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 ) );
@@ -312,7 +345,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;