7 #include "flutter/fml/string_conversion.h"
16 style_.font_weight = weight;
20 style_.font_style = style;
24 style_.font_family = std::move(family);
28 style_.font_size = size;
32 style_.height = height;
33 style_.has_height_override = (height != 0.0);
37 style_.text_align = alignment;
41 style_.text_direction = direction;
45 style_.max_lines = max_lines;
49 style_.locale = std::move(locale);
53 foreground_ = std::move(paint);
57 background_ = std::move(paint);
61 auto style = style_.GetTextStyle();
64 style.foreground = foreground_->GetPaint();
67 style.background = background_->GetPaint();
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;
86 decoration_ = decoration;
94 style_.ellipsis = fml::Utf8ToUtf16(
string);
~ParagraphStyle() override
void SetFontWeight(txt::FontWeight weight)
void SetFontFamily(std::string family)
void SetTextDecoration(const ImpellerTextDecoration &decoration)
void SetTextDirection(txt::TextDirection direction)
void SetHeight(double height)
void SetBackground(ScopedObject< Paint > paint)
void SetForeground(ScopedObject< Paint > paint)
txt::TextStyle CreateTextStyle() const
void SetLocale(std::string locale)
void SetFontSize(double size)
void SetFontStyle(txt::FontStyle style)
void SetEllipsis(const std::string &string)
const txt::ParagraphStyle & GetParagraphStyle() const
void SetMaxLines(size_t max_lines)
void SetTextAlignment(txt::TextAlign alignment)
constexpr txt::TextDecorationStyle ToTxtType(ImpellerTextDecorationStyle style)
constexpr std::optional< SkRect > ToSkiaType(const ImpellerRect *rect)