- 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.
This commit is contained in:
Christoph Oelckers 2023-02-11 10:43:59 +01:00
parent 29de90beb6
commit fd04cda324
2 changed files with 9 additions and 2 deletions

View file

@ -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))

View file

@ -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;