summaryrefslogtreecommitdiffstats
path: root/gui/text.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-12-28 21:54:50 +0100
committerEthan Yonker <dees_troy@teamw.in>2016-01-27 17:53:13 +0100
commitfbb4353a247157d32208f8f133cd1ee42f4fbc49 (patch)
tree6f819fbdd21f2adef4f7ba4a5b4d02054cc02f29 /gui/text.cpp
parentAdopted Storage support (diff)
downloadandroid_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar
android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.gz
android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.bz2
android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.lz
android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.xz
android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.tar.zst
android_bootable_recovery-fbb4353a247157d32208f8f133cd1ee42f4fbc49.zip
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;
}