OpenTTD Source  14.0-beta1
gfx_layout.cpp File Reference
#include "stdafx.h"
#include "core/math_func.hpp"
#include "gfx_layout.h"
#include "string_func.h"
#include "debug.h"
#include "table/control_codes.h"
#include "gfx_layout_fallback.h"
#include "gfx_layout_icu.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

template<typename T >
static void GetLayouter (Layouter::LineCacheItem &line, std::string_view str, FontState &state)
 Helper for getting a ParagraphLayouter of the given type. More...
 
static bool IsConsumedFormattingCode (char32_t ch)
 Test whether a character is a non-printable formatting code.
 

Detailed Description

Handling of laying out text.

Definition in file gfx_layout.cpp.

Function Documentation

◆ GetLayouter()

template<typename T >
static void GetLayouter ( Layouter::LineCacheItem line,
std::string_view  str,
FontState state 
)
inlinestatic

Helper for getting a ParagraphLayouter of the given type.

Note
In case no ParagraphLayouter could be constructed, line.layout will be nullptr.
Parameters
lineThe cache item to store our layouter in.
strThe string to create a layouter for.
stateThe state of the font and color.
Template Parameters
TThe type of layouter we want.

Definition at line 63 of file gfx_layout.cpp.

References Layouter::LineCacheItem::buffer, FontState::cur_colour, FontState::fontsize, free(), Layouter::GetFont(), and Layouter::LineCacheItem::runs.