X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fmulti-language-support-impl.cpp;h=47db1e2bbe641d9dcd88aaa0b2557dd50a1a519e;hp=4c68a74d5bd6613f97bd7aa26d9c06eb468a63b6;hb=64184de859e515190adf28466fa9f9dd8f8437e9;hpb=3b1fb566901d21b8303d9be3308e3920f5182e6d diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index 4c68a74..47db1e2 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -21,14 +21,15 @@ // EXTERNAL INCLUDES #include #include -#include -#include -#include +#include +#include +#include // INTERNAL INCLUDES -#include +#include #include #include +#include namespace Dali { @@ -449,12 +450,32 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, { // Check in the valid fonts cache. ValidateFontsPerScript* validateFontsPerScript = *( validFontsPerScriptCacheBuffer + script ); + + if( NULL == validateFontsPerScript ) + { + validateFontsPerScript = new ValidateFontsPerScript(); + + *( validFontsPerScriptCacheBuffer + script ) = validateFontsPerScript; + } + if( NULL != validateFontsPerScript ) { if( !validateFontsPerScript->FindValidFont( fontId ) ) { // Use the font client to validate the font. - const GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character ); + GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character ); + + // Emojis are present in many monochrome fonts; prefer color by default. + if( TextAbstraction::EMOJI == script && + 0u != glyphIndex ) + { + BufferImage bitmap = fontClient.CreateBitmap( fontId, glyphIndex ); + if( bitmap && + Pixel::BGRA8888 != bitmap.GetPixelFormat() ) + { + glyphIndex = 0; + } + } if( 0u == glyphIndex ) { @@ -471,30 +492,8 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, } } } - else - { - // Use the font client to validate the font. - const GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character ); - - if( 0u == glyphIndex ) - { - // Get the point size of the current font. It will be used to get a default font id. - pointSize = fontClient.GetPointSize( fontId ); - - // The font is not valid. Set to zero and a default one will be set. - fontId = 0u; - } - else - { - // Add the font to the valid font cache. - validateFontsPerScript = new ValidateFontsPerScript(); - *( validFontsPerScriptCacheBuffer + script ) = validateFontsPerScript; - - validateFontsPerScript->mValidFonts.PushBack( fontId ); - } - } } - } + } // !isDefault // The font has not been validated. Find a default one. if( 0u == fontId )