OpenTTD: FallbackParagraphLayout Class Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Data Structures | Public Types | Public Member Functions | Data Fields | Static Public Attributes
FallbackParagraphLayout Class Reference

Class handling the splitting of a paragraph of text into lines and visual runs. More...

Inheritance diagram for FallbackParagraphLayout:

## 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 Types
typedef WChar | CharType
| Helper for GetLayouter, to get the right type.

## Public Member Functions
| FallbackParagraphLayout (WChar *buffer, int length, FontMap &runs)
| Create a new paragraph layouter.
void | Reflow ()
| Reset the position to the start of the paragraph.
const ParagraphLayouter::Line * | NextLine (int max_width)
| Construct a new line with a maximum width.

## 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.

## Static Public Attributes
static const bool | SUPPORTS_RTL = false
| Helper for GetLayouter, to get whether the layouter supports RTL.

## Detailed Description

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 NULL 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.

Note
  This variant does not handle left-to-right properly. This is supported in the one ParagraphLayout coming from ICU.

Definition at line 237 of file gfx_layout.cpp.

## Member Typedef Documentation

typedef WChar FallbackParagraphLayout::CharType

Helper for GetLayouter, to get the right type.

Definition at line 240 of file gfx_layout.cpp.

## Constructor & Destructor Documentation

FallbackParagraphLayout::FallbackParagraphLayout | ( | WChar * | buffer,
|  | int | length,
|  | FontMap & | runs
| ) |  |

Create a new paragraph layouter.

Parameters

  buffer | The characters of the paragraph.
  length | The length of the paragraph.
  runs | The font mapping of this paragraph.

Definition at line 426 of file gfx_layout.cpp.

References SmallVector< T, S >::End().

## Member Function Documentation

const ParagraphLayouter::Line * FallbackParagraphLayout::NextLine | ( | int | max_width | ) |
| virtual

Construct a new line with a maximum width.

Parameters

  max_width | The maximum width of the string.

Returns
  A Line, or NULL when at the end of the paragraph.

Implements ParagraphLayouter.

Definition at line 444 of file gfx_layout.cpp.

References SmallVector< T, S >::Append(), SmallVector< T, S >::Begin(), buffer, buffer_begin, SmallVector< T, S >::End(), GetCharacterWidth(), FontCache::GetSize(), FallbackParagraphLayout::FallbackLine::GetWidth(), IsTextDirectionChar(), IsWhitespace(), SmallVector< T, S >::Length(), and runs.

## Field Documentation

const bool FallbackParagraphLayout::SUPPORTS_RTL = false
| static

Helper for GetLayouter, to get whether the layouter supports RTL.

Definition at line 242 of file gfx_layout.cpp.

The documentation for this class was generated from the following file:

- src/gfx_layout.cpp