Flutter Engine
text_style.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Google, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "text_style.h"
18 
19 #include "font_style.h"
20 #include "font_weight.h"
21 #include "third_party/skia/include/core/SkColor.h"
22 #include "txt/platform.h"
23 
24 namespace txt {
25 
27 
28 bool TextStyle::equals(const TextStyle& other) const {
29  if (color != other.color)
30  return false;
31  if (decoration != other.decoration)
32  return false;
34  return false;
36  return false;
38  return false;
39  if (font_weight != other.font_weight)
40  return false;
41  if (font_style != other.font_style)
42  return false;
43  if (letter_spacing != other.letter_spacing)
44  return false;
45  if (word_spacing != other.word_spacing)
46  return false;
47  if (height != other.height)
48  return false;
50  return false;
51  if (locale != other.locale)
52  return false;
53  if (foreground != other.foreground)
54  return false;
55  if (text_shadows.size() != other.text_shadows.size())
56  return false;
57  for (size_t font_index = 0; font_index < font_families.size(); ++font_index) {
58  if (font_families[font_index] != other.font_families[font_index])
59  return false;
60  }
61  for (size_t shadow_index = 0; shadow_index < text_shadows.size();
62  ++shadow_index) {
63  if (text_shadows[shadow_index] != other.text_shadows[shadow_index])
64  return false;
65  }
66 
67  return true;
68 }
69 
70 } // namespace txt
std::vector< TextShadow > text_shadows
Definition: text_style.h:62
bool has_height_override
Definition: text_style.h:54
double height
Definition: text_style.h:53
double decoration_thickness_multiplier
Definition: text_style.h:43
FontStyle font_style
Definition: text_style.h:45
double letter_spacing
Definition: text_style.h:51
std::string locale
Definition: text_style.h:55
bool equals(const TextStyle &other) const
Definition: text_style.cc:28
double word_spacing
Definition: text_style.h:52
SkColor decoration_color
Definition: text_style.h:40
std::vector< std::string > GetDefaultFontFamilies()
Definition: platform.cc:9
TextDecorationStyle decoration_style
Definition: text_style.h:41
std::vector< std::string > font_families
Definition: text_style.h:49
SkColor color
Definition: text_style.h:36
SkPaint foreground
Definition: text_style.h:59
FontWeight font_weight
Definition: text_style.h:44