diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-09-23 23:57:56 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-09-23 23:57:56 +0200 |
commit | 4f33e96ef1b2323e88206dc9a3deb4fc2c333738 (patch) | |
tree | ff3ec0366f3325181e4822dcde1e669c449c1dcc /src | |
parent | 4690ba0cc66338b1f00e08fb6054ee95c1c0dcc6 (diff) |
Temporary fix for text-wraparound
Diffstat (limited to 'src')
-rw-r--r-- | src/Text.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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, |