mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- 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:
parent
77cb9ae866
commit
97ae74081a
2 changed files with 23 additions and 2 deletions
|
@ -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;
|
||||||
|
|
|
@ -837,9 +837,18 @@ int stripaccent(int code)
|
||||||
return 'P' + (code & 0x20); // well, it sort of looks like a 'P'
|
return 'P' + (code & 0x20); // well, it sort of looks like a 'P'
|
||||||
}
|
}
|
||||||
else if (code >= 0x100 && code < 0x180)
|
else if (code >= 0x100 && code < 0x180)
|
||||||
|
{
|
||||||
|
// For the double-accented Hungarian letters it makes more sense to first map them to the very similar looking Umlauts.
|
||||||
|
// (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 ";
|
static const char accentless[] = "AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnnNnOoOoOoOoRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZz ";
|
||||||
return accentless[code -0x100];
|
return accentless[code - 0x100];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (code >= 0x200 && code < 0x21c)
|
else if (code >= 0x200 && code < 0x21c)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue