Separate handling of events which modify the Model
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / multi-language-support-impl.cpp
index 6e41ae3..fa50497 100644 (file)
 #include <dali/public-api/text-abstraction/script.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/logical-model.h>
+#include <dali-toolkit/internal/text/logical-model-impl.h>
 #include <dali-toolkit/internal/text/font-run.h>
 #include <dali-toolkit/internal/text/script-run.h>
+#include <dali-toolkit/internal/text/text-io.h>
 
 namespace Dali
 {
@@ -484,7 +485,7 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
             // The font is not valid. Set to zero and a default one will be set.
             fontId = 0u;
           }
-          else
+          else if( !IsValidForAllScripts( character ) )
           {
             // Add the font to the valid font cache.
             validateFontsPerScript = new ValidateFontsPerScript();
@@ -494,7 +495,7 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
           }
         }
       }
-    }
+    } // !isDefault
 
     // The font has not been validated. Find a default one.
     if( 0u == fontId )
@@ -505,8 +506,11 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
       // If the cache has not a default font, get one from the font client.
       if( 0u == fontId )
       {
+        // Emojis are present in many monochrome fonts; prefer color by default.
+        bool preferColor = ( TextAbstraction::EMOJI == script );
+
         // Find a default font.
-        fontId = fontClient.FindDefaultFont( character, pointSize );
+        fontId = fontClient.FindDefaultFont( character, pointSize, preferColor );
 
         // If the system does not support a suitable font, fallback to Latin
         if( 0u == fontId )