mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-28 01:04:50 +01:00
improve language load fail behaviour
improve currencies fix bug in supported glyph check
This commit is contained in:
@@ -3899,7 +3899,7 @@ STR_5557 :Stay connected after desynchronisation (Multiplayer)
|
||||
STR_5558 :A restart is required for this setting to take effect
|
||||
STR_5559 :10 min. inspections
|
||||
STR_5560 :{SMALLFONT}{BLACK}Sets the inspection time to 'Every 10 minutes' on all rides
|
||||
STR_5561 :Failed to load language file
|
||||
STR_5561 :Failed to load language
|
||||
STR_5562 :WARNING!
|
||||
STR_5563 :This feature is currently unstable, take extra caution.
|
||||
STR_5564 :Insert Corrupt Element
|
||||
|
||||
@@ -134,7 +134,10 @@ bool font_supports_string(const utf8 *text, int fontSize)
|
||||
uint32 codepoint;
|
||||
while ((codepoint = utf8_get_next(src, &src)) != 0) {
|
||||
if (gUseTrueTypeFont) {
|
||||
return TTF_GlyphIsProvided(gCurrentTTFFontSet->size[fontSize].font, (uint16)codepoint);
|
||||
bool supported = TTF_GlyphIsProvided(gCurrentTTFFontSet->size[fontSize].font, (uint16)codepoint);
|
||||
if (!supported) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
bool supported = false;
|
||||
switch (codepoint) {
|
||||
|
||||
@@ -881,8 +881,9 @@ static uint32 _ttf_getwidth_cache_get_or_add(TTF_Font *font, const utf8 *text)
|
||||
bool ttf_initialise()
|
||||
{
|
||||
if (!_ttfInitialised) {
|
||||
if (TTF_Init() != 0)
|
||||
if (TTF_Init() != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
TTFFontDescriptor *fontDesc = &(gCurrentTTFFontSet->size[i]);
|
||||
@@ -893,6 +894,7 @@ bool ttf_initialise()
|
||||
fontDesc->font = TTF_OpenFont(fontPath, fontDesc->ptSize);
|
||||
if (fontDesc->font == NULL) {
|
||||
log_error("Unable to load '%s'", fontPath);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ const currency_descriptor CurrencyDescriptors[CURRENCY_END] = {
|
||||
{ 1000 , CURRENCY_PREFIX, "\xC2\xA5" , CURRENCY_SUFFIX, "YEN" , STR_YEN }, // Japanese Yen
|
||||
{ 10 , CURRENCY_SUFFIX, "Pts" , CURRENCY_SUFFIX, "Pts" , STR_PESETA }, // Spanish Peseta
|
||||
{ 1000 , CURRENCY_PREFIX, "L" , CURRENCY_PREFIX, "L" , STR_LIRA }, // Italian Lira
|
||||
{ 10 , CURRENCY_PREFIX, "fl. " , CURRENCY_PREFIX, "fl." , STR_GUILDERS }, // Dutch Guilder
|
||||
{ 10 , CURRENCY_PREFIX, "\xC6\x92" , CURRENCY_PREFIX, "fl." , STR_GUILDERS }, // Dutch Guilder
|
||||
{ 10 , CURRENCY_SUFFIX, "kr." , CURRENCY_SUFFIX, "kr." , STR_KRONA }, // Swedish Krona
|
||||
{ 10 , CURRENCY_PREFIX, "\xE2\x82\xAC" , CURRENCY_SUFFIX, "EUR" , STR_EUROS }, // Euro
|
||||
{ 10000 , CURRENCY_PREFIX, "\xE2\x82\xA9" , CURRENCY_PREFIX, "W" , STR_WON }, // South Korean Won
|
||||
{ 1000 , CURRENCY_PREFIX, "R " , CURRENCY_PREFIX, "R " , STR_ROUBLE }, // Russian Rouble
|
||||
{ 100 , CURRENCY_SUFFIX, "K\xC4\x8D" , CURRENCY_SUFFIX, "Kc" , STR_CZECH_KORUNA }, // Czech koruna
|
||||
{ 100 , CURRENCY_SUFFIX, " K\xC4\x8D" , CURRENCY_SUFFIX, " Kc" , STR_CZECH_KORUNA }, // Czech koruna
|
||||
};
|
||||
|
||||
@@ -173,6 +173,11 @@ int language_open(int id)
|
||||
gCurrentTTFFontSet = LanguagesDescriptors[id].font;
|
||||
if (!ttf_initialise()) {
|
||||
log_warning("Unable to initialise TrueType fonts.");
|
||||
|
||||
// Fall back to sprite font
|
||||
gUseTrueTypeFont = false;
|
||||
gCurrentTTFFontSet = nullptr;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -251,10 +251,13 @@ bool openrct2_initialise()
|
||||
audio_init();
|
||||
audio_populate_devices();
|
||||
}
|
||||
if (!language_open(gConfigGeneral.language))
|
||||
{
|
||||
log_fatal("Failed to open language, exiting.");
|
||||
return false;
|
||||
if (!language_open(gConfigGeneral.language)) {
|
||||
log_error("Failed to open configured language...");
|
||||
|
||||
if (!language_open(LANGUAGE_ENGLISH_UK)) {
|
||||
log_fatal("Failed to open fallback language...");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
http_init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user