+ // This cache stores fall-back fonts.
+ cachedDefaultFontId = defaultFonts->FindFont( fontClient,
+ currentFontDescription,
+ currentFontPointSize );
+ }
+
+ // Whether the cached default font is valid.
+ const bool isValidCachedDefaultFont = 0u != cachedDefaultFontId;
+
+ // The font is valid if it matches with the default one for the current script and size and it's different than zero.
+ isValidFont = isValidCachedDefaultFont && ( fontId == cachedDefaultFontId );
+
+ if( isValidFont )
+ {
+ // Check if the font supports the character.
+ isValidFont = fontClient.IsCharacterSupportedByFont( fontId, character );
+ }
+
+ bool isCommonScript = false;
+ bool isEmojiScript = TextAbstraction::EMOJI == script;
+
+ if( isEmojiScript && !isPreviousEmojiScript )
+ {
+ if( 0u != currentFontRun.characterRun.numberOfCharacters )
+ {
+ // Store the font run.
+ fonts.Insert( fonts.Begin() + fontIndex, currentFontRun );
+ ++fontIndex;
+ }
+
+ // Initialize the new one.
+ currentFontRun.characterRun.characterIndex = currentFontRun.characterRun.characterIndex + currentFontRun.characterRun.numberOfCharacters;
+ currentFontRun.characterRun.numberOfCharacters = 0u;
+ currentFontRun.fontId = fontId;