Skip to content

Commit

Permalink
fix the crash by bulding the font atlas
Browse files Browse the repository at this point in the history
and then start and end a frame so that things work correctly.

Fixes CleverRaven#75818
  • Loading branch information
Daniel Brooks committed Aug 31, 2024
1 parent 13f5534 commit ce05805
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cata_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ void cataimgui::client::load_fonts( const Font_Ptr &cata_font,
io.Fonts->Fonts[0]->SetFallbackStrSizeCallback( GetFallbackStrWidth );
io.Fonts->Fonts[0]->SetFallbackCharSizeCallback( GetFallbackCharWidth );
io.Fonts->Fonts[0]->SetRenderFallbackCharCallback( CanRenderFallbackChar );
io.Fonts->Build();
ImGui::SetCurrentFont( ImGui::GetDefaultFont() );
ImGui_ImplSDLRenderer2_SetFallbackGlyphDrawCallback( [&]( const ImFontGlyphToDraw & glyph ) {
std::string uni_string = std::string( glyph.uni_str );
point p( int( glyph.pos.x ), int( glyph.pos.y - 3 ) );
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,8 @@ int main( int argc, const char *argv[] )

#if defined(LOCALIZE)
if( get_option<std::string>( "USE_LANG" ).empty() && !SystemLocale::Language().has_value() ) {
imclient->new_frame(); // we have to prime the pump, because of reasons
imclient->end_frame();
const std::string lang = select_language();
get_options().get_option( "USE_LANG" ).setValue( lang );
set_language_from_options();
Expand Down

0 comments on commit ce05805

Please sign in to comment.