From eb7a3f288a5d3e96d64f948505e3853d3622b8e2 Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Thu, 23 Feb 2023 18:38:06 +0900 Subject: [PATCH] Fix space font validation condition when character is 0x20, there are various cases of font validation. but if it is a default font or cached font, or if a glyph exists in the current font when it is contiguous with the prev char, it is natural to load current font. this is same behaviour as before.. and the process of finding fonts can slightly reduced. Change-Id: I017db2ec38e86642a83a44739a0d2c7af072e14a --- .../internal/text/multi-language-support-impl.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index f24d427..2ba2793 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -468,8 +468,10 @@ void MultilanguageSupport::ValidateFonts(const Vector& Vector::ConstIterator scriptRunEndIt = scripts.End(); bool isNewParagraphCharacter = false; - FontId previousEmojiFontId = 0u; - TextAbstraction::Script previousScript = TextAbstraction::UNKNOWN; + FontId previousEmojiFontId = 0u; + FontId currentFontId = 0u; + FontId previousFontId = 0u; + TextAbstraction::Script previousScript = TextAbstraction::UNKNOWN; CharacterIndex lastCharacter = startIndex + numberOfCharacters - 1u; for(Length index = startIndex; index <= lastCharacter; ++index) @@ -493,6 +495,7 @@ void MultilanguageSupport::ValidateFonts(const Vector& // Get the font for the current character. FontId fontId = fontClient.GetFontId(currentFontDescription, currentFontPointSize); + currentFontId = fontId; // Get the script for the current character. Script script = GetScript(index, @@ -554,6 +557,15 @@ void MultilanguageSupport::ValidateFonts(const Vector& } } + if(TextAbstraction::IsSpace(character) && + TextAbstraction::HasLigatureMustBreak(script) && + isValidCachedDefaultFont && + (isDefaultFont || (currentFontId == previousFontId))) + { + fontId = cachedDefaultFontId; + isValidFont = true; + } + // If the given font is not valid, it means either: // - there is no cached font for the current script yet or, // - the user has set a different font than the default one for the current script or, @@ -776,6 +788,7 @@ void MultilanguageSupport::ValidateFonts(const Vector& // Whether the current character is a new paragraph character. isNewParagraphCharacter = TextAbstraction::IsNewParagraph(character); previousScript = script; + previousFontId = currentFontId; } // end traverse characters. if(0u != currentFontRun.characterRun.numberOfCharacters) -- 2.7.4