1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-28 09:14:58 +01:00

Try Arial as a fallback font if a language's preferred font cannot be loaded.

This commit is contained in:
Aaron van Geffen
2015-12-25 03:20:58 +09:00
parent 474af5c204
commit 995799b843

View File

@@ -173,10 +173,18 @@ int language_open(int id)
ttf_dispose();
gUseTrueTypeFont = true;
gCurrentTTFFontSet = LanguagesDescriptors[id].font;
if (!ttf_initialise()) {
log_warning("Unable to initialise TrueType fonts.");
bool font_initialised = ttf_initialise();
// Fall back to sprite font
// Have we tried Arial yet?
if (!font_initialised && gCurrentTTFFontSet != &TTFFontArial) {
log_warning("Unable to initialise prefered TrueType font -- falling back to Arial.");
gCurrentTTFFontSet = &TTFFontArial;
font_initialised = ttf_initialise();
}
// Fall back to sprite font.
if (!font_initialised) {
log_warning("Falling back to sprite font.");
gUseTrueTypeFont = false;
gCurrentTTFFontSet = nullptr;
return 0;