add Padding parameter at RendererParameters 93/248993/2
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 4 Dec 2020 06:30:12 +0000 (15:30 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Fri, 4 Dec 2020 06:46:08 +0000 (15:46 +0900)
Change-Id: If8d78e1363bc02b5f872119af59f6d3b89550b90

dali-toolkit/devel-api/text/text-utils-devel.cpp [changed mode: 0644->0755]
dali-toolkit/devel-api/text/text-utils-devel.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 97a1b57..e5ad925
@@ -1012,9 +1012,14 @@ Size LayoutText(const RendererParameters& textParameters, TextAbstraction::TextR
   const unsigned int radius = textParameters.radius - static_cast<unsigned int>(maxAscenderDescender);
 
   // Set the layout parameters.
-  internalDataModel.textLayoutArea = Size(static_cast<float>(textParameters.textWidth),
+  Size textLayoutArea = Size(static_cast<float>(textParameters.textWidth),
                                           static_cast<float>(textParameters.textHeight));
 
+  // padding
+  Extents padding = textParameters.padding;
+  internalDataModel.textLayoutArea = Size(textLayoutArea.x - ( padding.start + padding.end ), textLayoutArea.y - ( padding.top + padding.bottom ) );
+
+
   if(isCircularTextLayout)
   {
     // In a circular layout, the length of the text area depends on the radius.
@@ -1498,7 +1503,7 @@ Dali::Property::Array RenderForLastIndex(RendererParameters& textParameters)
   ////////////////////////////////////////////////////////////////////////////////
   // Layout the text
   ////////////////////////////////////////////////////////////////////////////////
-  int boundingBox           = textParameters.textHeight;
+  int boundingBox           = textParameters.textHeight - (textParameters.padding.top + textParameters.padding.bottom);
   textParameters.textHeight = MAX_INT; // layout for the entire area.
   LayoutText(textParameters, rendererParameters, embeddedItemLayout, internalData);
 
old mode 100644 (file)
new mode 100755 (executable)
index 6b63039..e4bf375
@@ -55,7 +55,8 @@ struct DALI_TOOLKIT_API RendererParameters
     ellipsisEnabled{true},
     markupEnabled{false},
     isTextColorSet{false},
-    minLineSize{0.f}
+    minLineSize{0.f},
+    padding{0u, 0u, 0u, 0u}
   {
   }
 
@@ -87,6 +88,8 @@ struct DALI_TOOLKIT_API RendererParameters
   bool isTextColorSet : 1;         ///< Whether a default color has been set.
                                    //
   float minLineSize;               ///< The line's minimum size (in points).
+
+  Extents padding;                 ///< The padding of the boundaries where the text is going to be laid-out.
 };
 
 /**