From: Bowon Ryu Date: Tue, 27 May 2025 05:42:50 +0000 (+0900) Subject: Fix emoji presentation error when using incorrect vs16 X-Git-Tag: dali_2.4.21~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F324810%2F1;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Fix emoji presentation error when using incorrect vs16 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 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index 5d4c301f7c..fec9ffc8db 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -1262,10 +1262,11 @@ int UtcDaliToolkitTextLabelEmojisP(void) // EMOJI Sequences case for coverage. std::string emojiSequences = - "Glyphs not included in the font \n" //case for coverage when glyph is not included in the font - "Text VS15 ☪︎\n" //text presentation sequence and selector - "Color VS16 ☪️\n" //emoji presentation sequence and selector - "Default ☪ \n" //default presentation + "Glyphs not included in the font \n" // case for coverage when glyph is not included in the font + "Text VS15 ☪︎\n" // text presentation sequence and selector + "Color VS16 ☪️\n" // emoji presentation sequence and selector + "Default ☪ \n" // default presentation + "\U0001F465\ufe0f\U0001F468\u200d\U0001F469\u200D\U0001F467\u200D\U0001F466\n" // negative emoji presentation sequence and selector "FamilyManWomanGirlBoy 👨‍👩‍👧‍👦\n" // emoji multi zwj sequence "WomanScientist 👩‍🔬\n" // emoji zwj sequence "WomanScientistLightSkinTone👩🏻‍🔬 \n" // emoji modifier sequence: skin tone & JWZ diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index dd5e4e56c6..3fda28ac61 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -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));