Support emojis on macOS 63/245963/3
authorWander Lairson Costa <wander.lairson@gmail.com>
Tue, 20 Oct 2020 21:33:12 +0000 (18:33 -0300)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 5 Jan 2021 18:26:56 +0000 (18:26 +0000)
We need to add the "Apple Color Emoji" font to the lits of fonts in
Apple devices.

Change-Id: I2e268700e2bd69b613caaa31a87fd8fc16829195

dali/internal/text/text-abstraction/font-client-plugin-impl.cpp

index 113931a..5adf76f 100755 (executable)
@@ -32,6 +32,8 @@
 
 // EXTERNAL INCLUDES
 #include <fontconfig/fontconfig.h>
+#include <algorithm>
+#include <iterator>
 
 namespace
 {
@@ -841,6 +843,21 @@ FontId FontClient::Plugin::FindFallbackFont( Character charcode,
     characterSetList = new CharacterSetList;
 
     SetFontList( fontDescription, *fontList, *characterSetList );
+#ifdef __APPLE__
+    FontDescription appleColorEmoji;
+    appleColorEmoji.family = "Apple Color Emoji";
+    appleColorEmoji.width = fontDescription.width;
+    appleColorEmoji.weight = fontDescription.weight;
+    appleColorEmoji.slant = fontDescription.slant;
+    FontList emojiFontList;
+    CharacterSetList emojiCharSetList;
+    SetFontList(appleColorEmoji, emojiFontList, emojiCharSetList);
+
+    std::move(fontList->begin(), fontList->end(), std::back_inserter(emojiFontList));
+    emojiCharSetList.Insert(emojiCharSetList.End(), characterSetList->Begin(), characterSetList->End());
+    *fontList = std::move(emojiFontList);
+    *characterSetList = std::move(emojiCharSetList);
+#endif
 
     // Add the font-list to the cache.
     mFallbackCache.push_back( std::move( FallbackCacheItem( std::move( fontDescription ), fontList, characterSetList ) ) );