| Flutter Impeller |

Public Member Functions | List of all members
impeller::interop::ParagraphStyle Class Referencefinal

`#include <paragraph_style.h>`

Inheritance diagram for impeller::interop::ParagraphStyle:

## Public Member Functions
| ParagraphStyle ()
| ~ParagraphStyle () override
| ParagraphStyle (const ParagraphStyle &)=delete
ParagraphStyle & | operator= (const ParagraphStyle &)=delete
void | SetForeground (ScopedObject< Paint > paint)
void | SetBackground (ScopedObject< Paint > paint)
void | SetFontWeight (txt::FontWeight weight)
void | SetFontStyle (txt::FontStyle style)
void | SetFontFamily (std::string family)
void | SetFontSize (double size)
void | SetHeight (double height)
void | SetTextAlignment (txt::TextAlign alignment)
void | SetTextDirection (txt::TextDirection direction)
void | SetTextDecoration (const ImpellerTextDecoration &decoration)
void | SetMaxLines (size_t max_lines)
void | SetLocale (std::string locale)
void | SetEllipsis (const std::string &string)
txt::TextStyle | CreateTextStyle () const
const txt::ParagraphStyle & | GetParagraphStyle () const
Public Member Functions inherited from impeller::interop::ObjectBase
| ObjectBase ()=default
virtual | ~ObjectBase ()=default
| ObjectBase (const ObjectBase &)=delete
| ObjectBase (ObjectBase &&)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
ObjectBase & | operator= (ObjectBase &&)=delete
void | Retain ()
void | Release ()
uint64_t | GetRefCountForTests () const

## Additional Inherited Members
Public Types inherited from impeller::interop::Object< ParagraphStyle, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerParagraphStyle)>
using | InteropClass = ParagraphStyle
using | InteropCSibling = IMPELLER_INTERNAL_HANDLE_NAME(ImpellerParagraphStyle)
Static Public Member Functions inherited from impeller::interop::ObjectBase
static void | SafeRetain (void *ptr)
static void | SafeRelease (void *ptr)

## Detailed Description

Definition at line 15 of file paragraph_style.h.

## Constructor & Destructor Documentation

## ◆ ParagraphStyle() [1/2]

impeller::interop::ParagraphStyle::ParagraphStyle | ( |  | ) |
| explicitdefault

## ◆ ~ParagraphStyle()

impeller::interop::ParagraphStyle::~ParagraphStyle | ( |  | ) |
| overridedefault

## ◆ ParagraphStyle() [2/2]

impeller::interop::ParagraphStyle::ParagraphStyle | ( | const ParagraphStyle & |  | ) |
| delete

## Member Function Documentation

## ◆ CreateTextStyle()

txt::TextStyle impeller::interop::ParagraphStyle::CreateTextStyle | ( |  | ) | const

Definition at line 60 of file paragraph_style.cc.

60 {
61 auto style = style_.GetTextStyle();
62
63 if (foreground_) {
64 style.foreground = foreground_->GetPaint();
65 }
66 if (background_) {
67 style.background = background_->GetPaint();
68 }
69 if (decoration_.has_value()) {
70 const auto& decoration = decoration_.value();
71 style.decoration = decoration.types;
72 style.decoration_color = ToSkiaType(decoration.color);
73 style.decoration_style = ToTxtType(decoration.style);
74 style.decoration_thickness_multiplier = decoration.thickness_multiplier;
75 }
76
77 return style;
78 }
impeller::interop::ToTxtType
constexpr txt::TextDecorationStyle ToTxtType(ImpellerTextDecorationStyle style)
Definition: formats.h:442
impeller::interop::ToSkiaType
constexpr std::optional< SkRect > ToSkiaType(const ImpellerRect *rect)
Definition: formats.h:30

References impeller::interop::ToSkiaType(), and impeller::interop::ToTxtType().

Referenced by impeller::interop::ParagraphBuilder::PushStyle().

## ◆ GetParagraphStyle()

const txt::ParagraphStyle & impeller::interop::ParagraphStyle::GetParagraphStyle | ( |  | ) | const

Definition at line 80 of file paragraph_style.cc.

80 {
81 return style_;
82 }

Referenced by impeller::interop::ParagraphBuilder::PushStyle().

## ◆ operator=()

ParagraphStyle& impeller::interop::ParagraphStyle::operator= | ( | const ParagraphStyle & |  | ) |
| delete

## ◆ SetBackground()

void impeller::interop::ParagraphStyle::SetBackground | ( | ScopedObject< Paint > | paint | ) |

Definition at line 56 of file paragraph_style.cc.

56 {
57 background_ = std::move(paint);
58 }

## ◆ SetEllipsis()

void impeller::interop::ParagraphStyle::SetEllipsis | ( | const std::string & | string | ) |

Definition at line 89 of file paragraph_style.cc.

89 {
90 if (string.empty()) {
91 style_.ellipsis = {};
92 return;
93 }
94 style_.ellipsis = fml::Utf8ToUtf16(string);
95 }

## ◆ SetFontFamily()

void impeller::interop::ParagraphStyle::SetFontFamily | ( | std::string | family | ) |

Definition at line 23 of file paragraph_style.cc.

23 {
24 style_.font_family = std::move(family);
25 }

## ◆ SetFontSize()

void impeller::interop::ParagraphStyle::SetFontSize | ( | double | size | ) |

Definition at line 27 of file paragraph_style.cc.

27 {
28 style_.font_size = size;
29 }

## ◆ SetFontStyle()

void impeller::interop::ParagraphStyle::SetFontStyle | ( | txt::FontStyle | style | ) |

Definition at line 19 of file paragraph_style.cc.

19 {
20 style_.font_style = style;
21 }

## ◆ SetFontWeight()

void impeller::interop::ParagraphStyle::SetFontWeight | ( | txt::FontWeight | weight | ) |

Definition at line 15 of file paragraph_style.cc.

15 {
16 style_.font_weight = weight;
17 }

## ◆ SetForeground()

void impeller::interop::ParagraphStyle::SetForeground | ( | ScopedObject< Paint > | paint | ) |

Definition at line 52 of file paragraph_style.cc.

52 {
53 foreground_ = std::move(paint);
54 }

## ◆ SetHeight()

void impeller::interop::ParagraphStyle::SetHeight | ( | double | height | ) |

Definition at line 31 of file paragraph_style.cc.

31 {
32 style_.height = height;
33 style_.has_height_override = (height != 0.0);
34 }

## ◆ SetLocale()

void impeller::interop::ParagraphStyle::SetLocale | ( | std::string | locale | ) |

Definition at line 48 of file paragraph_style.cc.

48 {
49 style_.locale = std::move(locale);
50 }

## ◆ SetMaxLines()

void impeller::interop::ParagraphStyle::SetMaxLines | ( | size_t | max_lines | ) |

Definition at line 44 of file paragraph_style.cc.

44 {
45 style_.max_lines = max_lines;
46 }

## ◆ SetTextAlignment()

void impeller::interop::ParagraphStyle::SetTextAlignment | ( | txt::TextAlign | alignment | ) |

Definition at line 36 of file paragraph_style.cc.

36 {
37 style_.text_align = alignment;
38 }

## ◆ SetTextDecoration()

void impeller::interop::ParagraphStyle::SetTextDecoration | ( | const ImpellerTextDecoration & | decoration | ) |

Definition at line 84 of file paragraph_style.cc.

85 {
86 decoration_ = decoration;
87 }

## ◆ SetTextDirection()

void impeller::interop::ParagraphStyle::SetTextDirection | ( | txt::TextDirection | direction | ) |

Definition at line 40 of file paragraph_style.cc.

40 {
41 style_.text_direction = direction;
42 }

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

- impeller/toolkit/interop/paragraph_style.h
- impeller/toolkit/interop/paragraph_style.cc