Flutter Engine
The 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"
22#include "txt/platform.h"
23
24namespace txt {
25
26TextStyle::TextStyle() : font_families(GetDefaultFontFamilies()) {}
27
28bool TextStyle::equals(const TextStyle& other) const {
29 if (color != other.color)
30 return false;
31 if (decoration != other.decoration)
32 return false;
33 if (decoration_color != other.decoration_color)
34 return false;
35 if (decoration_style != other.decoration_style)
36 return false;
37 if (decoration_thickness_multiplier != other.decoration_thickness_multiplier)
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;
49 if (has_height_override != other.has_height_override)
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
bool equals(SkDrawable *a, SkDrawable *b)
DlColor color
std::vector< std::string > GetDefaultFontFamilies()
Definition: platform.cc:13
int32_t height