mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 07:53:12 +00:00
GUI: Clean up localized font filename generation.
This commit is contained in:
parent
0ef807146e
commit
16f1b51e2a
@ -1475,20 +1475,23 @@ Common::String ThemeEngine::genLocalizedFontFilename(const Common::String &filen
|
||||
#ifndef USE_TRANSLATION
|
||||
return filename;
|
||||
#else
|
||||
Common::String result;
|
||||
bool pointPassed = false;
|
||||
// We will transform the font filename in the following way:
|
||||
// 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++) {
|
||||
if (!pointPassed && *p == '.') {
|
||||
result += "-";
|
||||
result += TransMan.getCurrentCharset();
|
||||
result += *p;
|
||||
// In the first step we look for the dot. In case there is none we will
|
||||
// return the normal filename.
|
||||
Common::String::const_iterator dot = Common::find(filename.begin(), filename.end(), '.');
|
||||
if (dot == filename.end())
|
||||
return filename;
|
||||
|
||||
pointPassed = true;
|
||||
} else {
|
||||
result += *p;
|
||||
}
|
||||
}
|
||||
// Put the translated font filename string back together.
|
||||
Common::String result(filename.begin(), dot);
|
||||
result += '-';
|
||||
result += TransMan.getCurrentCharset();
|
||||
result += dot;
|
||||
|
||||
return result;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user