X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-view.cpp;h=caee1f8143a1f2b10cdd3e9a38ce9a266681a5ff;hp=8d10b2ad8c63009544cfe4d3d666ed8e598da485;hb=95b3d088e01890ea7d105b98e6a7759903a42dfc;hpb=a15b41d8a287aac7174a6df3cee708cfa0c2aeba diff --git a/dali-toolkit/internal/text/text-view.cpp b/dali-toolkit/internal/text/text-view.cpp index 8d10b2a..caee1f8 100644 --- a/dali-toolkit/internal/text/text-view.cpp +++ b/dali-toolkit/internal/text/text-view.cpp @@ -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 ) @@ -84,6 +94,7 @@ Length View::GetNumberOfGlyphs() const Length View::GetGlyphs( GlyphInfo* glyphs, Vector2* glyphPositions, + Vector4* glyphColors, GlyphIndex glyphIndex, Length numberOfGlyphs ) const { @@ -121,6 +132,30 @@ Length View::GetGlyphs( GlyphInfo* glyphs, glyphIndex, numberOfLaidOutGlyphs ); + // Set the colors. + const GlyphIndex lastLaidOutGlyphIndex = glyphIndex + numberOfLaidOutGlyphs; + + for( Vector::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;