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 139 of file paragraph_builder_skia.cc.

References ~ParagraphBuilderSkia().

142  : builder_(skt::ParagraphBuilder::make(
143  TxtToSkia(style),
144  font_collection->CreateSktFontCollection())),
145  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 167 of file paragraph_builder_skia.cc.

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

167  {
168  skt::PlaceholderStyle placeholder_style;
169  placeholder_style.fHeight = span.height;
170  placeholder_style.fWidth = span.width;
171  placeholder_style.fBaseline = static_cast<skt::TextBaseline>(span.baseline);
172  placeholder_style.fBaselineOffset = span.baseline_offset;
173  placeholder_style.fAlignment =
174  static_cast<skt::PlaceholderAlignment>(span.alignment);
175 
176  builder_->addPlaceholder(placeholder_style);
177 }
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 163 of file paragraph_builder_skia.cc.

163  {
164  builder_->addText(text);
165 }
std::u16string text

◆ Build()

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

Implements txt::ParagraphBuilder.

Definition at line 179 of file paragraph_builder_skia.cc.

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

◆ PeekStyle()

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

Implements txt::ParagraphBuilder.

Definition at line 159 of file paragraph_builder_skia.cc.

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

◆ Pop()

void txt::ParagraphBuilderSkia::Pop ( )
overridevirtual

Implements txt::ParagraphBuilder.

Definition at line 154 of file paragraph_builder_skia.cc.

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

◆ PushStyle()

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

Implements txt::ParagraphBuilder.

Definition at line 149 of file paragraph_builder_skia.cc.

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

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