OpenTTD Source 20260917-master-gec444f7315
FallbackParagraphLayout::FallbackVisualRun Class Reference

Visual run contains data about the bit of text with the same font. More...

Inheritance diagram for FallbackParagraphLayout::FallbackVisualRun:
ParagraphLayouter::VisualRun

Public Member Functions

 FallbackVisualRun (Font *font, const char32_t *chars, int glyph_count, int char_offset, int x)
 Create the visual run.
const Font * GetFont () const override
 Get the font.
size_t GetGlyphCount () const override
 Get the number of glyphs.
std::span< const GlyphID > GetGlyphs () const override
 Get the glyphs to draw.
std::span< const Position > GetPositions () const override
 Get the positions for each of the glyphs.
int GetLeading () const override
 Get the font leading, or distance between the baselines of consecutive lines.
std::span< const int > GetGlyphToCharMap () const override
 The offset for each of the glyphs to the character run that was passed to the Layouter.
Public Member Functions inherited from ParagraphLayouter::VisualRun
virtual ~VisualRun ()=default
 Ensure the destructor of the sub classes are called as well.

Private Attributes

std::vector< GlyphID > glyphs
 The glyphs we're drawing.
std::vector< Position > positions
 The positions of the glyphs.
std::vector< int > glyph_to_char
 The char index of the glyphs.
Font * font
 The font used to layout these.

Detailed Description

Visual run contains data about the bit of text with the same font.

Definition at line 41 of file gfx_layout_fallback.cpp.

Constructor & Destructor Documentation

◆ FallbackVisualRun()

FallbackParagraphLayout::FallbackVisualRun::FallbackVisualRun ( Font * font,
const char32_t * chars,
int char_count,
int char_offset,
int x )

Create the visual run.

Parameters
fontThe font to use for this run.
charsThe characters to use for this run.
char_countThe number of characters in this run.
char_offsetThis run's offset from the start of the layout input string.
xThe initial x position for this run.

Definition at line 112 of file gfx_layout_fallback.cpp.

References font, glyph_to_char, glyphs, positions, and ScaleSpriteTrad().

Member Function Documentation

◆ GetFont()

const Font * FallbackParagraphLayout::FallbackVisualRun::GetFont ( ) const
inlineoverridevirtual

Get the font.

Returns
The font used for this run.

Implements ParagraphLayouter::VisualRun.

Definition at line 50 of file gfx_layout_fallback.cpp.

Referenced by GetLeading().

◆ GetGlyphCount()

size_t FallbackParagraphLayout::FallbackVisualRun::GetGlyphCount ( ) const
inlineoverridevirtual

Get the number of glyphs.

Returns
The number of glyphs for this run.

Implements ParagraphLayouter::VisualRun.

Definition at line 51 of file gfx_layout_fallback.cpp.

◆ GetGlyphs()

std::span< const GlyphID > FallbackParagraphLayout::FallbackVisualRun::GetGlyphs ( ) const
inlineoverridevirtual

Get the glyphs to draw.

Returns
The glyphs.

Implements ParagraphLayouter::VisualRun.

Definition at line 52 of file gfx_layout_fallback.cpp.

◆ GetGlyphToCharMap()

std::span< const int > FallbackParagraphLayout::FallbackVisualRun::GetGlyphToCharMap ( ) const
inlineoverridevirtual

The offset for each of the glyphs to the character run that was passed to the Layouter.

Returns
The offsets.

Implements ParagraphLayouter::VisualRun.

Definition at line 55 of file gfx_layout_fallback.cpp.

◆ GetLeading()

int FallbackParagraphLayout::FallbackVisualRun::GetLeading ( ) const
inlineoverridevirtual

Get the font leading, or distance between the baselines of consecutive lines.

Returns
The leading in pixels.

Implements ParagraphLayouter::VisualRun.

Definition at line 54 of file gfx_layout_fallback.cpp.

References Font::fc, GetFont(), and FontCache::GetHeight().

◆ GetPositions()

std::span< const Position > FallbackParagraphLayout::FallbackVisualRun::GetPositions ( ) const
inlineoverridevirtual

Get the positions for each of the glyphs.

Returns
The glyph positions.

Implements ParagraphLayouter::VisualRun.

Definition at line 53 of file gfx_layout_fallback.cpp.

Field Documentation

◆ font

Font* FallbackParagraphLayout::FallbackVisualRun::font
private

The font used to layout these.

Definition at line 46 of file gfx_layout_fallback.cpp.

Referenced by FallbackVisualRun().

◆ glyph_to_char

std::vector<int> FallbackParagraphLayout::FallbackVisualRun::glyph_to_char
private

The char index of the glyphs.

Definition at line 44 of file gfx_layout_fallback.cpp.

Referenced by FallbackVisualRun().

◆ glyphs

std::vector<GlyphID> FallbackParagraphLayout::FallbackVisualRun::glyphs
private

The glyphs we're drawing.

Definition at line 42 of file gfx_layout_fallback.cpp.

Referenced by FallbackVisualRun().

◆ positions

std::vector<Position> FallbackParagraphLayout::FallbackVisualRun::positions
private

The positions of the glyphs.

Definition at line 43 of file gfx_layout_fallback.cpp.

Referenced by FallbackVisualRun().


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