X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fmulti-language-support-impl.cpp;h=79de1e1b8d061924441ea2a82124f78a1a53b6aa;hb=fff10a9ef11e606e67fe12c366dae5741937ff37;hp=96210cabcb7f4bb0fc51d81bfead3903ad791dc3;hpb=e4a4f86d7504f8823efd25da04c1a2a37554dac5;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index 96210ca..79de1e1 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -22,6 +22,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -37,6 +38,8 @@ namespace Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_MULTI_LANGUAGE_SUPPORT"); #endif +DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_FONT_PERFORMANCE_MARKER, false); + const Dali::Toolkit::Text::Character UTF32_A = 0x0041; } // namespace @@ -423,6 +426,8 @@ void MultilanguageSupport::ValidateFonts(const Vector& return; } + DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_FONTS_VALIDATE"); + // Find the first index where to insert the font run. FontRunIndex fontIndex = 0u; if(0u != startIndex) @@ -468,8 +473,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 +500,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, @@ -542,7 +550,7 @@ void MultilanguageSupport::ValidateFonts(const Vector& } bool isCommonScript = false; - bool isEmojiScript = TextAbstraction::IsEmojiScript(script) || TextAbstraction::IsEmojiColorScript(script) || TextAbstraction::IsEmojiTextScript(script); + bool isEmojiScript = TextAbstraction::IsOneOfEmojiScripts(script); if(isEmojiScript && (previousScript == script)) { @@ -554,6 +562,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, @@ -628,6 +645,7 @@ void MultilanguageSupport::ValidateFonts(const Vector& { // Use the cached default font for the script if there is one. fontId = cachedDefaultFontId; + isValidFont = true; } else { @@ -660,6 +678,7 @@ void MultilanguageSupport::ValidateFonts(const Vector& } } defaultFontsPerScript->Cache(currentFontDescription, fontId); + isValidFont = true; } } } // !isValidFont (3) @@ -729,6 +748,15 @@ void MultilanguageSupport::ValidateFonts(const Vector& description.path.c_str()); } #endif + if(!isValidFont && !isCommonScript) + { + Dali::TextAbstraction::FontDescription descriptionForLog; + fontClient.GetDescription(fontId, descriptionForLog); + DALI_LOG_RELEASE_INFO("Validated font set fail : Character : %x, Script : %s, Font : %s \n", + character, + Dali::TextAbstraction::ScriptName[script], + descriptionForLog.path.c_str()); + } // Whether bols style is required. isBoldRequired = (currentFontDescription.weight >= TextAbstraction::FontWeight::BOLD); @@ -765,6 +793,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)