Skip to content

Commit

Permalink
Treat spaces as ordinary characters and let them trigger a line break…
Browse files Browse the repository at this point in the history
…. This should fix up darkmod.txt description text rendering in cases such as in Heart of Lone Salvation.
  • Loading branch information
codereader committed Nov 21, 2017
1 parent c5d3c7a commit 9a4c1aa
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions plugins/dm.gui/gui/RenderableText.cpp
Expand Up @@ -132,15 +132,12 @@ void RenderableText::recompile()
// Add the words to lines
TextLinePtr curLine(new TextLine(_owner.rect[2] - 2 - _owner.textalignx, scale));

const std::string space(" ");

while (!words.empty())
{
// Empty words are stemming from an extra space character, re-add that
if (words.front().empty())
{
curLine->addChar(' ', glyphSet, true);
words.pop_front();
continue;
}
// Empty words are stemming from an extra space character, treat them as space
const std::string& wordToAdd = words.front().empty() ? space : words.front();

// If nowrap set to true, force words into this line
bool added = curLine->addWord(words.front(), glyphSet, _owner.nowrap);
Expand Down

0 comments on commit 9a4c1aa

Please sign in to comment.