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=f251025a6b314ed8662c459d7c216168ab655f7b;hb=64184de859e515190adf28466fa9f9dd8f8437e9;hpb=bbb87601fa60e55b9fab364747befef8c8ca9042 diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index f251025..47db1e2 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -21,12 +21,12 @@ // EXTERNAL INCLUDES #include #include -#include -#include -#include +#include +#include +#include // INTERNAL INCLUDES -#include +#include #include #include #include @@ -450,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 ) { @@ -472,28 +492,6 @@ 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 if( !IsValidForAllScripts( character ) ) - { - // Add the font to the valid font cache. - validateFontsPerScript = new ValidateFontsPerScript(); - *( validFontsPerScriptCacheBuffer + script ) = validateFontsPerScript; - - validateFontsPerScript->mValidFonts.PushBack( fontId ); - } - } } } // !isDefault