OpenTTD Source: FontState Struct Reference

OpenTTD Source 15.0-RC2

Public Member Functions | Data Fields
FontState Struct Reference

Text drawing parameters, which can change while drawing a line, but are kept between multiple parts of the same text, e.g. More...

`#include <gfx_layout.h>`

## Public Member Functions
| FontState (TextColour colour, FontSize fontsize)
auto | operator<=> (const FontState &) const =default
void | SetColour (TextColour c)
| Switch to new colour c.
void | PopColour ()
| Switch to and pop the last saved colour on the stack.
void | PushColour ()
| Push the current colour on to the stack.
void | SetFontSize (FontSize f)
| Switch to using a new font f.

## Data Fields
FontSize | fontsize
| Current font size.
TextColour | cur_colour
| Current text colour.
std::vector< TextColour > | colour_stack
| Stack of colours to assist with colour switching.

## Detailed Description

Text drawing parameters, which can change while drawing a line, but are kept between multiple parts of the same text, e.g.

on line breaks.

Definition at line 24 of file gfx_layout.h.

## Constructor & Destructor Documentation

## ◆ FontState() [1/2]

FontState::FontState | ( |  | ) |
| inline

Definition at line 29 of file gfx_layout.h.

## ◆ FontState() [2/2]

FontState::FontState | ( | TextColour | colour,
|  | FontSize | fontsize
| ) |  |
| inline

Definition at line 30 of file gfx_layout.h.

## Member Function Documentation

## ◆ PopColour()

void FontState::PopColour | ( |  | ) |
| inline

Switch to and pop the last saved colour on the stack.

Definition at line 48 of file gfx_layout.h.

References colour_stack, and SetColour().

Referenced by GetLayouter().

## ◆ PushColour()

void FontState::PushColour | ( |  | ) |
| inline

Push the current colour on to the stack.

Definition at line 58 of file gfx_layout.h.

References colour_stack.

Referenced by GetLayouter().

## ◆ SetColour()

void FontState::SetColour | ( | TextColour | c | ) |
| inline

Switch to new colour c.

Parameters

  c | New colour to use.

Definition at line 38 of file gfx_layout.h.

References TC_COLOUR_MASK, TC_FLAGS_MASK, and TC_FORCED.

Referenced by GetLayouter(), and PopColour().

## ◆ SetFontSize()

void FontState::SetFontSize | ( | FontSize | f | ) |
| inline

Switch to using a new font f.

Parameters

  f | New font to use.

Definition at line 67 of file gfx_layout.h.

Referenced by GetLayouter().

## Field Documentation

## ◆ colour_stack

std::vector<TextColour> FontState::colour_stack

Stack of colours to assist with colour switching.

Definition at line 27 of file gfx_layout.h.

Referenced by PopColour(), and PushColour().

## ◆ cur_colour

TextColour FontState::cur_colour

Current text colour.

Definition at line 26 of file gfx_layout.h.

Referenced by GetLayouter().

## ◆ fontsize

FontSize FontState::fontsize

Current font size.

Definition at line 25 of file gfx_layout.h.

Referenced by GetLayouter().

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

- src/gfx_layout.h