X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fshaper.cpp;h=de41d0e2961529d773108573394d0156dd272871;hp=5313d0c118a829ed0161317b1016726759d69f2e;hb=d48e9b8b161367ad699c0352dfeb0128832bbe59;hpb=5b4982566aba41b5e21c3b8ce3e01a7e86db8f28 diff --git a/dali-toolkit/internal/text/shaper.cpp b/dali-toolkit/internal/text/shaper.cpp old mode 100644 new mode 100755 index 5313d0c..de41d0e --- a/dali-toolkit/internal/text/shaper.cpp +++ b/dali-toolkit/internal/text/shaper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -111,10 +111,14 @@ void ShapeText( const Vector& text, // There is no way to know the number of glyphs before shaping the text. // To avoid reallocations it's reserved space for a slightly biger number of glyphs than the number of characters. + GlyphInfo glyphInfo; + glyphInfo.isItalicRequired = false; + glyphInfo.isBoldRequired = false; + const Length currentNumberOfGlyphs = glyphs.Count(); const Length numberOfGlyphsReserved = static_cast( numberOfCharacters * 1.3f ); - glyphs.Resize( currentNumberOfGlyphs + numberOfGlyphsReserved ); - glyphToCharacterMap.Resize( currentNumberOfGlyphs + numberOfGlyphsReserved ); + glyphs.Reserve( currentNumberOfGlyphs + numberOfGlyphsReserved ); + glyphToCharacterMap.Reserve( currentNumberOfGlyphs + numberOfGlyphsReserved ); // The actual number of glyphs. Length totalNumberOfGlyphs = currentNumberOfGlyphs; @@ -137,6 +141,8 @@ void ShapeText( const Vector& text, currentFontId = fontRun.fontId; currentScript = scriptRun.script; + const bool isItalicRequired = fontRun.isItalicRequired; + const bool isBoldRequired = fontRun.isBoldRequired; // Get the min index to the last character of both runs. CharacterIndex currentIndex = min( fontRun.characterRun.characterIndex + fontRun.characterRun.numberOfCharacters, @@ -170,12 +176,17 @@ void ShapeText( const Vector& text, // Retrieve the glyphs and the glyph to character conversion map. Vector tmpGlyphs; Vector tmpGlyphToCharacterMap; - tmpGlyphs.Resize( numberOfGlyphs ); + + GlyphInfo glyphInfo; + glyphInfo.isItalicRequired = isItalicRequired; + glyphInfo.isBoldRequired = isBoldRequired; + + tmpGlyphs.Resize( numberOfGlyphs, glyphInfo ); tmpGlyphToCharacterMap.Resize( numberOfGlyphs ); shaping.GetGlyphs( tmpGlyphs.Begin(), tmpGlyphToCharacterMap.Begin() ); - // Update the indices. + // Update the new indices of the glyph to character map. if( 0u != totalNumberOfGlyphs ) { for( Vector::Iterator it = tmpGlyphToCharacterMap.Begin(),