Flutter Engine
txt::TextStyle Class Reference

#include <text_style.h>

Public Member Functions

 TextStyle ()
 
bool equals (const TextStyle &other) const
 

Public Attributes

SkColor color = SK_ColorWHITE
 
int decoration = TextDecoration::kNone
 
SkColor decoration_color = SK_ColorTRANSPARENT
 
TextDecorationStyle decoration_style = TextDecorationStyle::kSolid
 
double decoration_thickness_multiplier = 1.0
 
FontWeight font_weight = FontWeight::w400
 
FontStyle font_style = FontStyle::normal
 
TextBaseline text_baseline = TextBaseline::kAlphabetic
 
std::vector< std::string > font_families
 
double font_size = 14.0
 
double letter_spacing = 0.0
 
double word_spacing = 0.0
 
double height = 1.0
 
bool has_height_override = false
 
std::string locale
 
bool has_background = false
 
SkPaint background
 
bool has_foreground = false
 
SkPaint foreground
 
std::vector< TextShadowtext_shadows
 
FontFeatures font_features
 

Detailed Description

Definition at line 34 of file text_style.h.

Constructor & Destructor Documentation

◆ TextStyle()

txt::TextStyle::TextStyle ( )

Definition at line 26 of file text_style.cc.

std::vector< std::string > GetDefaultFontFamilies()
Definition: platform.cc:9
std::vector< std::string > font_families
Definition: text_style.h:49

Member Function Documentation

◆ equals()

bool txt::TextStyle::equals ( const TextStyle other) const

Definition at line 28 of file text_style.cc.

References color, decoration, decoration_color, decoration_style, decoration_thickness_multiplier, font_families, font_style, font_weight, foreground, has_height_override, height, letter_spacing, locale, text_shadows, and word_spacing.

28  {
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 (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 }
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
double word_spacing
Definition: text_style.h:52
SkColor decoration_color
Definition: text_style.h:40
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

Member Data Documentation

◆ background

SkPaint txt::TextStyle::background

Definition at line 57 of file text_style.h.

Referenced by txt::ParagraphTxt::Paint(), and flutter::ParagraphBuilder::pushStyle().

◆ color

◆ decoration

int txt::TextStyle::decoration = TextDecoration::kNone

◆ decoration_color

SkColor txt::TextStyle::decoration_color = SK_ColorTRANSPARENT

◆ decoration_style

TextDecorationStyle txt::TextStyle::decoration_style = TextDecorationStyle::kSolid

◆ decoration_thickness_multiplier

double txt::TextStyle::decoration_thickness_multiplier = 1.0

◆ font_families

◆ font_features

FontFeatures txt::TextStyle::font_features

Definition at line 63 of file text_style.h.

Referenced by flutter::ParagraphBuilder::pushStyle(), and txt::TEST_F().

◆ font_size

◆ font_style

◆ font_weight

◆ foreground

SkPaint txt::TextStyle::foreground

Definition at line 59 of file text_style.h.

Referenced by equals(), and flutter::ParagraphBuilder::pushStyle().

◆ has_background

bool txt::TextStyle::has_background = false

Definition at line 56 of file text_style.h.

Referenced by txt::ParagraphTxt::Paint(), and flutter::ParagraphBuilder::pushStyle().

◆ has_foreground

bool txt::TextStyle::has_foreground = false

Definition at line 58 of file text_style.h.

Referenced by flutter::ParagraphBuilder::pushStyle().

◆ has_height_override

bool txt::TextStyle::has_height_override = false

◆ height

double txt::TextStyle::height = 1.0

◆ letter_spacing

double txt::TextStyle::letter_spacing = 0.0

◆ locale

std::string txt::TextStyle::locale

◆ text_baseline

TextBaseline txt::TextStyle::text_baseline = TextBaseline::kAlphabetic

Definition at line 46 of file text_style.h.

◆ text_shadows

std::vector<TextShadow> txt::TextStyle::text_shadows

◆ word_spacing

double txt::TextStyle::word_spacing = 0.0

The documentation for this class was generated from the following files: