diff --git a/src/gamedata/fonts/font.cpp b/src/gamedata/fonts/font.cpp index a151f1095..a777cdef0 100644 --- a/src/gamedata/fonts/font.cpp +++ b/src/gamedata/fonts/font.cpp @@ -708,24 +708,52 @@ int FFont::GetCharCode(int code, bool needpic) const return code; } - int originalcode = code; - int newcode; - - // Try stripping accents from accented characters. This may repeat to allow multi-step fallbacks. - while ((newcode = stripaccent(code)) != code) + // Use different substitution logic based on the fonts content: + // In a font which has both upper and lower case, prefer unaccented small characters over capital ones. + // In a pure upper-case font, do not check for lower case replacements. + if (!MixedCase) { - code = newcode; - if (code >= FirstChar && code <= LastChar && (!needpic || Chars[code - FirstChar].TranslatedPic != nullptr)) + // Try converting lowercase characters to uppercase. + if (myislower(code)) { - return code; + code = upperforlower[code]; + if (code >= FirstChar && code <= LastChar && (!needpic || Chars[code - FirstChar].TranslatedPic != nullptr)) + { + return code; + } + } + // Try stripping accents from accented characters. + int newcode = stripaccent(code); + if (newcode != code) + { + code = newcode; + if (code >= FirstChar && code <= LastChar && (!needpic || Chars[code - FirstChar].TranslatedPic != nullptr)) + { + return code; + } } } - - if (myislower(code)) + else { - int upper = upperforlower[code]; - // Stripping accents did not help - now try uppercase for lowercase - if (upper != code) return GetCharCode(upper, needpic); + int originalcode = code; + int newcode; + + // Try stripping accents from accented characters. This may repeat to allow multi-step fallbacks. + while ((newcode = stripaccent(code)) != code) + { + code = newcode; + if (code >= FirstChar && code <= LastChar && (!needpic || Chars[code - FirstChar].TranslatedPic != nullptr)) + { + return code; + } + } + + if (myislower(code)) + { + int upper = upperforlower[code]; + // Stripping accents did not help - now try uppercase for lowercase + if (upper != code) return GetCharCode(upper, needpic); + } } return -1; diff --git a/src/gamedata/fonts/v_font.h b/src/gamedata/fonts/v_font.h index 0702781e9..18ca18978 100644 --- a/src/gamedata/fonts/v_font.h +++ b/src/gamedata/fonts/v_font.h @@ -126,6 +126,7 @@ protected: char Cursor; bool noTranslate; bool translateUntranslated; + bool MixedCase = false; struct CharData { FTexture *TranslatedPic = nullptr; // Texture for use with font translations. diff --git a/wadsrc_extra/static/filter/game-doomchex/fonts/bigfont/00C4.lmp b/wadsrc_extra/static/filter/game-doomchex/fonts/bigfont/00C4.lmp new file mode 100644 index 000000000..88866e396 Binary files /dev/null and b/wadsrc_extra/static/filter/game-doomchex/fonts/bigfont/00C4.lmp differ diff --git a/wadsrc_extra/static/filter/game-doomchex/fonts/bigfont/00D6.lmp b/wadsrc_extra/static/filter/game-doomchex/fonts/bigfont/00D6.lmp new file mode 100644 index 000000000..b3cff0d2e Binary files /dev/null and b/wadsrc_extra/static/filter/game-doomchex/fonts/bigfont/00D6.lmp differ diff --git a/wadsrc_extra/static/filter/game-doomchex/fonts/bigfont/00DC.lmp b/wadsrc_extra/static/filter/game-doomchex/fonts/bigfont/00DC.lmp new file mode 100644 index 000000000..ce8fc1b10 Binary files /dev/null and b/wadsrc_extra/static/filter/game-doomchex/fonts/bigfont/00DC.lmp differ