Flutter Engine
 
Loading...
Searching...
No Matches
text_style.h
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
5#ifndef FLUTTER_TXT_SRC_TXT_TEXT_STYLE_H_
6#define FLUTTER_TXT_SRC_TXT_TEXT_STYLE_H_
7
8#include <optional>
9#include <string>
10#include <vector>
11
13#include "font_features.h"
14#include "font_style.h"
15#include "font_weight.h"
16#include "text_baseline.h"
17#include "text_decoration.h"
18#include "text_shadow.h"
19#include "third_party/skia/include/core/SkColor.h"
20#include "third_party/skia/include/core/SkPaint.h"
21
22namespace txt {
23
24class TextStyle {
25 public:
26 SkColor color = SK_ColorWHITE;
28 // Does not make sense to draw a transparent object, so we use it as a default
29 // value to indicate no decoration color was set.
30 SkColor decoration_color = SK_ColorTRANSPARENT;
32 // Thickness is applied as a multiplier to the default thickness of the font.
37 bool half_leading = false;
38 // An ordered list of fonts in order of priority. The first font is more
39 // highly preferred than the last font.
40 std::vector<std::string> font_families;
41 double font_size = 14.0;
42 double letter_spacing = 0.0;
43 double word_spacing = 0.0;
44 double height = 1.0;
45 bool has_height_override = false;
46 std::string locale;
47 std::optional<flutter::DlPaint> background;
48 std::optional<flutter::DlPaint> foreground;
49 // An ordered list of shadows where the first shadow will be drawn first (at
50 // the bottom).
51 std::vector<TextShadow> text_shadows;
54
55 TextStyle();
56
57 bool equals(const TextStyle& other) const;
58};
59
60} // namespace txt
61
62#endif // FLUTTER_TXT_SRC_TXT_TEXT_STYLE_H_
std::vector< std::string > font_families
Definition text_style.h:40
std::optional< flutter::DlPaint > foreground
Definition text_style.h:48
TextDecorationStyle decoration_style
Definition text_style.h:31
FontStyle font_style
Definition text_style.h:35
SkColor decoration_color
Definition text_style.h:30
double word_spacing
Definition text_style.h:43
FontFeatures font_features
Definition text_style.h:52
FontVariations font_variations
Definition text_style.h:53
bool has_height_override
Definition text_style.h:45
bool equals(const TextStyle &other) const
Definition text_style.cc:16
std::vector< TextShadow > text_shadows
Definition text_style.h:51
double font_size
Definition text_style.h:41
std::string locale
Definition text_style.h:46
SkColor color
Definition text_style.h:26
double decoration_thickness_multiplier
Definition text_style.h:33
TextBaseline text_baseline
Definition text_style.h:36
std::optional< flutter::DlPaint > background
Definition text_style.h:47
double letter_spacing
Definition text_style.h:42
FontStyle
Definition font_style.h:10
TextDecorationStyle
@ kAlphabetic
@ normal
Definition font_weight.h:12