Fix for text renderer. Set the right size in order to cull the actor correctly.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-view.cpp
index 88ab012..caee1f8 100644 (file)
@@ -65,6 +65,16 @@ const Vector2& View::GetControlSize() const
   return Vector2::ZERO;
 }
 
+const Vector2& View::GetActualSize() const
+{
+  if ( mImpl->mVisualModel )
+  {
+    return mImpl->mVisualModel->GetActualSize();
+  }
+
+  return Vector2::ZERO;
+}
+
 Length View::GetNumberOfGlyphs() const
 {
   if( mImpl->mVisualModel )
@@ -122,6 +132,30 @@ Length View::GetGlyphs( GlyphInfo* glyphs,
                                                 glyphIndex,
                                                 numberOfLaidOutGlyphs );
 
+        // Set the colors.
+        const GlyphIndex lastLaidOutGlyphIndex = glyphIndex + numberOfLaidOutGlyphs;
+
+        for( Vector<ColorGlyphRun>::ConstIterator it = mImpl->mVisualModel->mColorRuns.Begin(),
+               endIt = mImpl->mVisualModel->mColorRuns.End();
+             it != endIt;
+             ++it )
+        {
+          const ColorGlyphRun& colorGlyphRun = *it;
+          const GlyphIndex lastGlyphIndex = colorGlyphRun.glyphRun.glyphIndex + colorGlyphRun.glyphRun.numberOfGlyphs;
+
+          if( ( colorGlyphRun.glyphRun.glyphIndex < lastLaidOutGlyphIndex ) &&
+              ( glyphIndex < lastGlyphIndex ) )
+          {
+            for( GlyphIndex index = glyphIndex < colorGlyphRun.glyphRun.glyphIndex ? colorGlyphRun.glyphRun.glyphIndex : glyphIndex,
+                   endIndex = lastLaidOutGlyphIndex < lastGlyphIndex ? lastLaidOutGlyphIndex : lastGlyphIndex;
+                 index < endIndex;
+                 ++index )
+            {
+              *( glyphColors + index - glyphIndex ) = colorGlyphRun.color;
+            }
+          }
+        }
+
         // Get the lines for the given range of glyphs.
         // The lines contain the alignment offset which needs to be added to the glyph's position.
         LineIndex firstLine = 0u;