+ // Need to check if the given font supports the current character.
+ if(!isValidFont) // (1)
+ {
+ // Whether the current character is common for all scripts (i.e. white spaces, ...)
+
+ // Is not desirable to cache fonts for the common script.
+ //
+ // i.e. Consider the text " हिंदी", the 'white space' has assigned the DEVANAGARI script.
+ // The user may have set a font or the platform's default is used.
+ //
+ // As the 'white space' is the first character, no font is cached so the font validation
+ // retrieves a glyph from the given font.
+ //
+ // Many fonts support 'white spaces' so probably the font set by the user or the platform's default
+ // supports the 'white space'. However, that font may not support the DEVANAGARI script.
+ isCommonScript = TextAbstraction::IsCommonScript(character);
+
+ // Check in the valid fonts cache.
+ ValidateFontsPerScript* validateFontsPerScript = *(validFontsPerScriptCacheBuffer + script);
+
+ if(NULL != validateFontsPerScript)
+ {
+ // This cache stores valid fonts set by the user.
+ isValidFont = validateFontsPerScript->IsValidFont(fontId);
+
+ // It may happen that a validated font for a script doesn't have all the glyphs for that script.
+ // i.e a font validated for the CJK script may contain glyphs for the chinese language but not for the Japanese.
+ if(isValidFont)