From b0eac0a809b46c75ca83a2df18352ef9d441f436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Libor=20=C4=8Cap=C3=A1k?= Date: Mon, 13 Feb 2017 22:27:07 +0100 Subject: [PATCH] new function TextMetrics::clearText() (#1046) --- examples/common/font/text_metrics.cpp | 11 ++++++----- examples/common/font/text_metrics.h | 3 +++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/common/font/text_metrics.cpp b/examples/common/font/text_metrics.cpp index 768ebbdac..0b2d71e0e 100644 --- a/examples/common/font/text_metrics.cpp +++ b/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) diff --git a/examples/common/font/text_metrics.h b/examples/common/font/text_metrics.h index ec373c7eb..48c932358 100644 --- a/examples/common/font/text_metrics.h +++ b/examples/common/font/text_metrics.h @@ -25,6 +25,9 @@ public: /// Return the height of the measured text. float getHeight() const { return m_height; } + /// Clear the width and height of the measured text. + void clearText(); + private: FontManager* m_fontManager; float m_width;