Flutter Engine
 
Loading...
Searching...
No Matches
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, const 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 AddText (const uint8_t *utf8_data, size_t byte_length) 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 20 of file paragraph_builder_skia.h.

Constructor & Destructor Documentation

◆ ParagraphBuilderSkia()

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

Definition at line 35 of file paragraph_builder_skia.cc.

39 : base_style_(style.GetTextStyle()), impeller_enabled_(impeller_enabled) {
40 builder_ = skt::ParagraphBuilder::make(
41 TxtToSkia(style), font_collection->CreateSktFontCollection(),
42 SkUnicodes::ICU::Make());
43}

◆ ~ParagraphBuilderSkia()

txt::ParagraphBuilderSkia::~ParagraphBuilderSkia ( )
virtualdefault

Member Function Documentation

◆ AddPlaceholder()

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

Definition at line 70 of file paragraph_builder_skia.cc.

70 {
71 skt::PlaceholderStyle placeholder_style;
72 placeholder_style.fHeight = span.height;
73 placeholder_style.fWidth = span.width;
74 placeholder_style.fBaseline = static_cast<skt::TextBaseline>(span.baseline);
75 placeholder_style.fBaselineOffset = span.baseline_offset;
76 placeholder_style.fAlignment =
77 static_cast<skt::PlaceholderAlignment>(span.alignment);
78
79 builder_->addPlaceholder(placeholder_style);
80}

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

◆ AddText() [1/2]

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

Definition at line 61 of file paragraph_builder_skia.cc.

61 {
62 builder_->addText(text);
63}
std::u16string text

References text.

◆ AddText() [2/2]

void txt::ParagraphBuilderSkia::AddText ( const uint8_t *  utf8_data,
size_t  byte_length 
)
overridevirtual

Definition at line 65 of file paragraph_builder_skia.cc.

66 {
67 builder_->addText(reinterpret_cast<const char*>(utf8_data), byte_length);
68}

◆ Build()

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

Definition at line 82 of file paragraph_builder_skia.cc.

82 {
83 return std::make_unique<ParagraphSkia>(
84 builder_->Build(), std::move(dl_paints_), impeller_enabled_);
85}

◆ PeekStyle()

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

Definition at line 57 of file paragraph_builder_skia.cc.

57 {
58 return txt_style_stack_.empty() ? base_style_ : txt_style_stack_.top();
59}

◆ Pop()

void txt::ParagraphBuilderSkia::Pop ( )
overridevirtual

Definition at line 52 of file paragraph_builder_skia.cc.

52 {
53 builder_->pop();
54 txt_style_stack_.pop();
55}

◆ PushStyle()

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

Definition at line 47 of file paragraph_builder_skia.cc.

47 {
48 builder_->pushStyle(TxtToSkia(style));
49 txt_style_stack_.push(style);
50}

Friends And Related Symbol Documentation

◆ SkiaParagraphBuilderTests_ParagraphStrutStyle_Test

friend class SkiaParagraphBuilderTests_ParagraphStrutStyle_Test
friend

Definition at line 37 of file paragraph_builder_skia.h.


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