Remove Geometry::QUAD() usage in Toolkit
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-view.cpp
index d57b2ec..be6ac8f 100644 (file)
@@ -94,7 +94,6 @@ Length View::GetNumberOfGlyphs() const
 
 Length View::GetGlyphs( GlyphInfo* glyphs,
                         Vector2* glyphPositions,
-                        Vector4* glyphColors,
                         GlyphIndex glyphIndex,
                         Length numberOfGlyphs ) const
 {
@@ -132,30 +131,6 @@ 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;
@@ -181,19 +156,28 @@ Length View::GetGlyphs( GlyphInfo* glyphs,
         GlyphIndex lastGlyphIndexOfLine = line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs - 1u;
 
         // Add the alignment offset to the glyph's position.
+
+        float penY = line->ascender;
         for( Length index = 0u; index < numberOfLaidOutGlyphs; ++index )
         {
-          ( *( glyphPositions + index ) ).x += line->alignmentOffset;
+          Vector2& position =  *( glyphPositions + index );
+          position.x += line->alignmentOffset;
+          position.y += penY;
 
           if( lastGlyphIndexOfLine == index )
           {
+            penY += -line->descender;
+
             // Get the next line.
             ++lineIndex;
 
             if( lineIndex < numberOfLines )
             {
               line = lineBuffer + lineIndex;
+
               lastGlyphIndexOfLine = line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs - 1u;
+
+              penY += line->ascender;
             }
           }
         }
@@ -301,6 +285,26 @@ Length View::GetGlyphs( GlyphInfo* glyphs,
   return numberOfLaidOutGlyphs;
 }
 
+const Vector4* const View::GetColors() const
+{
+  if( mImpl->mVisualModel )
+  {
+    return mImpl->mVisualModel->mColors.Begin();
+  }
+
+  return NULL;
+}
+
+const ColorIndex* const View::GetColorIndices() const
+{
+  if( mImpl->mVisualModel )
+  {
+    return mImpl->mVisualModel->mColorIndices.Begin();
+  }
+
+  return NULL;
+}
+
 const Vector4& View::GetTextColor() const
 {
   if( mImpl->mVisualModel )