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=130c8af50691660af887a5c0c773bf31e319e286;hp=88ab012bb3c752b902a741c796fa08290152cbd4;hb=26cacf71e74fab984c12bc77485920f4573b97ec;hpb=da24507a54c2603006c244b01b5325639baca2d2 diff --git a/dali-toolkit/internal/text/text-view.cpp b/dali-toolkit/internal/text/text-view.cpp index 88ab012..130c8af 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::GetLayoutSize() const +{ + if ( mImpl->mVisualModel ) + { + return mImpl->mVisualModel->GetLayoutSize(); + } + + 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::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; @@ -147,19 +181,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; } } }