summaryrefslogtreecommitdiffstats
path: root/gui/text.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/text.cpp')
-rw-r--r--gui/text.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/gui/text.cpp b/gui/text.cpp
index 9898e2838..6498af62c 100644
--- a/gui/text.cpp
+++ b/gui/text.cpp
@@ -19,8 +19,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
@@ -47,6 +47,8 @@ GUIText::GUIText(xml_node<>* node)
// Load the font, and possibly override the color
mFont = LoadAttrFont(FindNode(node, "font"), "resource");
+ if (!mFont)
+ return;
mColor = LoadAttrColor(FindNode(node, "font"), "color", mColor);
mHighlightColor = LoadAttrColor(FindNode(node, "font"), "highlightcolor", mColor);
@@ -88,6 +90,8 @@ int GUIText::Render(void)
void* fontResource = NULL;
if (mFont)
fontResource = mFont->GetResource();
+ else
+ return -1;
mLastValue = gui_parse_text(mText);
string displayValue = mLastValue;
@@ -98,7 +102,7 @@ int GUIText::Render(void)
mVarChanged = 0;
int x = mRenderX, y = mRenderY;
- int width = gr_measureEx(displayValue.c_str(), fontResource);
+ int width = gr_ttf_measureEx(displayValue.c_str(), fontResource);
if (isHighlighted)
gr_color(mHighlightColor.red, mHighlightColor.green, mHighlightColor.blue, mHighlightColor.alpha);
@@ -145,7 +149,7 @@ int GUIText::GetCurrentBounds(int& w, int& h)
h = mFontHeight;
mLastValue = gui_parse_text(mText);
- w = gr_measureEx(mLastValue.c_str(), fontResource);
+ w = gr_ttf_measureEx(mLastValue.c_str(), fontResource);
return 0;
}