{
// Initializes the default font cache to zero (invalid font).
// Reserves space to cache the default fonts and access them with the script as an index.
- mDefaultFontPerScriptCache.Resize( TextAbstraction::UNKNOWN, NULL );
+ mDefaultFontPerScriptCache.Resize( TextAbstraction::UNKNOWN + 1, NULL );
// Initializes the valid fonts cache to NULL (no valid fonts).
// Reserves space to cache the valid fonts and access them with the script as an index.
- mValidFontsPerScriptCache.Resize( TextAbstraction::UNKNOWN, NULL );
+ mValidFontsPerScriptCache.Resize( TextAbstraction::UNKNOWN + 1, NULL );
}
MultilanguageSupport::~MultilanguageSupport()
currentScriptRun.characterRun.numberOfCharacters += numberOfAllScriptCharacters;
// Store the script run.
- if( TextAbstraction::UNKNOWN == currentScriptRun.script )
- {
- currentScriptRun.script = TextAbstraction::LATIN;
- }
scripts.Insert( scripts.Begin() + scriptIndex, currentScriptRun );
++scriptIndex;
else if( ( TextAbstraction::UNKNOWN == currentScriptRun.script ) &&
( TextAbstraction::EMOJI == script ) )
{
- currentScriptRun.script = TextAbstraction::LATIN;
currentScriptRun.characterRun.numberOfCharacters += numberOfAllScriptCharacters;
numberOfAllScriptCharacters = 0u;
}
if( 0u != currentScriptRun.characterRun.numberOfCharacters )
{
- if( TextAbstraction::UNKNOWN == currentScriptRun.script )
- {
- // There are only white spaces in the last script. Set the latin script.
- currentScriptRun.script = TextAbstraction::LATIN;
- }
-
// Store the last run.
scripts.Insert( scripts.Begin() + scriptIndex, currentScriptRun );
++scriptIndex;
FontId previousFontId = 0u;
bool isPreviousEmojiScript = false;
- // Whether it's the first set of characters to be validated.
- // Used in case the paragraph starts with characters common to all scripts.
- bool isFirstSetToBeValidated = true;
-
CharacterIndex lastCharacter = startIndex + numberOfCharacters;
for( Length index = startIndex; index < lastCharacter; ++index )
{
description.path.c_str() );
}
#endif
- if( script == TextAbstraction::UNKNOWN )
- {
- script = TextAbstraction::LATIN;
- }
// Validate whether the current character is supported by the given font.
bool isValidFont = false;
fontId = fontClient.FindDefaultFont( UTF32_A, currentFontPointSize );
}
- // Cache the font.
- if( NULL == defaultFontsPerScript )
+ if ( script != TextAbstraction::UNKNOWN )
{
- defaultFontsPerScript = *( defaultFontPerScriptCacheBuffer + script );
-
+ // Cache the font if it is not an unknown script
if( NULL == defaultFontsPerScript )
{
- defaultFontsPerScript = new DefaultFonts();
- *( defaultFontPerScriptCacheBuffer + script ) = defaultFontsPerScript;
+ defaultFontsPerScript = *( defaultFontPerScriptCacheBuffer + script );
+
+ if( NULL == defaultFontsPerScript )
+ {
+ defaultFontsPerScript = new DefaultFonts();
+ *( defaultFontPerScriptCacheBuffer + script ) = defaultFontsPerScript;
+ }
}
+ defaultFontsPerScript->Cache( currentFontDescription, fontId );
}
- defaultFontsPerScript->Cache( currentFontDescription, fontId );
}
} // !isValidFont (3)
} // !isValidFont (2)
}
#endif
- if( isFirstSetToBeValidated && !isCommonScript )
- {
- currentFontRun.fontId = fontId;
- isFirstSetToBeValidated = false;
- }
-
// The font is now validated.
if( ( fontId != currentFontRun.fontId ) ||
isNewParagraphCharacter )
currentFontRun.characterRun.characterIndex = currentFontRun.characterRun.characterIndex + currentFontRun.characterRun.numberOfCharacters;
currentFontRun.characterRun.numberOfCharacters = 0u;
currentFontRun.fontId = fontId;
-
- if( isNewParagraphCharacter )
- {
- isFirstSetToBeValidated = true;
- }
}
// Add one more character to the run.