OpenTTD Source
20241125-master-g5b02f51e17
|
Handling of laying out text. More...
#include "stdafx.h"
#include "core/math_func.hpp"
#include "gfx_layout.h"
#include "string_func.h"
#include "strings_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. | |
ParagraphLayouter::Position | GetCharPosInString (std::string_view str, const char *ch, FontSize start_fontsize) |
Get the leading corner of a character in a single-line string relative to the start of the string. More... | |
ptrdiff_t | GetCharAtPosition (std::string_view str, int x, FontSize start_fontsize) |
Get the character from a string that is drawn at a specific position. More... | |
Handling of laying out text.
Definition in file gfx_layout.cpp.
ptrdiff_t GetCharAtPosition | ( | std::string_view | str, |
int | x, | ||
FontSize | start_fontsize | ||
) |
Get the character from a string that is drawn at a specific position.
str | String to test. |
x | Position relative to the start of the string. |
start_fontsize | Font size to start the text with. |
Definition at line 438 of file gfx_layout.cpp.
ParagraphLayouter::Position GetCharPosInString | ( | std::string_view | str, |
const char * | ch, | ||
FontSize | start_fontsize | ||
) |
Get the leading corner of a character in a single-line string relative to the start of the string.
str | String containing the character. |
ch | Pointer to the character in the string. |
start_fontsize | Font size to start the text with. |
Definition at line 421 of file gfx_layout.cpp.
References Layouter::GetCharPosition().
Referenced by Textbuf::UpdateCaretPosition(), and Textbuf::UpdateMarkedText().
|
inlinestatic |
Helper for getting a ParagraphLayouter of the given type.
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. |
T | The type of layouter we want. |
Definition at line 64 of file gfx_layout.cpp.
References Layouter::LineCacheItem::buffer, FontState::cur_colour, FontState::fontsize, free(), Layouter::GetFont(), and Layouter::LineCacheItem::runs.