Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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"
22#include "txt/platform.h"
23
24namespace txt {
25
27
28bool 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 (half_leading != other.half_leading)
52 return false;
53 if (locale != other.locale)
54 return false;
55 if (foreground != other.foreground)
56 return false;
57 if (font_families.size() != other.font_families.size())
58 return false;
59 if (text_shadows.size() != other.text_shadows.size())
60 return false;
61 for (size_t font_index = 0; font_index < font_families.size(); ++font_index) {
62 if (font_families[font_index] != other.font_families[font_index])
63 return false;
64 }
65 for (size_t shadow_index = 0; shadow_index < text_shadows.size();
66 ++shadow_index) {
67 if (text_shadows[shadow_index] != other.text_shadows[shadow_index])
68 return false;
69 }
70
71 return true;
72}
73
74} // namespace txt
std::vector< std::string > font_families
Definition text_style.h:52
std::optional< flutter::DlPaint > foreground
Definition text_style.h:60
TextDecorationStyle decoration_style
Definition text_style.h:43
FontStyle font_style
Definition text_style.h:47
SkColor decoration_color
Definition text_style.h:42
double word_spacing
Definition text_style.h:55
bool has_height_override
Definition text_style.h:57
bool equals(const TextStyle &other) const
Definition text_style.cc:28
std::vector< TextShadow > text_shadows
Definition text_style.h:63
std::string locale
Definition text_style.h:58
SkColor color
Definition text_style.h:38
double decoration_thickness_multiplier
Definition text_style.h:45
FontWeight font_weight
Definition text_style.h:46
double letter_spacing
Definition text_style.h:54
std::vector< std::string > GetDefaultFontFamilies()
Definition platform.cc:13