aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2019-08-06 21:33:13 +0200
committerGitHub <noreply@github.com>2019-08-06 21:33:13 +0200
commit233cb86e864affe3dee8f60503584f1eb7e36287 (patch)
treee1f57d5803abd1bbcdf296802537892e0289e645 /src/gui
parent8e757859d6a6bf6482480904e8485e9344e567ab (diff)
downloadminetest-233cb86e864affe3dee8f60503584f1eb7e36287.tar.gz
minetest-233cb86e864affe3dee8f60503584f1eb7e36287.tar.bz2
minetest-233cb86e864affe3dee8f60503584f1eb7e36287.zip
Clean up and fix freetype=false crashes (#8641)
A IGUIFont of type bitmap/vector cannot be converted to CGUITTFont Fixes various segfaults in gameplay Shorter font cache code, cleaned up (?)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/guiChatConsole.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/guiChatConsole.cpp b/src/gui/guiChatConsole.cpp
index 42348beb3..e67fae3c6 100644
--- a/src/gui/guiChatConsole.cpp
+++ b/src/gui/guiChatConsole.cpp
@@ -77,7 +77,7 @@ GUIChatConsole::GUIChatConsole(
m_font = g_fontengine->getFont(FONT_SIZE_UNSPECIFIED, FM_Mono);
if (!m_font) {
- errorstream << "GUIChatConsole: Unable to load mono font ";
+ errorstream << "GUIChatConsole: Unable to load mono font" << std::endl;
} else {
core::dimension2d<u32> dim = m_font->getDimension(L"M");
m_fontsize = v2u32(dim.Width, dim.Height);
@@ -322,9 +322,9 @@ void GUIChatConsole::drawText()
core::rect<s32> destrect(
x, y, x + m_fontsize.X * fragment.text.size(), y + m_fontsize.Y);
-
- #if USE_FREETYPE
- // Draw colored text if FreeType is enabled
+#if USE_FREETYPE
+ if (m_font->getType() == irr::gui::EGFT_CUSTOM) {
+ // Draw colored text if FreeType is enabled
irr::gui::CGUITTFont *tmp = dynamic_cast<irr::gui::CGUITTFont *>(m_font);
tmp->draw(
fragment.text,
@@ -333,8 +333,10 @@ void GUIChatConsole::drawText()
false,
false,
&AbsoluteClippingRect);
- #else
- // Otherwise use standard text
+ } else
+#endif
+ {
+ // Otherwise use standard text
m_font->draw(
fragment.text.c_str(),
destrect,
@@ -342,7 +344,7 @@ void GUIChatConsole::drawText()
false,
false,
&AbsoluteClippingRect);
- #endif
+ }
}
}
}