diff options
-rw-r--r-- | src/gui/gui.cpp | 26 | ||||
-rw-r--r-- | src/gui/gui.h | 9 | ||||
-rw-r--r-- | src/gui/truetypefont.cpp | 2 | ||||
-rw-r--r-- | src/localplayer.cpp | 2 |
4 files changed, 14 insertions, 25 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 2c75a9f1..8a4e4aec 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -105,32 +105,31 @@ Gui::Gui(Graphics *graphics): ResourceManager *resman = ResourceManager::getInstance(); // Set global font - std::string path = resman->getPath( - branding.getValue("font", "fonts/dejavusans.ttf")); + const int fontSize = (int) config.getValue("fontSize", 11); + std::string fontFile = branding.getValue("font", "fonts/dejavusans.ttf"); + std::string path = resman->getPath(fontFile); try { - const int fontSize = (int)config.getValue("fontSize", 11); mGuiFont = new TrueTypeFont(path, fontSize); - mInfoParticleFont = new TrueTypeFont(path, fontSize, 1); + mInfoParticleFont = new TrueTypeFont(path, fontSize, TTF_STYLE_BOLD); } catch (gcn::Exception e) { - logger->error(std::string("Unable to load dejavusans.ttf: ") - + e.getMessage()); + logger->error(std::string("Unable to load '") + fontFile + + std::string("': ") + e.getMessage()); } // Set bold font - path = resman->getPath( - branding.getValue("boldFont", "fonts/dejavusans.ttf")); + fontFile = branding.getValue("boldFont", "fonts/dejavusans-bold.ttf"); + path = resman->getPath(fontFile); try { - const int fontSize = (int)config.getValue("fontSize", 11); boldFont = new TrueTypeFont(path, fontSize); } catch (gcn::Exception e) { - logger->error(std::string("Unable to load dejavusans-bold.ttf: ") - + e.getMessage()); + logger->error(std::string("Unable to load '") + fontFile + + std::string("': ") + e.getMessage()); } gcn::Widget::setGlobalFont(mGuiFont); @@ -243,8 +242,3 @@ void Gui::handleMouseMoved(const gcn::MouseInput &mouseInput) gcn::Gui::handleMouseMoved(mouseInput); mMouseInactivityTimer = 0; } - -const int Gui::getFontHeight() const -{ - return mGuiFont->getHeight(); -} diff --git a/src/gui/gui.h b/src/gui/gui.h index 2ce153db..d3fb3b60 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -73,19 +73,14 @@ class Gui : public gcn::Gui /** * Return game font. */ - gcn::Font* getFont() const + gcn::Font *getFont() const { return mGuiFont; } /** - * Return game font height. - */ - const int getFontHeight() const; - - /** * Return the Font used for "Info Particles", i.e. ones showing, what * you picked up, etc. */ - gcn::Font* getInfoParticleFont() const + gcn::Font *getInfoParticleFont() const { return mInfoParticleFont; } /** diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index f9e206bc..62a27651 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -93,7 +93,7 @@ TrueTypeFont::TrueTypeFont(const std::string &filename, int size, int style) std::string(TTF_GetError())); } - TTF_SetFontStyle (mFont, style); + TTF_SetFontStyle(mFont, style); } TrueTypeFont::~TrueTypeFont() diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 5748cd53..238af129 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -910,7 +910,7 @@ void LocalPlayer::pickedUp(const std::string &item) getPixelX() + 16, getPixelY() - 16, &guiPalette->getColor(Palette::PICKUP_INFO), - gui->getInfoParticleFont (), true); + gui->getInfoParticleFont(), true); } } |