diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-13 00:50:06 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-13 00:54:45 +0200 |
commit | f691f9a7b121e9d32df9f648c629c98ae8d25966 (patch) | |
tree | 7f442e48525fe6894609ad0cc22f88cd2dd47f17 /src/gui/widgets/browserbox.cpp | |
parent | 01d87fa38bdffe7207e1370e64f1178a43bd8bbf (diff) | |
download | mana-f691f9a7b121e9d32df9f648c629c98ae8d25966.tar.gz mana-f691f9a7b121e9d32df9f648c629c98ae8d25966.tar.bz2 mana-f691f9a7b121e9d32df9f648c629c98ae8d25966.tar.xz mana-f691f9a7b121e9d32df9f648c629c98ae8d25966.zip |
BrowserBox doesn't need to know about the TrueTypeFont class
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 52b9bfa6..a03d53eb 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -23,9 +23,9 @@ #include "gui/linkhandler.h" #include "gui/palette.h" -#include "gui/truetypefont.h" #include <guichan/graphics.hpp> +#include <guichan/font.hpp> #include <algorithm> @@ -71,7 +71,7 @@ void BrowserBox::addRow(const std::string &row) std::string newRow; BROWSER_LINK bLink; std::string::size_type idx1, idx2, idx3; - TrueTypeFont *font = static_cast<TrueTypeFont*>(getFont()); + gcn::Font *font = getFont(); // Use links and user defined colors if (mUseLinksAndUserColors) @@ -116,7 +116,6 @@ void BrowserBox::addRow(const std::string &row) newRow += tmp; } - // Don't use links and user defined colors else { @@ -281,7 +280,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) int x = 0, y = 0; int wrappedLines = 0; int link = 0; - TrueTypeFont *font = static_cast<TrueTypeFont*>(getFont()); + gcn::Font *font = getFont(); graphics->setColor(guiPalette->getColor(Palette::TEXT)); for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); i++) @@ -296,10 +295,11 @@ void BrowserBox::draw(gcn::Graphics *graphics) // Check for separator lines if (row.find("---", 0) == 0) { + const int dashWidth = font->getWidth("-"); for (x = 0; x < getWidth(); x++) { font->drawString(graphics, "-", x, y); - x += font->getWidth("-") - 2; + x += dashWidth - 2; } y += font->getHeight(); continue; @@ -389,7 +389,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) { bool forced = false; char const *hyphen = "~"; - int hyphenWidth = font->getWidth(hyphen); + int hyphenWidth = font->getWidth(hyphen); /* FIXME: This code layout makes it easy to crash remote clients by talking garbage. Forged long utf-8 characters |