Skip to content

Commit 296ea63

Browse files
committed
Duplicating the maxTextSize
1 parent 9e5c881 commit 296ea63

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

engine/core/subsystem/UISystem.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,14 @@ void UISystem::createText(TextComponent& text, UIComponent& ui, UILayoutComponen
218218
std::vector<uint16_t> indices_array;
219219

220220
if (text.text.length() > text.maxTextSize){
221-
Log::warn("Text is bigger than maxTextSize: %i. Increasing it to: %i", text.maxTextSize, text.text.length());
222-
text.maxTextSize = text.text.length();
221+
unsigned int newSize = text.maxTextSize;
222+
if (newSize == 0) newSize = 1;
223+
while (newSize < text.text.length()){
224+
newSize *= 2;
225+
}
226+
227+
Log::warn("Text is bigger than maxTextSize: %i. Increasing it to: %i", text.maxTextSize, newSize);
228+
text.maxTextSize = newSize;
223229
if (ui.loaded){
224230
ui.needReload = true;
225231
}

0 commit comments

Comments
 (0)