Flutter Impeller
paragraph_style.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
6 
7 namespace impeller::interop {
8 
10 
12 
13 void ParagraphStyle::SetFontWeight(txt::FontWeight weight) {
14  style_.font_weight = weight;
15 }
16 
17 void ParagraphStyle::SetFontStyle(txt::FontStyle style) {
18  style_.font_style = style;
19 }
20 
21 void ParagraphStyle::SetFontFamily(std::string family) {
22  style_.font_family = std::move(family);
23 }
24 
25 void ParagraphStyle::SetFontSize(double size) {
26  style_.font_size = size;
27 }
28 
29 void ParagraphStyle::SetHeight(double height) {
30  style_.height = height;
31 }
32 
33 void ParagraphStyle::SetTextAlignment(txt::TextAlign alignment) {
34  style_.text_align = alignment;
35 }
36 
37 void ParagraphStyle::SetTextDirection(txt::TextDirection direction) {
38  style_.text_direction = direction;
39 }
40 
41 void ParagraphStyle::SetMaxLines(size_t max_lines) {
42  style_.max_lines = max_lines;
43 }
44 
45 void ParagraphStyle::SetLocale(std::string locale) {
46  style_.locale = std::move(locale);
47 }
48 
50  foreground_ = std::move(paint);
51 }
52 
54  backgrond_ = std::move(paint);
55 }
56 
57 txt::TextStyle ParagraphStyle::CreateTextStyle() const {
58  auto style = style_.GetTextStyle();
59  if (foreground_) {
60  style.foreground = foreground_->GetPaint();
61  }
62  if (backgrond_) {
63  style.background = backgrond_->GetPaint();
64  }
65  return style;
66 }
67 
68 } // namespace impeller::interop
impeller::interop::ScopedObject
Definition: object.h:67
impeller::interop::ParagraphStyle::~ParagraphStyle
~ParagraphStyle() override
impeller::interop::ParagraphStyle::SetBackground
void SetBackground(ScopedObject< Paint > paint)
Definition: paragraph_style.cc:53
impeller::interop::ParagraphStyle::SetFontFamily
void SetFontFamily(std::string family)
Definition: paragraph_style.cc:21
impeller::interop
Definition: color_filter.cc:7
impeller::interop::ParagraphStyle::SetMaxLines
void SetMaxLines(size_t max_lines)
Definition: paragraph_style.cc:41
impeller::interop::ParagraphStyle::CreateTextStyle
txt::TextStyle CreateTextStyle() const
Definition: paragraph_style.cc:57
impeller::interop::ParagraphStyle::SetFontStyle
void SetFontStyle(txt::FontStyle style)
Definition: paragraph_style.cc:17
impeller::interop::ParagraphStyle::ParagraphStyle
ParagraphStyle()
impeller::interop::ParagraphStyle::SetLocale
void SetLocale(std::string locale)
Definition: paragraph_style.cc:45
impeller::interop::ParagraphStyle::SetTextAlignment
void SetTextAlignment(txt::TextAlign alignment)
Definition: paragraph_style.cc:33
impeller::interop::ParagraphStyle::SetFontSize
void SetFontSize(double size)
Definition: paragraph_style.cc:25
impeller::interop::ParagraphStyle::SetFontWeight
void SetFontWeight(txt::FontWeight weight)
Definition: paragraph_style.cc:13
impeller::interop::ParagraphStyle::SetHeight
void SetHeight(double height)
Definition: paragraph_style.cc:29
impeller::interop::ParagraphStyle::SetForeground
void SetForeground(ScopedObject< Paint > paint)
Definition: paragraph_style.cc:49
paragraph_style.h
impeller::interop::ParagraphStyle::SetTextDirection
void SetTextDirection(txt::TextDirection direction)
Definition: paragraph_style.cc:37