diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-22 14:18:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-22 15:54:34 +0300 |
commit | 87b21ba61d7a8c322d658bd6b8d9f75b9e711263 (patch) | |
tree | ab46b6ed6506365093c3e2a71bcbe985a7cc5b28 /src/gui/sdlfont.cpp | |
parent | 9f2cf7c95cfce3f735b43bfedc9f87be929e7c35 (diff) | |
download | manaverse-87b21ba61d7a8c322d658bd6b8d9f75b9e711263.tar.gz manaverse-87b21ba61d7a8c322d658bd6b8d9f75b9e711263.tar.bz2 manaverse-87b21ba61d7a8c322d658bd6b8d9f75b9e711263.tar.xz manaverse-87b21ba61d7a8c322d658bd6b8d9f75b9e711263.zip |
load fonts in separate function.
Diffstat (limited to 'src/gui/sdlfont.cpp')
-rw-r--r-- | src/gui/sdlfont.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index 54dbfbff6..eb05bea8d 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -364,14 +364,13 @@ SDLFont::SDLFont(std::string filename, ++fontCounter; fixDirSeparators(filename); - mFont = TTF_OpenFont(resman->getPath(filename).c_str(), size); + mFont = openFont(filename.c_str(), size); if (!mFont) { logger->log("Error finding font " + filename); std::string backFile = "fonts/dejavusans.ttf"; - mFont = TTF_OpenFont(resman->getPath( - fixDirSeparators(backFile)).c_str(), size); + mFont = openFont(fixDirSeparators(backFile).c_str(), size); if (!mFont) { throw GCN_EXCEPTION("SDLSDLFont::SDLSDLFont: " + @@ -396,6 +395,12 @@ SDLFont::~SDLFont() } } +TTF_Font *SDLFont::openFont(const char *const name, const int size) +{ + return TTF_OpenFontIndex(ResourceManager::getInstance()->getPath( + name).c_str(), size, 0); +} + void SDLFont::loadFont(std::string filename, const int size, const int style) @@ -410,8 +415,7 @@ void SDLFont::loadFont(std::string filename, } fixDirSeparators(filename); - TTF_Font *const font = TTF_OpenFont( - resman->getPath(filename).c_str(), size); + TTF_Font *const font = openFont(filename.c_str(), size); if (!font) { |