From: Bowon Ryu Date: Fri, 10 Jan 2025 03:23:46 +0000 (+0900) Subject: Add fallback font find condition. X-Git-Tag: accepted/tizen/unified/20250115.005102~2^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F317928%2F3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Add fallback font find condition. Add condition for variation cases that do not follow some fallback priorities. TODO: We need to import full emoji table to dali for full emoji support. Change-Id: I9d0da6c079b7df9bdd177a980be610f9e911bd83 Signed-off-by: Bowon Ryu --- diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index 4729c52e3f..3cf9bdb797 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -63,10 +63,11 @@ void CheckFontSupportsCharacter( const FontId& cachedDefaultFontId, const TextAbstraction::FontDescription& currentFontDescription, const TextAbstraction::PointSize26Dot6& currentFontPointSize, - DefaultFonts**& defaultFontPerScriptCacheBuffer) + DefaultFonts**& defaultFontPerScriptCacheBuffer, + bool findFallbackFont) { // Need to check if the given font supports the current character. - if(!isValidFont) // (1) + if(!isValidFont && !findFallbackFont) // (1) { // Whether the current character is common for all scripts (i.e. white spaces, ...) @@ -179,6 +180,20 @@ void CheckFontSupportsCharacter( } // !isValidFont (3) } // !isValidFont (2) } // !isValidFont (1) + else if(!isValidFont && findFallbackFont) + { + // Find a fallback-font. + fontId = fontClient.FindFallbackFont(character, + currentFontDescription, + currentFontPointSize, + false); + + if(0u == fontId) + { + fontId = fontClient.FindDefaultFont(character, currentFontPointSize); + } + isValidFont = true; + } } } // unnamed namespace @@ -200,7 +215,6 @@ bool ValidateFontsPerScript::IsValidFont(FontId fontId) const void ValidateFontsPerScript::Cache(FontId fontId) { mValidFonts.PushBack(fontId); - return; } @@ -778,6 +792,21 @@ void MultilanguageSupport::ValidateFonts(TextAbstraction::FontClient& isValidFont = true; } + bool findFallbackFont = false; + if(TextAbstraction::IsEmojiVariationSequences(character) && !TextAbstraction::IsASCIIDigits(character)) + { + if(index + 1 <= lastCharacter) + { + const Character nextCharacter = *(textBuffer + index + 1); + findFallbackFont = (!TextAbstraction::IsEmojiPresentationSelector(nextCharacter) && !TextAbstraction::IsTextPresentationSelector(nextCharacter) && + !TextAbstraction::IsZeroWidthJoiner(nextCharacter) && !TextAbstraction::IsEmojiModifier(nextCharacter)); + } + else if(index == lastCharacter) + { + findFallbackFont = true; + } + } + // This is valid after CheckFontSupportsCharacter(); bool isCommonScript = false; @@ -788,7 +817,7 @@ void MultilanguageSupport::ValidateFonts(TextAbstraction::FontClient& // Need to check if the given font supports the current character. CheckFontSupportsCharacter(isValidFont, isCommonScript, character, validFontsPerScriptCacheBuffer, script, fontId, fontClient, - isValidCachedDefaultFont, cachedDefaultFontId, currentFontDescription, currentFontPointSize, defaultFontPerScriptCacheBuffer); + isValidCachedDefaultFont, cachedDefaultFontId, currentFontDescription, currentFontPointSize, defaultFontPerScriptCacheBuffer, findFallbackFont); if(isEmojiScript && (previousScript != script)) {