[dali_2.1.6] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-view.cpp
index f8a2722..9b34dd4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -213,7 +213,7 @@ Length View::GetGlyphs(GlyphInfo* glyphs,
 
           if(lastGlyphIndexOfLine == index)
           {
-            penY += -line->descender;
+            penY += -line->descender + line->lineSpacing;
 
             // Get the next line.
             ++lineIndex;
@@ -265,7 +265,7 @@ Length View::GetGlyphs(GlyphInfo* glyphs,
           const LineRun& elidedLine = *ellipsisLine;
 
           if((1u == numberOfLines) &&
-             (elidedLine.ascender - elidedLine.descender > mImpl->mVisualModel->mControlSize.height))
+             (GetLineHeight(elidedLine) > mImpl->mVisualModel->mControlSize.height))
           {
             // Replace the first glyph with ellipsis glyph
             auto indexOfFirstGlyph = (ellipsisPosition == DevelText::EllipsisPosition::START) ? startIndexOfEllipsis : 0u;
@@ -625,6 +625,36 @@ float View::GetUnderlineHeight() const
   return 0.0f;
 }
 
+Text::Underline::Type View::GetUnderlineType() const
+{
+  Text::Underline::Type type = Text::Underline::Type::SOLID;
+  if(mImpl->mVisualModel)
+  {
+    type = mImpl->mVisualModel->GetUnderlineType();
+  }
+  return type;
+}
+
+float View::GetDashedUnderlineWidth() const
+{
+  float width = 0.0f;
+  if(mImpl->mVisualModel)
+  {
+    width = mImpl->mVisualModel->GetDashedUnderlineWidth();
+  }
+  return width;
+}
+
+float View::GetDashedUnderlineGap() const
+{
+  float gap = 0.0f;
+  if(mImpl->mVisualModel)
+  {
+    gap = mImpl->mVisualModel->GetDashedUnderlineGap();
+  }
+  return gap;
+}
+
 Length View::GetNumberOfUnderlineRuns() const
 {
   if(mImpl->mVisualModel)
@@ -742,6 +772,43 @@ GlyphIndex View::GetSecondMiddleIndexOfElidedGlyphs() const
   return secondMiddleIndexOfElidedGlyphs;
 }
 
+const Vector4& View::GetStrikethroughColor() const
+{
+  return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetStrikethroughColor() : Vector4::ZERO;
+}
+
+bool View::IsStrikethroughEnabled() const
+{
+  return (mImpl->mVisualModel) ? mImpl->mVisualModel->IsStrikethroughEnabled() : false;
+}
+
+float View::GetStrikethroughHeight() const
+{
+  return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetStrikethroughHeight() : 0.0f;
+}
+
+Length View::GetNumberOfStrikethroughRuns() const
+{
+  if(mImpl->mVisualModel)
+  {
+    return mImpl->mVisualModel->GetNumberOfStrikethroughRuns();
+  }
+
+  return 0u;
+}
+
+void View::GetStrikethroughRuns(StrikethroughGlyphRun* strikethroughRuns,
+                                StrikethroughRunIndex  index,
+                                Length                 numberOfRuns) const
+{
+  if(mImpl->mVisualModel)
+  {
+    mImpl->mVisualModel->GetStrikethroughRuns(strikethroughRuns,
+                                              index,
+                                              numberOfRuns);
+  }
+}
+
 } // namespace Text
 
 } // namespace Toolkit