summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/font/text_metrics.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/common/font/text_metrics.cpp')
-rw-r--r--3rdparty/bgfx/examples/common/font/text_metrics.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/3rdparty/bgfx/examples/common/font/text_metrics.cpp b/3rdparty/bgfx/examples/common/font/text_metrics.cpp
index 768ebbdac4c..835c9e14187 100644
--- a/3rdparty/bgfx/examples/common/font/text_metrics.cpp
+++ b/3rdparty/bgfx/examples/common/font/text_metrics.cpp
@@ -10,12 +10,13 @@
TextMetrics::TextMetrics(FontManager* _fontManager)
: m_fontManager(_fontManager)
- , m_width(0)
- , m_height(0)
- , m_x(0)
- , m_lineHeight(0)
- , m_lineGap(0)
{
+ clearText();
+}
+
+void TextMetrics::clearText()
+{
+ m_width = m_height = m_x = m_lineHeight = m_lineGap = 0;
}
void TextMetrics::appendText(FontHandle _fontHandle, const char* _string)
@@ -50,7 +51,6 @@ void TextMetrics::appendText(FontHandle _fontHandle, const char* _string)
m_lineGap = font.lineGap;
m_lineHeight = font.ascender - font.descender;
m_x = 0;
- break;
}
m_x += glyph->advance_x;
@@ -97,7 +97,6 @@ void TextMetrics::appendText(FontHandle _fontHandle, const wchar_t* _string)
m_lineGap = font.lineGap;
m_lineHeight = font.ascender - font.descender;
m_x = 0;
- break;
}
m_x += glyph->advance_x;