Fix emoji presentation error when using incorrect vs16 10/324810/1
authorBowon Ryu <bowon.ryu@samsung.com>
Tue, 27 May 2025 05:42:50 +0000 (14:42 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Tue, 27 May 2025 05:42:50 +0000 (14:42 +0900)
The main problem is that there is no variation selector in the samsung color emoji font.

However, the variation selector is not a glyph that is rendered,
so it should work regardless of whether the glyph exists in the font.

This patch finds the color font regardless of whether the vs glyph exists in the problem.

Related:
https://review.tizen.org/gerrit/c/platform/core/uifw/dali-adaptor/+/324809

Change-Id: I4e29db1b15878c5f3b373ecd0b0551e89a15c120
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
dali-toolkit/internal/text/multi-language-support-impl.cpp

index 5d4c301f7c0f0d8e953fc9f07fd663d3e1fc7189..fec9ffc8dbec21e6a6036beb70a894344da19c7a 100644 (file)
@@ -1262,10 +1262,11 @@ int UtcDaliToolkitTextLabelEmojisP(void)
 
   // EMOJI Sequences case for coverage.
   std::string emojiSequences =
-    "Glyphs not included in the font &#xf01a;&#xf01b;&#xf01c;&#xf01d;&#xf01e;&#xf01f;\n"   //case for coverage when glyph is not included in the font
-    "Text VS15 &#x262a;&#xfe0e;\n"                                                         //text presentation sequence and selector
-    "Color VS16 &#x262a;&#xfe0f;\n"                                                        //emoji presentation sequence and selector
-    "Default &#x262a; \n"                                                                  //default presentation
+    "Glyphs not included in the font &#xf01a;&#xf01b;&#xf01c;&#xf01d;&#xf01e;&#xf01f;\n"   // case for coverage when glyph is not included in the font
+    "Text VS15 &#x262a;&#xfe0e;\n"                                                         // text presentation sequence and selector
+    "Color VS16 &#x262a;&#xfe0f;\n"                                                        // emoji presentation sequence and selector
+    "Default &#x262a; \n"                                                                  // default presentation
+    "\U0001F465\ufe0f\U0001F468\u200d\U0001F469\u200D\U0001F467\u200D\U0001F466\n"         // negative emoji presentation sequence and selector
     "FamilyManWomanGirlBoy &#x1F468;&#x200D;&#x1F469;&#x200D;&#x1F467;&#x200D;&#x1F466;\n" // emoji multi zwj sequence
     "WomanScientist &#x1f469;&#x200d;&#x1f52c;\n"                                          // emoji zwj sequence
     "WomanScientistLightSkinTone&#x1F469;&#x1F3FB;&#x200D;&#x1F52C; \n"                    // emoji modifier sequence: skin tone & JWZ
index dd5e4e56c6e6db9990b10b7be679d191ebbd0ebd..3fda28ac61855dc246f17544872619efff372913 100644 (file)
@@ -43,6 +43,7 @@ DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_FONT_PERFORMANCE_MARKER, false);
 
 const Dali::Toolkit::Text::Character UTF32_A     = 0x0041;
 const Dali::Toolkit::Text::Character UTF32_COLON = 0x3A;
+const Dali::Toolkit::Text::Character UTF32_EMOJI = 0x1F600; // Grinning Face
 
 const char* DALI_TEXT_ENABLE_ICU("DALI_TEXT_ENABLE_ICU");
 const int   DEFAULT_ENABLE_ICU   = 0;
@@ -894,17 +895,25 @@ void MultilanguageSupport::ValidateFonts(TextAbstraction::FontClient&
           if(TextAbstraction::IsEmojiTextScript(script))
           {
             // Find a fallback-font.
-            requestedFontId = fontClient.FindFallbackFont(character,
-                                         currentFontDescription,
-                                         currentFontPointSize,
-                                         false);
-
+            requestedFontId = fontClient.FindFallbackFont(character, currentFontDescription, currentFontPointSize, false);
             if(fontClient.IsColorGlyph(requestedFontId, glyphIndexChar))
             {
               // Try to find text style glyph.
               requestedFontId = 0;
             }
           }
+          else if(TextAbstraction::IsEmojiColorScript(script) && TextAbstraction::IsEmojiPresentationSelector(character))
+          {
+            if(IsEmojiScript(previousScript) && fontClient.IsColorFont(previousFontId))
+            {
+              requestedFontId = previousFontId;
+            }
+            else
+            {
+              // There are Color emoji fonts that do not have Variation Selector glyphs. Search for fonts using the basic emoji unicode code point.
+              requestedFontId = fontClient.FindFallbackFont(UTF32_EMOJI, currentFontDescription, currentFontPointSize, true);
+            }
+          }
           if(0u == requestedFontId)
           {
             requestedFontId = fontClient.FindDefaultFont(character, currentFontPointSize, IsEmojiColorScript(script));