Merge "Auto Scrolling Text Label" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / layouts / layout-engine.cpp
index 4182acd..ac9110e 100644 (file)
@@ -807,6 +807,7 @@ struct LayoutEngine::Impl
           {
             // Need to add a new line with no characters but with height to increase the layoutSize.height
             LineRun newLine;
+            Initialize( newLine );
             lines.PushBack( newLine );
 
             UpdateTextLayout( layoutParameters,
@@ -851,7 +852,7 @@ struct LayoutEngine::Impl
     Vector<LineRun> newLines;
 
     // Estimate the number of lines.
-    Length linesCapacity = layoutParameters.estimatedNumberOfLines;
+    Length linesCapacity = std::max( 1u, layoutParameters.estimatedNumberOfLines );
     Length numberOfLines = 0u;
 
     if( updateCurrentBuffer )
@@ -1193,6 +1194,21 @@ struct LayoutEngine::Impl
     }
   }
 
+  void Initialize( LineRun& line )
+  {
+    line.glyphRun.glyphIndex = 0u;
+    line.glyphRun.numberOfGlyphs = 0u;
+    line.characterRun.characterIndex = 0u;
+    line.characterRun.numberOfCharacters = 0u;
+    line.width = 0.f;
+    line.ascender = 0.f;
+    line.descender = 0.f;
+    line.extraLength = 0.f;
+    line.alignmentOffset = 0.f;
+    line.direction = !RTL;
+    line.ellipsis = false;
+  }
+
   LayoutEngine::Layout mLayout;
   LayoutEngine::HorizontalAlignment mHorizontalAlignment;
   LayoutEngine::VerticalAlignment mVerticalAlignment;
@@ -1226,11 +1242,13 @@ void LayoutEngine::SetLayout( Layout layout )
 
 LayoutEngine::Layout LayoutEngine::GetLayout() const
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "GetLayout[%d]\n", mImpl->mLayout);
   return mImpl->mLayout;
 }
 
 void LayoutEngine::SetTextEllipsisEnabled( bool enabled )
 {
+  DALI_LOG_INFO( gLogFilter, Debug::General, "-->LayoutEngine::SetTextEllipsisEnabled[%s]\n", (enabled)?"true":"false" );
   mImpl->mEllipsisEnabled = enabled;
 }