From fd04cda324456cb0164d372dc62c59552bfa42a5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Feb 2023 10:43:59 +0100 Subject: [PATCH] - added a font option to have lower case for Latin only. This is meant for SW's SmallFont to avoid creating lowercase Greek or Cyrillic letters. The font is too small to render them adequately. --- source/common/fonts/font.cpp | 9 +++++++-- source/common/fonts/v_font.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/common/fonts/font.cpp b/source/common/fonts/font.cpp index 98763724f..f78985b43 100644 --- a/source/common/fonts/font.cpp +++ b/source/common/fonts/font.cpp @@ -120,7 +120,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla sc.MustGetValue(false); GlobalKerning = sc.Number; } - if (sc.Compare("Altfont")) + else if (sc.Compare("Altfont")) { sc.MustGetString(); AltFontName = sc.String; @@ -179,6 +179,11 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla sc.ScriptError("Unknown translation type %s", sc.String); } } + else if (sc.Compare("lowercaselatinonly")) + { + lowercaselatinonly = true; + } + } } } @@ -755,7 +760,7 @@ int FFont::GetCharCode(int code, bool needpic) const // 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) + if (!MixedCase || (lowercaselatinonly && code >= 0x380 && code < 0x500)) { // Try converting lowercase characters to uppercase. if (myislower(code)) diff --git a/source/common/fonts/v_font.h b/source/common/fonts/v_font.h index 343cbaf5d..407ee0f5e 100644 --- a/source/common/fonts/v_font.h +++ b/source/common/fonts/v_font.h @@ -167,6 +167,7 @@ public: forceremap = other.forceremap; Chars = other.Chars; Translations = other.Translations; + lowercaselatinonly = other.lowercaselatinonly; Lump = other.Lump; } @@ -189,6 +190,7 @@ protected: bool noTranslate = false; bool MixedCase = false; bool forceremap = false; + bool lowercaselatinonly = false; struct CharData { FGameTexture *OriginalPic = nullptr;