|
@@ -1441,40 +1441,42 @@ void InitializeLanguagePacks()
|
|
|
/**
|
|
|
* Check whether the currently loaded language pack
|
|
|
* uses characters that the currently loaded font
|
|
|
* does not support. If this is the case an error
|
|
|
* message will be shown in English. The error
|
|
|
* message will not be localized because that would
|
|
|
* mean it might use characters that are not in the
|
|
|
* font, which is the whole reason this check has
|
|
|
* been added.
|
|
|
*/
|
|
|
void CheckForMissingGlyphsInLoadedLanguagePack()
|
|
|
{
|
|
|
const Sprite *question_mark = GetGlyph(FS_NORMAL, '?');
|
|
|
|
|
|
for (uint i = 0; i != 32; i++) {
|
|
|
for (uint j = 0; j < _langtab_num[i]; j++) {
|
|
|
const char *string = _langpack_offs[_langtab_start[i] + j];
|
|
|
WChar c;
|
|
|
while ((c = Utf8Consume(&string)) != '\0') {
|
|
|
if (c == SCC_SETX) {
|
|
|
/*
|
|
|
* SetX is, together with SetXY as special character that
|
|
|
* uses the next (two) characters as data points. We have
|
|
|
* to skip those, otherwise the UTF8 reading will go
|
|
|
* haywire.
|
|
|
*/
|
|
|
string++;
|
|
|
} else if (c == SCC_SETXY) {
|
|
|
string += 2;
|
|
|
} else if (IsPrintable(c) && GetUnicodeGlyph(FS_NORMAL, c) == 0) {
|
|
|
} else if (IsPrintable(c) && c != '?' && GetGlyph(FS_NORMAL, c) == question_mark) {
|
|
|
/*
|
|
|
* The character is printable, but not in the normal font.
|
|
|
* This is the case we were testing for. In this case we
|
|
|
* have to show the error. As we do not want the string to
|
|
|
* be translated by the translators, we 'force' it into the
|
|
|
* binary and 'load' it via a BindCString. To do this
|
|
|
* properly we have to set the color of the string,
|
|
|
* otherwise we end up with a lot of artefacts. The color
|
|
|
* 'character' might change in the future, so for safety
|
|
|
* we just Utf8 Encode it into the string, which takes
|
|
|
* exactly three characters, so it replaces the "XXX" with
|
|
|
* the color marker.
|