- added German Umlauts for the BigFont and fixed the character substitution logic.

For pure uppercase fonts it makes no sense to try a lowercase substitution as a first step.
This commit is contained in:
Christoph Oelckers 2019-02-17 23:18:28 +01:00
parent 3dce45545f
commit 44c8c2a79c
5 changed files with 42 additions and 13 deletions

View File

@ -708,6 +708,33 @@ int FFont::GetCharCode(int code, bool needpic) const
return code; return 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)
{
// Try converting lowercase characters to uppercase.
if (myislower(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;
}
}
}
else
{
int originalcode = code; int originalcode = code;
int newcode; int newcode;
@ -727,6 +754,7 @@ int FFont::GetCharCode(int code, bool needpic) const
// Stripping accents did not help - now try uppercase for lowercase // Stripping accents did not help - now try uppercase for lowercase
if (upper != code) return GetCharCode(upper, needpic); if (upper != code) return GetCharCode(upper, needpic);
} }
}
return -1; return -1;
} }

View File

@ -126,6 +126,7 @@ protected:
char Cursor; char Cursor;
bool noTranslate; bool noTranslate;
bool translateUntranslated; bool translateUntranslated;
bool MixedCase = false;
struct CharData struct CharData
{ {
FTexture *TranslatedPic = nullptr; // Texture for use with font translations. FTexture *TranslatedPic = nullptr; // Texture for use with font translations.