1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

2048: Ensure that correct font is requested

Previously, during the start of the game BoardView component tried to
get the font from the database passing empty string as a parameter.
It caused a debug message informing user that the lookup failed.
This commit is contained in:
Jakub Pyszczak 2024-02-17 22:20:42 +01:00 committed by Ali Mohammad Pur
parent cb97eef2cf
commit ac49617183

View file

@ -58,10 +58,14 @@ void BoardView::pick_font()
}
});
auto font = font_database.get_by_name(best_font_name);
if (best_font_name.is_empty()) {
dbgln("Failed to find a good font for size {}, using the default font", m_cell_size / 2);
best_font_name = font_database.default_font().qualified_name();
}
auto const font = font_database.get_by_name(best_font_name);
set_font(font);
m_min_cell_size = best_font_size;
m_min_cell_size = font->pixel_size_rounded_up();
}
size_t BoardView::rows() const