diff --git a/src/eepp/graphics/systemfontresolver.cpp b/src/eepp/graphics/systemfontresolver.cpp index 580999906..bd0a6efb9 100644 --- a/src/eepp/graphics/systemfontresolver.cpp +++ b/src/eepp/graphics/systemfontresolver.cpp @@ -504,7 +504,8 @@ FontDesc SystemFontResolver::getFallbackForCodepoint( Uint32 codepoint, FontWeig } FontDesc nativeMatch = matchFallbackForCodepoint( codepoint, weight, italic ); - if ( !nativeMatch.path.empty() && !( isEmoji && fontHasSvgTable( nativeMatch.path ) ) ) { + if ( !nativeMatch.path.empty() && fontContainsCodepoint( nativeMatch.path, codepoint ) && + !( isEmoji && fontHasSvgTable( nativeMatch.path ) ) ) { Lock lock( mMutex ); mCodepointFallbackCache[codepoint] = nativeMatch.path; return nativeMatch; diff --git a/src/tests/unit_tests/fontrendering_tests.cpp b/src/tests/unit_tests/fontrendering_tests.cpp index 16066e827..5db5008ad 100644 --- a/src/tests/unit_tests/fontrendering_tests.cpp +++ b/src/tests/unit_tests/fontrendering_tests.cpp @@ -375,6 +375,10 @@ UTEST( FontRendering, shapedTextUsesSystemFallbackForCommonSymbols ) { const Uint32 codepoint = symbols[glyph.stringIndex]; if ( codepoint == ' ' ) continue; + FontDesc fallback = SystemFontResolver::instance()->getFallbackForCodepoint( + codepoint, FontWeight::Normal, false ); + if ( fallback.path.empty() ) + continue; EXPECT_NE( 0u, glyph.glyphIndex ); EXPECT_NE( font.get(), glyph.font ); }