OpenTTD Source
12.0-beta2
|
Class handling the splitting of a paragraph of text into lines and visual runs. More...
Data Structures | |
class | FallbackLine |
A single line worth of VisualRuns. More... | |
class | FallbackVisualRun |
Visual run contains data about the bit of text with the same font. More... | |
Public Member Functions | |
FallbackParagraphLayout (WChar *buffer, int length, FontMap &runs) | |
Create a new paragraph layouter. More... | |
void | Reflow () override |
Reset the position to the start of the paragraph. | |
std::unique_ptr< const Line > | NextLine (int max_width) override |
Construct a new line with a maximum width. More... | |
Data Fields | |
const WChar * | buffer_begin |
Begin of the buffer. | |
const WChar * | buffer |
The current location in the buffer. | |
FontMap & | runs |
The fonts we have to use for this paragraph. | |
Class handling the splitting of a paragraph of text into lines and visual runs.
One constructs this class with the text that needs to be split into lines. Then nextLine is called with the maximum width until nullptr is returned. Each nextLine call creates VisualRuns which contain the length of text that are to be drawn with the same font. In other words, the result of this class is a list of sub strings with their font. The sub strings are then already fully laid out, and only need actual drawing.
The positions in a visual run are sequential pairs of X,Y of the begin of each of the glyphs plus an extra pair to mark the end.
Definition at line 248 of file gfx_layout.cpp.
Create a new paragraph layouter.
buffer | The characters of the paragraph. |
length | The length of the paragraph. |
runs | The font mapping of this paragraph. |
Definition at line 481 of file gfx_layout.cpp.
References runs.
|
overridevirtual |
Construct a new line with a maximum width.
max_width | The maximum width of the string. |
Implements ParagraphLayouter.
Definition at line 499 of file gfx_layout.cpp.
References buffer, buffer_begin, IsWhitespace(), and runs.