diff options
author | Thierry Crozat | 2011-05-22 15:43:35 +0100 |
---|---|---|
committer | Thierry Crozat | 2011-06-06 23:20:09 +0100 |
commit | 6b13782967b8b775c359b0ff54e7a17534248dbe (patch) | |
tree | d290ff1a2523c5d26ae4ad96942d32ac50808c3c /graphics/fontman.cpp | |
parent | 592cca5402f9162fc70b48f40b95faec44341bd0 (diff) | |
download | scummvm-rg350-6b13782967b8b775c359b0ff54e7a17534248dbe.tar.gz scummvm-rg350-6b13782967b8b775c359b0ff54e7a17534248dbe.tar.bz2 scummvm-rg350-6b13782967b8b775c359b0ff54e7a17534248dbe.zip |
GRAPHICS: Move genLocalizedFontFilename() to FontManager class
It was defined in ThemeEngine class , but I moved it to make it
possible to use localized font in other places.
Diffstat (limited to 'graphics/fontman.cpp')
-rw-r--r-- | graphics/fontman.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp index 08f2ce990b..27fe21ab97 100644 --- a/graphics/fontman.cpp +++ b/graphics/fontman.cpp @@ -21,6 +21,7 @@ #include "graphics/font.h" #include "graphics/fontman.h" +#include "common/translation.h" DECLARE_SINGLETON(Graphics::FontManager); @@ -90,4 +91,30 @@ const Font *FontManager::getFontByUsage(FontUsage usage) const { return 0; } +Common::String FontManager::genLocalizedFontFilename(const Common::String &filename) const { +#ifndef USE_TRANSLATION + return filename; +#else + // 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! + + // 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; + + // Put the translated font filename string back together. + Common::String result(filename.begin(), dot); + result += '-'; + result += TransMan.getCurrentCharset(); + result += dot; + + return result; +#endif +} + } // End of namespace Graphics |