Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/sdl_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,15 @@ SDL_Texture_Ptr CachedTTFFont::create_glyph( const SDL_Renderer_Ptr &renderer,

bool CachedTTFFont::isGlyphProvided( const std::string &ch ) const
{
return TTF_GlyphIsProvided( font.get(), UTF8_getch( ch ) );
// Just return false if the glyph is not provided by the font
if( !TTF_GlyphIsProvided( font.get(), UTF8_getch( ch ) ) ) {
return false;
}

// Test whether the glyph can actually be rendered
constexpr SDL_Color white{255, 255, 255, 0};
SDL_Surface_Ptr surface( TTF_RenderUTF8_Solid( font.get(), ch.c_str(), white ) );
return static_cast<bool>( surface );
}

void CachedTTFFont::OutputChar( const SDL_Renderer_Ptr &renderer, const GeometryRenderer_Ptr &,
Expand Down