From 4f33e96ef1b2323e88206dc9a3deb4fc2c333738 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 23 Sep 2020 23:57:56 +0200 Subject: Temporary fix for text-wraparound --- src/Text.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Text.cpp') diff --git a/src/Text.cpp b/src/Text.cpp index bdd41c3..4aaf1c6 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -229,10 +229,10 @@ namespace QuickMedia sf::Vector2f glyphPos; sf::Uint32 prevCodePoint = 0; - size_t lastSpacingWordWrapIndex = -1; - float lastSpacingAccumulatedOffset = 0.0f; for(usize textElementIndex = 0; textElementIndex < textElements.size(); ++textElementIndex) { + size_t lastSpacingWordWrapIndex = -1; + float lastSpacingAccumulatedOffset = 0.0f; TextElement &textElement = textElements[textElementIndex]; const sf::Font *ff = font; size_t vertices_index = 0; @@ -296,6 +296,8 @@ namespace QuickMedia } const sf::Glyph &glyph = ff->getGlyph(codePoint, characterSize, false); + // TODO: Fix wrap-around with multiple textElements. Right now it only wrap-arounds within the same textElement, so with mixed latin-japanese it will + // wrap at character size rather than at whitespace if(glyphPos.x + glyph.advance > maxWidth) { // If there was a space in the text and text width is too long, then we need to word wrap at space index instead, -- cgit v1.2.3