Flutter Engine
txt::ParagraphBuilderSkia Class Reference

#include <paragraph_builder_skia.h>

Inheritance diagram for txt::ParagraphBuilderSkia:
txt::ParagraphBuilder

Public Member Functions

 ParagraphBuilderSkia (const ParagraphStyle &style, std::shared_ptr< FontCollection > font_collection)
 
virtual ~ParagraphBuilderSkia ()
 
virtual void PushStyle (const TextStyle &style) override
 
virtual void Pop () override
 
virtual const TextStylePeekStyle () override
 
virtual void AddText (const std::u16string &text) override
 
virtual void AddPlaceholder (PlaceholderRun &span) override
 
virtual std::unique_ptr< ParagraphBuild () override
 
- Public Member Functions inherited from txt::ParagraphBuilder
virtual ~ParagraphBuilder ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from txt::ParagraphBuilder
static std::unique_ptr< ParagraphBuilderCreateTxtBuilder (const ParagraphStyle &style, std::shared_ptr< FontCollection > font_collection)
 
- Protected Member Functions inherited from txt::ParagraphBuilder
 ParagraphBuilder ()=default
 

Detailed Description

Definition at line 27 of file paragraph_builder_skia.h.

Constructor & Destructor Documentation

◆ ParagraphBuilderSkia()

txt::ParagraphBuilderSkia::ParagraphBuilderSkia ( const ParagraphStyle style,
std::shared_ptr< FontCollection font_collection 
)

Definition at line 138 of file paragraph_builder_skia.cc.

References ~ParagraphBuilderSkia().

141  : builder_(skt::ParagraphBuilder::make(
142  TxtToSkia(style),
143  font_collection->CreateSktFontCollection())),
144  base_style_(style.GetTextStyle()) {}

◆ ~ParagraphBuilderSkia()

txt::ParagraphBuilderSkia::~ParagraphBuilderSkia ( )
virtualdefault

Referenced by ParagraphBuilderSkia().

Member Function Documentation

◆ AddPlaceholder()

void txt::ParagraphBuilderSkia::AddPlaceholder ( PlaceholderRun span)
overridevirtual

Implements txt::ParagraphBuilder.

Definition at line 166 of file paragraph_builder_skia.cc.

References txt::PlaceholderRun::alignment, txt::PlaceholderRun::baseline, txt::PlaceholderRun::baseline_offset, txt::PlaceholderRun::height, and txt::PlaceholderRun::width.

166  {
167  skt::PlaceholderStyle placeholder_style;
168  placeholder_style.fHeight = span.height;
169  placeholder_style.fWidth = span.width;
170  placeholder_style.fBaseline = static_cast<skt::TextBaseline>(span.baseline);
171  placeholder_style.fBaselineOffset = span.baseline_offset;
172  placeholder_style.fAlignment =
173  static_cast<skt::PlaceholderAlignment>(span.alignment);
174 
175  builder_->addPlaceholder(placeholder_style);
176 }
TextBaseline
Definition: text_baseline.h:22
PlaceholderAlignment
Where to vertically align the placeholder relative to the surrounding text.

◆ AddText()

void txt::ParagraphBuilderSkia::AddText ( const std::u16string &  text)
overridevirtual

Implements txt::ParagraphBuilder.

Definition at line 162 of file paragraph_builder_skia.cc.

162  {
163  builder_->addText(text);
164 }

◆ Build()

std::unique_ptr< Paragraph > txt::ParagraphBuilderSkia::Build ( )
overridevirtual

Implements txt::ParagraphBuilder.

Definition at line 178 of file paragraph_builder_skia.cc.

178  {
179  return std::unique_ptr<Paragraph>(new ParagraphSkia(builder_->Build()));
180 }

◆ PeekStyle()

const TextStyle & txt::ParagraphBuilderSkia::PeekStyle ( )
overridevirtual

Implements txt::ParagraphBuilder.

Definition at line 158 of file paragraph_builder_skia.cc.

158  {
159  return txt_style_stack_.empty() ? base_style_ : txt_style_stack_.top();
160 }

◆ Pop()

void txt::ParagraphBuilderSkia::Pop ( )
overridevirtual

Implements txt::ParagraphBuilder.

Definition at line 153 of file paragraph_builder_skia.cc.

153  {
154  builder_->pop();
155  txt_style_stack_.pop();
156 }

◆ PushStyle()

void txt::ParagraphBuilderSkia::PushStyle ( const TextStyle style)
overridevirtual

Implements txt::ParagraphBuilder.

Definition at line 148 of file paragraph_builder_skia.cc.

148  {
149  builder_->pushStyle(TxtToSkia(style));
150  txt_style_stack_.push(style);
151 }

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