diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-14 23:57:06 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-15 00:10:47 +0200 |
commit | 412a8fd2cff7f24729ab36bc6a59fd533b6d26c0 (patch) | |
tree | 07e93d8945f712a12dbbdd2a71fa916b9ae393e1 | |
parent | beac98b7d093bca0fa921e5e30c2b766fb0298e9 (diff) | |
download | mana-412a8fd2cff7f24729ab36bc6a59fd533b6d26c0.tar.gz mana-412a8fd2cff7f24729ab36bc6a59fd533b6d26c0.tar.bz2 mana-412a8fd2cff7f24729ab36bc6a59fd533b6d26c0.tar.xz mana-412a8fd2cff7f24729ab36bc6a59fd533b6d26c0.zip |
Also hardcode the bold font, we ship it after all
Plus some tweaks and cleanups.
-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); } } |