GUI: Clean up localized font filename generation.

This commit is contained in:
Johannes Schickel 2011-05-05 20:07:37 +02:00
parent 0ef807146e
commit 16f1b51e2a

View File

@ -1475,20 +1475,23 @@ Common::String ThemeEngine::genLocalizedFontFilename(const Common::String &filen
#ifndef USE_TRANSLATION #ifndef USE_TRANSLATION
return filename; return filename;
#else #else
Common::String result; // We will transform the font filename in the following way:
bool pointPassed = false; // name.bdf
// will become:
// name-charset.bdf
// Note that name should not contain any dot here!
for (const char *p = filename.c_str(); *p != 0; p++) { // In the first step we look for the dot. In case there is none we will
if (!pointPassed && *p == '.') { // return the normal filename.
result += "-"; Common::String::const_iterator dot = Common::find(filename.begin(), filename.end(), '.');
if (dot == filename.end())
return filename;
// Put the translated font filename string back together.
Common::String result(filename.begin(), dot);
result += '-';
result += TransMan.getCurrentCharset(); result += TransMan.getCurrentCharset();
result += *p; result += dot;
pointPassed = true;
} else {
result += *p;
}
}
return result; return result;
#endif #endif