Flutter Engine
The Flutter Engine
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< ParagraphBuilder > 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< ParagraphBuilder >
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
 
virtual void RetainDartWrappableReference () const =0
 
virtual void ReleaseDartWrappableReference () 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< ParagraphBuilder >
 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 48 of file paragraph_builder_skia.cc.

52 : base_style_(style.GetTextStyle()), impeller_enabled_(impeller_enabled) {
54 TxtToSkia(style),
55 font_collection->CreateSktFontCollection(),
57}
static std::unique_ptr< ParagraphBuilder > make(const ParagraphStyle &style, sk_sp< FontCollection > fontCollection, sk_sp< SkUnicode > unicode)
SKUNICODE_API sk_sp< SkUnicode > Make()

◆ ~ParagraphBuilderSkia()

txt::ParagraphBuilderSkia::~ParagraphBuilderSkia ( )
virtualdefault

Member Function Documentation

◆ AddPlaceholder()

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

Definition at line 79 of file paragraph_builder_skia.cc.

79 {
80 skt::PlaceholderStyle placeholder_style;
81 placeholder_style.fHeight = span.height;
82 placeholder_style.fWidth = span.width;
83 placeholder_style.fBaseline = static_cast<skt::TextBaseline>(span.baseline);
84 placeholder_style.fBaselineOffset = span.baseline_offset;
85 placeholder_style.fAlignment =
86 static_cast<skt::PlaceholderAlignment>(span.alignment);
87
88 builder_->addPlaceholder(placeholder_style);
89}
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 75 of file paragraph_builder_skia.cc.

75 {
76 builder_->addText(text);
77}
std::u16string text

◆ Build()

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

Definition at line 91 of file paragraph_builder_skia.cc.

91 {
92 return std::make_unique<ParagraphSkia>(
93 builder_->Build(), std::move(dl_paints_), impeller_enabled_);
94}

◆ PeekStyle()

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

Definition at line 71 of file paragraph_builder_skia.cc.

71 {
72 return txt_style_stack_.empty() ? base_style_ : txt_style_stack_.top();
73}

◆ Pop()

void txt::ParagraphBuilderSkia::Pop ( )
overridevirtual

Definition at line 66 of file paragraph_builder_skia.cc.

66 {
67 builder_->pop();
68 txt_style_stack_.pop();
69}

◆ PushStyle()

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

Definition at line 61 of file paragraph_builder_skia.cc.

61 {
62 builder_->pushStyle(TxtToSkia(style));
63 txt_style_stack_.push(style);
64}

Friends And Related Function 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: