OpenTTD

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

- File List
- Globals

Data Structures | Functions
gfx_layout.cpp File Reference

Handling of laying out text. More...

`#include "stdafx.h"`
`#include "gfx_layout.h"`
`#include "string_func.h"`
`#include "strings_func.h"`
`#include "debug.h"`
`#include "table/control_codes.h"`
`#include <unicode/ustring.h>`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
class | ICUParagraphLayout
| Wrapper for doing layouts with ICU. More...
class | ICUParagraphLayout::ICUVisualRun
| Visual run contains data about the bit of text with the same font. More...
class | ICUParagraphLayout::ICULine
| A single line worth of VisualRuns. More...
class | FallbackParagraphLayout
| Class handling the splitting of a paragraph of text into lines and visual runs. More...
class | FallbackParagraphLayout::FallbackVisualRun
| Visual run contains data about the bit of text with the same font. More...
class | FallbackParagraphLayout::FallbackLine
| A single line worth of VisualRuns. More...

## Functions
static size_t | AppendToBuffer (UChar *buff, const UChar *buffer_last, WChar c)
static ParagraphLayouter * | GetParagraphLayout (UChar *buff, UChar *buff_end, FontMap &fontMapping)
static size_t | AppendToBuffer (WChar *buff, const WChar *buffer_last, WChar c)
| Appand a wide character to the internal buffer.
static FallbackParagraphLayout * | GetParagraphLayout (WChar *buff, WChar *buff_end, FontMap &fontMapping)
| Get the actual ParagraphLayout for the given buffer.
template<typename T >
static void | GetLayouter (Layouter::LineCacheItem &line, const char *&str, FontState &state)
| Helper for getting a ParagraphLayouter of the given type.

## Detailed Description

Handling of laying out text.

Definition in file gfx_layout.cpp.

## Function Documentation

static size_t AppendToBuffer | ( | WChar * | buff,
|  | const WChar * | buffer_last,
|  | WChar | c
| ) |  |
| static

Appand a wide character to the internal buffer.

Parameters

  buff | The buffer to append to.
  buffer_last | The end of the buffer.
  c | The character to add.

Returns
  The number of buffer spaces that were used.

Definition at line 546 of file gfx_layout.cpp.

Referenced by GetLayouter().

template<typename T >

static void GetLayouter | ( | Layouter::LineCacheItem & | line,
|  | const char *& | str,
|  | FontState & | state
| ) |  |
| inline static

Helper for getting a ParagraphLayouter of the given type.

Note
  In case no ParagraphLayouter could be constructed, line.layout will be NULL.

Parameters

  line | The cache item to store our layouter in.
  str | The string to create a layouter for.
  state | The state of the font and color.

Template Parameters

  T | The type of layouter we want.

Definition at line 574 of file gfx_layout.cpp.

References AppendToBuffer(), Layouter::LineCacheItem::buffer, SmallMap< T, U, S >::Contains(), FontState::cur_colour, DRAW_STRING_BUFFER, FontState::fontsize, free(), FS_LARGE, FS_SMALL, Layouter::GetFont(), GetParagraphLayout(), SmallMap< T, U, S >::Insert(), IsTextDirectionChar(), Layouter::LineCacheItem::layout, Layouter::LineCacheItem::runs, SCC_BIGFONT, SCC_TINYFONT, FontState::SetColour(), FontState::SetFontSize(), FontState::SetPreviousColour(), and Layouter::LineCacheItem::state_after.

static FallbackParagraphLayout* GetParagraphLayout | ( | WChar * | buff,
|  | WChar * | buff_end,
|  | FontMap & | fontMapping
| ) |  |
| static

Get the actual ParagraphLayout for the given buffer.

Parameters

  buff | The begin of the buffer.
  buff_end | The location after the last element in the buffer.
  fontMapping | THe mapping of the fonts.

Returns
  The ParagraphLayout instance.

Definition at line 559 of file gfx_layout.cpp.

Referenced by GetLayouter().