Changeset - r28433:d649d9d0b482
[Not reviewed]
master
0 1 0
Rubidium - 11 months ago 2024-01-11 20:39:47
rubidium@openttd.org
Fix #11485: new run on same line must not use last_space of previous run as cut-off point

Use the start of the next run instead as the location of the last space.
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/gfx_layout_fallback.cpp
Show inline comments
 
@@ -253,12 +253,17 @@ std::unique_ptr<const ParagraphLayouter:
 
			l->emplace_back(iter->second, begin, this->buffer - begin, begin - this->buffer_begin, w);
 
			++iter;
 
			assert(iter != this->runs.end());
 

	
 
			next_run = this->buffer_begin + iter->first;
 
			begin = this->buffer;
 
			/* Since a next run is started, there is already some text that
 
			 * will be shown for this line. However, we do not want to break
 
			 * this line at the previous space, so pretend we passed a space
 
			 * just before this next run. */
 
			last_space = begin - 1;
 
		}
 

	
 
		if (IsWhitespace(c)) last_space = this->buffer;
 

	
 
		if (IsPrintable(c) && !IsTextDirectionChar(c)) {
 
			int char_width = GetCharacterWidth(fc->GetSize(), c);
0 comments (0 inline, 0 general)