X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fmulti-language-support-impl.cpp;h=6ca96ad284b10a8ed37223829b2a95c2312762f4;hb=0686e6d654472bffc56910890f39031ceac32d3b;hp=7570e041d5b154e821dd37e221cd3fcf0680c1c6;hpb=d8a9f274a51e12a7d5690f691234e50fc06aa1fe;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 7570e04..6ca96ad 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -440,12 +440,18 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, FontId previousFontId = 0u; bool isPreviousEmojiScript = false; + // Description of fallback font which is selected at current iteration. + TextAbstraction::FontDescription selectedFontDescription; + CharacterIndex lastCharacter = startIndex + numberOfCharacters; for( Length index = startIndex; index < lastCharacter; ++index ) { // Get the current character. const Character character = *( textBuffer + index ); + bool needSoftwareBoldening = false; + bool needSoftwareItalic = false; + // new description for current character TextAbstraction::FontDescription currentFontDescription; TextAbstraction::PointSize26Dot6 currentFontPointSize = defaultFontPointSize; bool isDefaultFont = true; @@ -689,9 +695,22 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, } #endif + if( fontId != currentFontRun.fontId ) + { + fontClient.GetDescription(fontId,selectedFontDescription); + } + + // Developer sets bold to character but selected font cannot support it + needSoftwareBoldening = ( currentFontDescription.weight >= TextAbstraction::FontWeight::BOLD ) && ( selectedFontDescription.weight < TextAbstraction::FontWeight::BOLD ); + + // Developer sets italic to character but selected font cannot support it + needSoftwareItalic = ( currentFontDescription.slant == TextAbstraction::FontSlant::ITALIC ) && ( selectedFontDescription.slant < TextAbstraction::FontSlant::ITALIC ); + // The font is now validated. if( ( fontId != currentFontRun.fontId ) || - isNewParagraphCharacter ) + isNewParagraphCharacter || + // If font id is same as previous but style is diffrent, initialize new one + ( ( fontId == currentFontRun.fontId ) && ( ( needSoftwareBoldening != currentFontRun.softwareBold ) || ( needSoftwareItalic != currentFontRun.softwareItalic ) ) ) ) { // Current run needs to be stored and a new one initialized. @@ -706,6 +725,8 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, currentFontRun.characterRun.characterIndex = currentFontRun.characterRun.characterIndex + currentFontRun.characterRun.numberOfCharacters; currentFontRun.characterRun.numberOfCharacters = 0u; currentFontRun.fontId = fontId; + currentFontRun.softwareItalic = needSoftwareItalic; + currentFontRun.softwareBold = needSoftwareBoldening; } // Add one more character to the run.