X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Ftext-typesetter.cpp;h=c46a8c1f548e46efabae1d42ff874d77b30753c6;hb=9817d4be0f95105f1cc8c5a211296da86af6d471;hp=dcd803cec70f1be375ec8aa9cd5fc56c154d3e51;hpb=232082aeaf842a8dc87c2465123102a8bf30314e;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/rendering/text-typesetter.cpp b/dali-toolkit/internal/text/rendering/text-typesetter.cpp index dcd803c..c46a8c1 100755 --- a/dali-toolkit/internal/text/rendering/text-typesetter.cpp +++ b/dali-toolkit/internal/text/rendering/text-typesetter.cpp @@ -19,12 +19,13 @@ #include // EXTERNAL INCLUDES -#include #include +#include #include // INTERNAL INCLUDES #include +#include namespace Dali { @@ -221,7 +222,7 @@ void TypesetGlyph( GlyphData& data, { // Check alpha of overlapped pixels uint8_t& currentAlpha = *( bitmapBuffer + verticalOffset + xOffsetIndex ); - uint8_t newAlpha = static_cast( color->a * static_cast( alpha ) ); + uint8_t newAlpha = static_cast( static_cast( alpha ) ); // For any pixel overlapped with the pixel in previous glyphs, make sure we don't // overwrite a previous bigger alpha with a smaller alpha (in order to avoid @@ -298,6 +299,29 @@ PixelData Typesetter::Render( const Vector2& size, RenderBehaviour behaviour, bo } } + // Calculate vertical line alignment + switch( mModel->GetVerticalLineAlignment() ) + { + case DevelText::VerticalLineAlignment::TOP: + { + break; + } + case DevelText::VerticalLineAlignment::MIDDLE: + { + const auto& line = *mModel->GetLines(); + penY -= line.descender; + penY += static_cast(line.lineSpacing*0.5f + line.descender); + break; + } + case DevelText::VerticalLineAlignment::BOTTOM: + { + const auto& line = *mModel->GetLines(); + const auto lineHeight = line.ascender + (-line.descender) + line.lineSpacing; + penY += static_cast(lineHeight - (line.ascender - line.descender)); + break; + } + } + // Generate the image buffers of the text for each different style first, // then combine all of them together as one final image buffer. We try to // do all of these in CPU only, so that once the final texture is generated, @@ -431,6 +455,12 @@ Devel::PixelBuffer Typesetter::CreateImageBuffer( const unsigned int bufferWidth // Increases the vertical offset with the line's ascender. glyphData.verticalOffset += static_cast( line.ascender ); + // Include line spacing after first line + if( lineIndex > 0u ) + { + glyphData.verticalOffset += static_cast( line.lineSpacing ); + } + // Retrieves the glyph's outline width float outlineWidth = mModel->GetOutlineWidth();