X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fshaper.cpp;h=9ca8e9f1cc03301ecb6ece735eaa1814f363b9bd;hb=3af09a190a90030049f6190ddd86522dc066c58a;hp=c0c45fd109f2d1ae55a8ff3791dd803614ed0657;hpb=3b1fb566901d21b8303d9be3308e3920f5182e6d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/shaper.cpp b/dali-toolkit/internal/text/shaper.cpp index c0c45fd..9ca8e9f 100644 --- a/dali-toolkit/internal/text/shaper.cpp +++ b/dali-toolkit/internal/text/shaper.cpp @@ -19,14 +19,14 @@ #include // EXTERNAL INCLUDES -#include -#include +#include +#include // INTERNAL INCLUDES #include -#include +#include #include -#include +#include namespace Dali { @@ -131,11 +131,17 @@ void ShapeText( const Vector& text, } } - // Check if the current index is a white space. Do not want to shape a \n. + // Check if the current index is a new paragraph character. + // A \n is going to be shaped in order to not to mess the conversion tables. + // After the \n character is shaped, the glyph is going to be reset to its + // default in order to not to get any metric or font index for it. + const bool isNewParagraph = TextAbstraction::IsNewParagraph( *( textBuffer + currentIndex ) ); + // The last character is always a must-break even if it's not a \n. Length numberOfCharactersToShape = currentIndex - previousIndex; - if( mustBreak && !TextAbstraction::IsWhiteSpace( *( textBuffer + currentIndex ) ) ) + if( mustBreak ) { + // Add one more character to shape. ++numberOfCharactersToShape; } @@ -164,6 +170,18 @@ void ShapeText( const Vector& text, shaping.GetGlyphs( glyphsBuffer + glyphIndex, glyphToCharacterMapBuffer + glyphIndex ); + if( isNewParagraph ) + { + // TODO : This is a work around to avoid drawing a square in the + // place of a new line character. + + // If the last character is a \n, it resets the glyph to the default + // to avoid getting any metric for it. + GlyphInfo& glyph = *( glyphsBuffer + glyphIndex + ( numberOfGlyphs - 1u ) ); + + glyph = GlyphInfo(); + } + // Update indices. if( 0u != glyphIndex ) { @@ -207,14 +225,6 @@ void ShapeText( const Vector& text, glyphToCharacterMap.Resize( totalNumberOfGlyphs ); } -void ShapeText( const LogicalModel& logicalModel, - VisualModel& visualModel, - CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - Length numberOfCharactersToInsert ) -{ -} - } // namespace Text } // namespace Toolkit