Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
impeller::TextRun Class Reference

Represents a collection of positioned glyphs from a specific font. More...

#include <text_run.h>

Classes

struct  GlyphPosition
 

Public Member Functions

 TextRun (const Font &font)
 Create an empty text run with the specified font.
 
 TextRun (const Font &font, std::vector< GlyphPosition > &glyphs)
 
 ~TextRun ()
 
bool IsValid () const
 
bool AddGlyph (Glyph glyph, Point position)
 Add a glyph at the specified position to the run.
 
size_t GetGlyphCount () const
 Get the number of glyphs in the run.
 
const std::vector< GlyphPosition > & GetGlyphPositions () const
 Get a reference to all the glyph positions within the run.
 
const FontGetFont () const
 Get the font for this run.
 

Detailed Description

Represents a collection of positioned glyphs from a specific font.

Definition at line 20 of file text_run.h.

Constructor & Destructor Documentation

◆ TextRun() [1/2]

impeller::TextRun::TextRun ( const Font font)
explicit

Create an empty text run with the specified font.

Parameters
[in]fontThe font

Definition at line 9 of file text_run.cc.

9 : font_(font) {
10 if (!font_.IsValid()) {
11 return;
12 }
13 is_valid_ = true;
14}
bool IsValid() const
Definition font.cc:19

◆ TextRun() [2/2]

impeller::TextRun::TextRun ( const Font font,
std::vector< GlyphPosition > &  glyphs 
)

Definition at line 16 of file text_run.cc.

17 : font_(font), glyphs_(std::move(glyphs)) {
18 if (!font_.IsValid()) {
19 return;
20 }
21 is_valid_ = true;
22}
uint16_t glyphs[5]

◆ ~TextRun()

impeller::TextRun::~TextRun ( )
default

Member Function Documentation

◆ AddGlyph()

bool impeller::TextRun::AddGlyph ( Glyph  glyph,
Point  position 
)

Add a glyph at the specified position to the run.

Parameters
[in]glyphThe glyph
[in]positionThe position
Returns
If the glyph could be added to the run.

Definition at line 26 of file text_run.cc.

26 {
27 glyphs_.emplace_back(GlyphPosition{glyph, position});
28 return true;
29}

◆ GetFont()

const Font & impeller::TextRun::GetFont ( ) const

Get the font for this run.

Returns
The font.

Definition at line 43 of file text_run.cc.

43 {
44 return font_;
45}

◆ GetGlyphCount()

size_t impeller::TextRun::GetGlyphCount ( ) const

Get the number of glyphs in the run.

Returns
The glyph count.

Definition at line 39 of file text_run.cc.

39 {
40 return glyphs_.size();
41}

◆ GetGlyphPositions()

const std::vector< TextRun::GlyphPosition > & impeller::TextRun::GetGlyphPositions ( ) const

Get a reference to all the glyph positions within the run.

Returns
The glyph positions.

Definition at line 35 of file text_run.cc.

35 {
36 return glyphs_;
37}

◆ IsValid()

bool impeller::TextRun::IsValid ( ) const

Definition at line 31 of file text_run.cc.

31 {
32 return is_valid_;
33}

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