From 76dbd0d2d04712dcad4f7c6afecb97fa8d662d6d Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 8 Jan 2022 14:53:25 +0100 Subject: Fully remove bitmap font support (#11863) Freetype is now a build requirement. --- src/gui/guiChatConsole.cpp | 14 ++++---------- src/gui/guiHyperText.cpp | 23 ++++++++--------------- src/gui/guiHyperText.h | 11 ++++++----- 3 files changed, 18 insertions(+), 30 deletions(-) (limited to 'src/gui') diff --git a/src/gui/guiChatConsole.cpp b/src/gui/guiChatConsole.cpp index 0610c85cc..01e10ea2e 100644 --- a/src/gui/guiChatConsole.cpp +++ b/src/gui/guiChatConsole.cpp @@ -30,12 +30,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/fontengine.h" #include "log.h" #include "gettext.h" +#include "irrlicht_changes/CGUITTFont.h" #include -#if USE_FREETYPE - #include "irrlicht_changes/CGUITTFont.h" -#endif - inline u32 clamp_u8(s32 value) { return (u32) MYMIN(MYMAX(value, 0), 255); @@ -328,19 +325,16 @@ void GUIChatConsole::drawText() core::rect destrect( x, y, x + m_fontsize.X * fragment.text.size(), y + m_fontsize.Y); -#if USE_FREETYPE if (m_font->getType() == irr::gui::EGFT_CUSTOM) { - // Draw colored text if FreeType is enabled - irr::gui::CGUITTFont *tmp = dynamic_cast(m_font); + // Draw colored text if possible + gui::CGUITTFont *tmp = static_cast(m_font); tmp->draw( fragment.text, destrect, false, false, &AbsoluteClippingRect); - } else -#endif - { + } else { // Otherwise use standard text m_font->draw( fragment.text.c_str(), diff --git a/src/gui/guiHyperText.cpp b/src/gui/guiHyperText.cpp index ccfdcb81d..40450ce5f 100644 --- a/src/gui/guiHyperText.cpp +++ b/src/gui/guiHyperText.cpp @@ -17,31 +17,26 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "IGUIEnvironment.h" -#include "IGUIElement.h" +#include "guiHyperText.h" #include "guiScrollBar.h" -#include "IGUIFont.h" -#include -#include -#include -using namespace irr::gui; #include "client/fontengine.h" -#include #include "client/tile.h" #include "IVideoDriver.h" #include "client/client.h" #include "client/renderingengine.h" #include "hud.h" -#include "guiHyperText.h" #include "util/string.h" +#include "irrlicht_changes/CGUITTFont.h" -bool check_color(const std::string &str) +using namespace irr::gui; + +static bool check_color(const std::string &str) { irr::video::SColor color; return parseColorString(str, color, false); } -bool check_integer(const std::string &str) +static bool check_integer(const std::string &str) { if (str.empty()) return false; @@ -616,12 +611,10 @@ TextDrawer::TextDrawer(const wchar_t *text, Client *client, if (e.font) { e.dim.Width = e.font->getDimension(e.text.c_str()).Width; e.dim.Height = e.font->getDimension(L"Yy").Height; -#if USE_FREETYPE if (e.font->getType() == irr::gui::EGFT_CUSTOM) { - e.baseline = e.dim.Height - 1 - - ((irr::gui::CGUITTFont *)e.font)->getAscender() / 64; + CGUITTFont *tmp = static_cast(e.font); + e.baseline = e.dim.Height - 1 - tmp->getAscender() / 64; } -#endif } else { e.dim = {0, 0}; } diff --git a/src/gui/guiHyperText.h b/src/gui/guiHyperText.h index 5b936262e..04c664df5 100644 --- a/src/gui/guiHyperText.h +++ b/src/gui/guiHyperText.h @@ -19,16 +19,17 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once -#include "config.h" // for USE_FREETYPE +#include +#include +#include +#include +#include "irrlichttypes_extrabloated.h" using namespace irr; class ISimpleTextureSource; class Client; - -#if USE_FREETYPE -#include "irrlicht_changes/CGUITTFont.h" -#endif +class GUIScrollBar; class ParsedText { -- cgit v1.2.3