From 412a8fd2cff7f24729ab36bc6a59fd533b6d26c0 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 14 Apr 2009 23:57:06 +0200 Subject: Also hardcode the bold font, we ship it after all Plus some tweaks and cleanups. --- src/gui/gui.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/gui/gui.cpp') 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(); -} -- cgit v1.2.3-70-g09d2