aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/guiHyperText.cpp17
-rw-r--r--src/gui/guiHyperText.h4
2 files changed, 9 insertions, 12 deletions
diff --git a/src/gui/guiHyperText.cpp b/src/gui/guiHyperText.cpp
index 024e4de09..e5f945789 100644
--- a/src/gui/guiHyperText.cpp
+++ b/src/gui/guiHyperText.cpp
@@ -71,14 +71,12 @@ void ParsedText::Element::setStyle(StyleList &style)
if (style["fontstyle"] == "mono")
font_mode = FM_Mono;
+ FontSpec spec(font_size, font_mode,
+ is_yes(style["bold"]), is_yes(style["italic"]));
+
// TODO: find a way to check font validity
// Build a new fontengine ?
- this->font =
-#if USE_FREETYPE
- (gui::CGUITTFont *)
-#endif
- g_fontengine->getFont(font_size, font_mode,
- is_yes(style["bold"]), is_yes(style["italic"]));
+ this->font = g_fontengine->getFont(spec);
if (!this->font)
printf("No font found ! Size=%d, mode=%d, bold=%s, italic=%s\n",
@@ -606,7 +604,10 @@ TextDrawer::TextDrawer(const wchar_t *text, Client *client,
e.dim.Width = e.font->getDimension(e.text.c_str()).Width;
e.dim.Height = e.font->getDimension(L"Yy").Height;
#if USE_FREETYPE
- e.baseline = e.dim.Height - 1 - e.font->getAscender()/64;
+ if (e.font->getType() == irr::gui::EGFT_CUSTOM) {
+ e.baseline = e.dim.Height - 1 -
+ ((irr::gui::CGUITTFont *)e.font)->getAscender() / 64;
+ }
#endif
} else {
e.dim = {0, 0};
@@ -666,7 +667,7 @@ ParsedText::Element *TextDrawer::getElementAt(core::position2d<s32> pos)
It may be called each time width changes and resulting height can be
retrieved using getHeight. See GUIHyperText constructor, it uses it once to
test if text fits in window and eventually another time if width is reduced
- m_floatingbecause of scrollbar added.
+ m_floating because of scrollbar added.
*/
void TextDrawer::place(const core::rect<s32> &dest_rect)
{
diff --git a/src/gui/guiHyperText.h b/src/gui/guiHyperText.h
index e3ad0e747..3ea8732cd 100644
--- a/src/gui/guiHyperText.h
+++ b/src/gui/guiHyperText.h
@@ -96,11 +96,7 @@ public:
ValignType valign;
-#if USE_FREETYPE
- gui::CGUITTFont *font;
-#else
gui::IGUIFont *font;
-#endif
irr::video::SColor color;
irr::video::SColor hovercolor;