diff --git a/RetroFE/Source/Graphics/Component/Text.cpp b/RetroFE/Source/Graphics/Component/Text.cpp index 7fc9d9a..e6b8c8f 100644 --- a/RetroFE/Source/Graphics/Component/Text.cpp +++ b/RetroFE/Source/Graphics/Component/Text.cpp @@ -66,10 +66,11 @@ void Text::Draw() { Font::GlyphInfo glyph; if(FontInst->GetRect(TextData[i], glyph)) - { - imageWidth += glyph.Advance; - imageHeight = (imageHeight >= glyph.Rect.h) ? imageHeight : glyph.Rect.h; + { + imageWidth += glyph.Advance; + imageHeight = (imageHeight >= glyph.Rect.h) ? imageHeight : glyph.Rect.h; } + } float scale = (float)info->GetFontSize() / (float)imageHeight; @@ -106,6 +107,11 @@ void Text::Draw() SDL::RenderCopy(t, static_cast(info->GetAlpha() * 255), &charRect, &rect, info->GetAngle()); rect.x += static_cast(glyph.Advance * scale); + + if(static_cast(rect.x) - xOrigin) > info->getMaxWidth()) + { + break; + } } } }