Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
txt::ParagraphBuilderSkia Class Reference

ParagraphBuilder implementation using Skia's text layout module. More...

#include <paragraph_builder_skia.h>

Inheritance diagram for txt::ParagraphBuilderSkia:
flutter::ParagraphBuilder flutter::RefCountedDartWrappable< ParagraphBuilder > fml::RefCountedThreadSafe< T > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

 ParagraphBuilderSkia (const ParagraphStyle &style, std::shared_ptr< FontCollection > font_collection, const bool impeller_enabled)
 
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 flutter::ParagraphBuilder
 ~ParagraphBuilder () override
 
void pushStyle (const tonic::Int32List &encoded, const std::vector< std::string > &fontFamilies, double fontSize, double letterSpacing, double wordSpacing, double height, double decorationThickness, const std::string &locale, Dart_Handle background_objects, Dart_Handle background_data, Dart_Handle foreground_objects, Dart_Handle foreground_data, Dart_Handle shadows_data, Dart_Handle font_features_data, Dart_Handle font_variations_data)
 
void pop ()
 
Dart_Handle addText (const std::u16string &text)
 
void addPlaceholder (double width, double height, unsigned alignment, double baseline_offset, unsigned baseline)
 
void build (Dart_Handle paragraph_handle)
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< ParagraphBuilder >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< T >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Friends

class SkiaParagraphBuilderTests_ParagraphStrutStyle_Test
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields { kPeerIndex , kNumberOfNativeFields }
 
- Static Public Member Functions inherited from flutter::ParagraphBuilder
static void Create (Dart_Handle wrapper, Dart_Handle encoded_handle, Dart_Handle strutData, const std::string &fontFamily, const std::vector< std::string > &strutFontFamilies, double fontSize, double height, const std::u16string &ellipsis, const std::string &locale)
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< T >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

ParagraphBuilder implementation using Skia's text layout module.

Note
Despite the suffix "Skia", this class is not specific to Skia and is also used with the Impeller backend.

Definition at line 32 of file paragraph_builder_skia.h.

Constructor & Destructor Documentation

◆ ParagraphBuilderSkia()

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

Definition at line 47 of file paragraph_builder_skia.cc.

51 : base_style_(style.GetTextStyle()), impeller_enabled_(impeller_enabled) {
52 builder_ = skt::ParagraphBuilder::make(
53 TxtToSkia(style), font_collection->CreateSktFontCollection());
54}

◆ ~ParagraphBuilderSkia()

txt::ParagraphBuilderSkia::~ParagraphBuilderSkia ( )
virtualdefault

Member Function Documentation

◆ AddPlaceholder()

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

Definition at line 76 of file paragraph_builder_skia.cc.

76 {
77 skt::PlaceholderStyle placeholder_style;
78 placeholder_style.fHeight = span.height;
79 placeholder_style.fWidth = span.width;
80 placeholder_style.fBaseline = static_cast<skt::TextBaseline>(span.baseline);
81 placeholder_style.fBaselineOffset = span.baseline_offset;
82 placeholder_style.fAlignment =
83 static_cast<skt::PlaceholderAlignment>(span.alignment);
84
85 builder_->addPlaceholder(placeholder_style);
86}
PlaceholderAlignment
Where to vertically align the placeholder relative to the surrounding text.
Definition TextStyle.h:87
PlaceholderAlignment fAlignment
Definition TextStyle.h:138

◆ AddText()

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

Definition at line 72 of file paragraph_builder_skia.cc.

72 {
73 builder_->addText(text);
74}
std::u16string text

◆ Build()

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

Definition at line 88 of file paragraph_builder_skia.cc.

88 {
89 return std::make_unique<ParagraphSkia>(
90 builder_->Build(), std::move(dl_paints_), impeller_enabled_);
91}

◆ PeekStyle()

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

Definition at line 68 of file paragraph_builder_skia.cc.

68 {
69 return txt_style_stack_.empty() ? base_style_ : txt_style_stack_.top();
70}

◆ Pop()

void txt::ParagraphBuilderSkia::Pop ( )
overridevirtual

Definition at line 63 of file paragraph_builder_skia.cc.

63 {
64 builder_->pop();
65 txt_style_stack_.pop();
66}

◆ PushStyle()

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

Definition at line 58 of file paragraph_builder_skia.cc.

58 {
59 builder_->pushStyle(TxtToSkia(style));
60 txt_style_stack_.push(style);
61}

Friends And Related Symbol Documentation

◆ SkiaParagraphBuilderTests_ParagraphStrutStyle_Test

friend class SkiaParagraphBuilderTests_ParagraphStrutStyle_Test
friend

Definition at line 48 of file paragraph_builder_skia.h.


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