- Duke: disable the 1.5 BigFont for languages using the Cyrillic or Greek alphabet

This font is incomplete, unlike the 1.3 variant, so for these languages use the font that can render them.
This commit is contained in:
Christoph Oelckers 2023-02-11 10:38:29 +01:00
parent 6f1c3433ba
commit 29de90beb6
2 changed files with 15 additions and 2 deletions

View file

@ -554,6 +554,14 @@ bool WantEscape()
return gi->WantEscape();
}
EXTERN_CVAR(Int, duke_menufont)
void LanguageChanged(const char* lang)
{
duke_menufont->Callback();
}
void I_StartupJoysticks();
@ -600,7 +608,7 @@ int GameMain()
HudScaleChanged,
M_SetSpecialMenu,
OnMenuOpen,
nullptr,
LanguageChanged,
nullptr,
[]() ->FConfigFile* { return GameConfig; },
WantEscape,

View file

@ -43,6 +43,7 @@
FGameTexture* GetBaseForChar(FGameTexture* t);
void FontCharCreated(FGameTexture* base, FGameTexture* glyph);
EXTERN_CVAR(String, language)
FFont* IndexFont;
@ -55,8 +56,12 @@ CUSTOM_CVAR(Int, duke_menufont, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOIN
if (self < -1 || self > 1) self = -1;
else
{
// BigFont15 is Latin only, so for non-latin languages force BigFont13 until someone completes this font. (This lists all relevant European languages, regardless of support!)
if (!strnicmp(language, "ru", 2) || !strnicmp(language, "sr", 2) || !strnicmp(language, "bg", 2) || !strnicmp(language, "mk", 2) || !strnicmp(language, "uk", 2) || !strnicmp(language, "el", 2))
OriginalBigFont->CopyFrom(*BigFont13);
// Font info must be copied so that BigFont does not change its address.
if (self == 0 || (self == -1 && isPlutoPak())) OriginalBigFont->CopyFrom(*BigFont15);
else if (self == 0 || (self == -1 && isPlutoPak())) OriginalBigFont->CopyFrom(*BigFont15);
else if (self == 1 || (self == -1 && !isPlutoPak())) OriginalBigFont->CopyFrom(*BigFont13);
}
}