Mercurial > fife-parpg
changeset 419:6dace911ac2d
Fixes a freeze when setting text in a label with word_wrap enabled. [t:408]
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 06 Feb 2010 20:38:37 +0000 |
parents | 70ba57cd9d18 |
children | 2d01d25222bd |
files | engine/core/video/fonts/fontbase.cpp |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/core/video/fonts/fontbase.cpp Sat Feb 06 18:50:36 2010 +0000 +++ b/engine/core/video/fonts/fontbase.cpp Sat Feb 06 20:38:37 2010 +0000 @@ -182,7 +182,7 @@ std::list<std::pair<size_t,std::string::const_iterator> > break_pos; bool firstLine = true; - while( pos != text.end() ) + while( pos != text.end()) { break_pos.clear(); if( !firstLine ) { @@ -190,7 +190,7 @@ } else { firstLine = false; } - + bool haveNewLine = false; while( getWidth(line) < render_width && pos != text.end() ) { @@ -219,10 +219,14 @@ // No break position and line length smaller than 2 // means the renderwidth is really screwed. Just continue // appending single character lines. - if( utf8::distance(line.begin(),line.end()) <= 1 ) { + if( utf8::distance(line.begin(),line.end()) <= 1 && line != "\n") { output.append(line); continue; } + + if (line == "\n") { + ++pos; + } // We can't do hyphenation here, // so we just retreat one character :-(