- special remapping for the Hungarian double accented letters.

Instead of entirely stripping away the accent when they are not found, let's go to the Umlaut-variants first.
This commit is contained in:
Christoph Oelckers 2019-03-04 20:06:19 +01:00
parent 77cb9ae866
commit 97ae74081a
2 changed files with 23 additions and 2 deletions

View file

@ -751,12 +751,24 @@ int FFont::GetCharCode(int code, bool needpic) const
} }
} }
code = originalcode;
if (myislower(code)) if (myislower(code))
{ {
int upper = upperforlower[code]; int upper = upperforlower[code];
// 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);
} }
// Same for the uppercase character. Since we restart at the accented version this must go through the entire thing again.
while ((newcode = stripaccent(code)) != code)
{
code = newcode;
if (code >= FirstChar && code <= LastChar && (!needpic || Chars[code - FirstChar].TranslatedPic != nullptr))
{
return code;
}
}
} }
return -1; return -1;

View file

@ -838,8 +838,17 @@ int stripaccent(int code)
} }
else if (code >= 0x100 && code < 0x180) else if (code >= 0x100 && code < 0x180)
{ {
static const char accentless[] = "AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnnNnOoOoOoOoRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZz "; // For the double-accented Hungarian letters it makes more sense to first map them to the very similar looking Umlauts.
return accentless[code -0x100]; // (And screw the crappy specs here that do not allow UTF-8 multibyte characters here.)
if (code == 0x150) code = 0xd6;
else if (code == 0x151) code = 0xf6;
else if (code == 0x170) code = 0xdc;
else if (code == 0x171) code = 0xfc;
else
{
static const char accentless[] = "AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnnNnOoOoOoOoRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZz ";
return accentless[code - 0x100];
}
} }
else if (code >= 0x200 && code < 0x21c) else if (code >= 0x200 && code < 0x21c)
{ {