From 29de90beb613d1c58cc567c7af30190efe2b1903 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Feb 2023 10:38:29 +0100 Subject: [PATCH] - 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. --- source/core/gamecontrol.cpp | 10 +++++++++- source/core/razefont.cpp | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index eff22623a..ef35b0e39 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -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, diff --git a/source/core/razefont.cpp b/source/core/razefont.cpp index 68dc874b3..b7369509e 100644 --- a/source/core/razefont.cpp +++ b/source/core/razefont.cpp @@ -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); } }