X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Ftext%2Fbitmap-font.cpp;h=77bf3ff06993a7bfcc289169de3a4c0fcd5470ba;hb=8bd30b68a677d5ecb5077ac97331e5ebf2f0f15e;hp=1e0e9c6e7573edc3c9111bb23627f0c83f8ee774;hpb=87a9019904ab49c42f1e32e7ebb6a1512b0dc28c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/devel-api/text/bitmap-font.cpp b/dali-toolkit/devel-api/text/bitmap-font.cpp index 1e0e9c6..77bf3ff 100755 --- a/dali-toolkit/devel-api/text/bitmap-font.cpp +++ b/dali-toolkit/devel-api/text/bitmap-font.cpp @@ -19,30 +19,39 @@ #include // EXTERNAL INCLUDE -#include #include +#include // INTERNAL INCLUDE #include -#include - namespace Dali { namespace Toolkit { -using namespace Text; + namespace DevelText { Glyph::Glyph() : url{}, - utf8{ 0u }, + utf8{}, ascender{ 0.f }, descender{ 0.f } {} +Glyph::Glyph( const std::string& url, const std::string utf8Character, float ascender, float descender ) +: url{ url }, + utf8{}, + ascender{ ascender }, + descender{ descender } +{ + DALI_ASSERT_DEBUG( utf8Character.size() <= 4u ); + + std::copy( utf8Character.begin(), utf8Character.end(), utf8 ); +} + Glyph::~Glyph() {} @@ -50,7 +59,8 @@ BitmapFontDescription::BitmapFontDescription() : glyphs{}, name{}, underlinePosition{ 0.f }, - underlineThickness{ 1.f } + underlineThickness{ 1.f }, + isColorFont{ false } {} BitmapFontDescription::~BitmapFontDescription() @@ -62,20 +72,14 @@ void CreateBitmapFont( const BitmapFontDescription& description, TextAbstraction bitmapFont.name = description.name; bitmapFont.underlinePosition = description.underlinePosition; bitmapFont.underlineThickness = description.underlineThickness; + bitmapFont.isColorFont = description.isColorFont; for( const auto& glyph : description.glyphs ) { - // 1) Convert to utf32 - Vector utf32; - utf32.Resize( glyph.utf8.size() ); - - const uint32_t numberOfCharacters = ( glyph.utf8.size() == 0 ) ? 0 : - Text::Utf8ToUtf32( reinterpret_cast( glyph.utf8.c_str() ), - glyph.utf8.size(), - &utf32[0u] ); - utf32.Resize( numberOfCharacters ); + uint32_t c = 0u; + Text::Utf8ToUtf32( glyph.utf8, Text::GetUtf8Length( glyph.utf8[0u] ), &c ); - TextAbstraction::BitmapGlyph bitmapGlyph( glyph.url, utf32[0u], glyph.ascender, glyph.descender ); + TextAbstraction::BitmapGlyph bitmapGlyph( glyph.url, c, glyph.ascender, glyph.descender ); bitmapFont.glyphs.push_back( std::move( bitmapGlyph ) ); }