From fd84b77c8e9a3c6aa2e856db9363b676f321b19d Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 4 Oct 2020 14:02:18 +0200 Subject: [PATCH] Fix size calculation of GuiText --- source/gui/GuiText.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/gui/GuiText.cpp b/source/gui/GuiText.cpp index acf4da5..067274e 100644 --- a/source/gui/GuiText.cpp +++ b/source/gui/GuiText.cpp @@ -43,6 +43,7 @@ GuiText::GuiText(const std::string &text, int32_t size, SDL_Color c, GuiFont *gF this->fc_font = gFont->getFont(size); this->doUpdateTexture = true; this->texture.setParent(this); + this->updateSize(); } GuiText::~GuiText() { @@ -51,6 +52,7 @@ GuiText::~GuiText() { void GuiText::setFontSize(int32_t size) { this->fc_font = this->gFont->getFont(size); + updateSize(); this->doUpdateTexture = true; } @@ -58,6 +60,7 @@ void GuiText::setMaxWidth(float width) { this->maxWidth = width; // Rebuild the texture cache on next draw + updateSize(); doUpdateTexture = true; }