Flutter Engine
The Flutter Engine
Functions | Variables
text_style.cpp File Reference
#include "../export.h"
#include "../wrappers.h"
#include "third_party/skia/modules/skparagraph/include/Paragraph.h"

Go to the source code of this file.

Functions

SKWASM_EXPORT TextStyletextStyle_create ()
 
SKWASM_EXPORT TextStyletextStyle_copy (TextStyle *style)
 
SKWASM_EXPORT void textStyle_dispose (TextStyle *style)
 
SKWASM_EXPORT void textStyle_setColor (TextStyle *style, SkColor color)
 
SKWASM_EXPORT void textStyle_setDecoration (TextStyle *style, TextDecoration decoration)
 
SKWASM_EXPORT void textStyle_setDecorationColor (TextStyle *style, SkColor color)
 
SKWASM_EXPORT void textStyle_setDecorationStyle (TextStyle *style, TextDecorationStyle decorationStyle)
 
SKWASM_EXPORT void textStyle_setDecorationThickness (TextStyle *style, SkScalar thickness)
 
SKWASM_EXPORT void textStyle_setFontStyle (TextStyle *style, int weight, SkFontStyle::Slant slant)
 
SKWASM_EXPORT void textStyle_setTextBaseline (TextStyle *style, TextBaseline baseline)
 
SKWASM_EXPORT void textStyle_clearFontFamilies (TextStyle *style)
 
SKWASM_EXPORT void textStyle_addFontFamilies (TextStyle *style, SkString **fontFamilies, int count)
 
SKWASM_EXPORT void textStyle_setFontSize (TextStyle *style, SkScalar size)
 
SKWASM_EXPORT void textStyle_setLetterSpacing (TextStyle *style, SkScalar letterSpacing)
 
SKWASM_EXPORT void textStyle_setWordSpacing (TextStyle *style, SkScalar wordSpacing)
 
SKWASM_EXPORT void textStyle_setHeight (TextStyle *style, SkScalar height)
 
SKWASM_EXPORT void textStyle_setHalfLeading (TextStyle *style, bool halfLeading)
 
SKWASM_EXPORT void textStyle_setLocale (TextStyle *style, SkString *locale)
 
SKWASM_EXPORT void textStyle_setBackground (TextStyle *style, SkPaint *paint)
 
SKWASM_EXPORT void textStyle_setForeground (TextStyle *style, SkPaint *paint)
 
SKWASM_EXPORT void textStyle_addShadow (TextStyle *style, SkColor color, SkScalar offsetX, SkScalar offsetY, SkScalar blurSigma)
 
SKWASM_EXPORT void textStyle_addFontFeature (TextStyle *style, SkString *featureName, int value)
 
SKWASM_EXPORT void textStyle_setFontVariations (TextStyle *style, SkFourByteTag *axes, float *values, int count)
 

Variables

const double kTextHeightNone = 0.0
 

Function Documentation

◆ textStyle_addFontFamilies()

SKWASM_EXPORT void textStyle_addFontFamilies ( TextStyle style,
SkString **  fontFamilies,
int  count 
)

Definition at line 70 of file text_style.cpp.

72 {
73 const std::vector<SkString>& currentFamilies = style->getFontFamilies();
74 std::vector<SkString> newFamilies;
75 newFamilies.reserve(currentFamilies.size() + count);
76 for (int i = 0; i < count; i++) {
77 newFamilies.push_back(*fontFamilies[i]);
78 }
79 for (const auto& family : currentFamilies) {
80 newFamilies.push_back(family);
81 }
82 style->setFontFamilies(std::move(newFamilies));
83}
int count
Definition: FontMgrTest.cpp:50
void setFontFamilies(std::vector< SkString > families)
Definition: TextStyle.h:253
const std::vector< SkString > & getFontFamilies() const
Definition: TextStyle.h:252

◆ textStyle_addFontFeature()

SKWASM_EXPORT void textStyle_addFontFeature ( TextStyle style,
SkString featureName,
int  value 
)

Definition at line 129 of file text_style.cpp.

131 {
132 style->addFontFeature(*featureName, value);
133}
void addFontFeature(const SkString &fontFeature, int value)
Definition: TextStyle.h:239
uint8_t value

◆ textStyle_addShadow()

SKWASM_EXPORT void textStyle_addShadow ( TextStyle style,
SkColor  color,
SkScalar  offsetX,
SkScalar  offsetY,
SkScalar  blurSigma 
)

Definition at line 121 of file text_style.cpp.

125 {
126 style->addShadow(TextShadow(color, {offsetX, offsetY}, blurSigma));
127}
void addShadow(TextShadow shadow)
Definition: TextStyle.h:233
DlColor color
SkScalar offsetX
SkScalar offsetY

◆ textStyle_clearFontFamilies()

SKWASM_EXPORT void textStyle_clearFontFamilies ( TextStyle style)

Definition at line 66 of file text_style.cpp.

66 {
67 style->setFontFamilies({});
68}

◆ textStyle_copy()

SKWASM_EXPORT TextStyle * textStyle_copy ( TextStyle style)

Definition at line 22 of file text_style.cpp.

22 {
23 return new TextStyle(*style);
24}

◆ textStyle_create()

SKWASM_EXPORT TextStyle * textStyle_create ( )

Definition at line 14 of file text_style.cpp.

14 {
15 auto style = new TextStyle();
16
17 // Default color in flutter is black.
18 style->setColor(SK_ColorBLACK);
19 return style;
20}
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103

◆ textStyle_dispose()

SKWASM_EXPORT void textStyle_dispose ( TextStyle style)

Definition at line 26 of file text_style.cpp.

26 {
27 delete style;
28}

◆ textStyle_setBackground()

SKWASM_EXPORT void textStyle_setBackground ( TextStyle style,
SkPaint paint 
)

Definition at line 113 of file text_style.cpp.

113 {
114 style->setBackgroundColor(*paint);
115}
void setBackgroundColor(SkPaint paint)
Definition: TextStyle.h:204
const Paint & paint
Definition: color_source.cc:38

◆ textStyle_setColor()

SKWASM_EXPORT void textStyle_setColor ( TextStyle style,
SkColor  color 
)

Definition at line 30 of file text_style.cpp.

30 {
31 style->setColor(color);
32}
void setColor(SkColor color)
Definition: TextStyle.h:166

◆ textStyle_setDecoration()

SKWASM_EXPORT void textStyle_setDecoration ( TextStyle style,
TextDecoration  decoration 
)

Definition at line 34 of file text_style.cpp.

35 {
36 style->setDecoration(decoration);
37}
void setDecoration(TextDecoration decoration)
Definition: TextStyle.h:220

◆ textStyle_setDecorationColor()

SKWASM_EXPORT void textStyle_setDecorationColor ( TextStyle style,
SkColor  color 
)

Definition at line 39 of file text_style.cpp.

40 {
42}
void setDecorationColor(SkColor color)
Definition: TextStyle.h:223

◆ textStyle_setDecorationStyle()

SKWASM_EXPORT void textStyle_setDecorationStyle ( TextStyle style,
TextDecorationStyle  decorationStyle 
)

Definition at line 44 of file text_style.cpp.

46 {
47 style->setDecorationStyle(decorationStyle);
48}
void setDecorationStyle(TextDecorationStyle style)
Definition: TextStyle.h:222

◆ textStyle_setDecorationThickness()

SKWASM_EXPORT void textStyle_setDecorationThickness ( TextStyle style,
SkScalar  thickness 
)

Definition at line 50 of file text_style.cpp.

51 {
52 style->setDecorationThicknessMultiplier(thickness);
53}
void setDecorationThicknessMultiplier(SkScalar m)
Definition: TextStyle.h:224

◆ textStyle_setFontSize()

SKWASM_EXPORT void textStyle_setFontSize ( TextStyle style,
SkScalar  size 
)

Definition at line 85 of file text_style.cpp.

85 {
86 style->setFontSize(size);
87}
void setFontSize(SkScalar size)
Definition: TextStyle.h:250
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ textStyle_setFontStyle()

SKWASM_EXPORT void textStyle_setFontStyle ( TextStyle style,
int  weight,
SkFontStyle::Slant  slant 
)

Definition at line 55 of file text_style.cpp.

57 {
59}
void setFontStyle(SkFontStyle fontStyle)
Definition: TextStyle.h:228

◆ textStyle_setFontVariations()

SKWASM_EXPORT void textStyle_setFontVariations ( TextStyle style,
SkFourByteTag axes,
float *  values,
int  count 
)

Definition at line 135 of file text_style.cpp.

138 {
139 std::vector<SkFontArguments::VariationPosition::Coordinate> coordinates;
140 for (int i = 0; i < count; i++) {
141 coordinates.push_back({axes[i], values[i]});
142 }
144 coordinates.data(), static_cast<int>(coordinates.size())};
145 style->setFontArguments(
147}
void setFontArguments(const std::optional< SkFontArguments > &args)
SkFontArguments & setVariationDesignPosition(VariationPosition position)

◆ textStyle_setForeground()

SKWASM_EXPORT void textStyle_setForeground ( TextStyle style,
SkPaint paint 
)

Definition at line 117 of file text_style.cpp.

117 {
118 style->setForegroundColor(*paint);
119}
void setForegroundColor(SkPaint paint)
Definition: TextStyle.h:181

◆ textStyle_setHalfLeading()

SKWASM_EXPORT void textStyle_setHalfLeading ( TextStyle style,
bool  halfLeading 
)

Definition at line 104 of file text_style.cpp.

105 {
106 style->setHalfLeading(halfLeading);
107}
void setHalfLeading(bool halfLeading)
Definition: TextStyle.h:266

◆ textStyle_setHeight()

SKWASM_EXPORT void textStyle_setHeight ( TextStyle style,
SkScalar  height 
)

Definition at line 99 of file text_style.cpp.

99 {
100 style->setHeight(height);
102}
void setHeight(SkScalar height)
Definition: TextStyle.h:260
void setHeightOverride(bool heightOverride)
Definition: TextStyle.h:263
int32_t height
const double kTextHeightNone
Definition: text_style.cpp:9

◆ textStyle_setLetterSpacing()

SKWASM_EXPORT void textStyle_setLetterSpacing ( TextStyle style,
SkScalar  letterSpacing 
)

Definition at line 89 of file text_style.cpp.

90 {
91 style->setLetterSpacing(letterSpacing);
92}
void setLetterSpacing(SkScalar letterSpacing)
Definition: TextStyle.h:269

◆ textStyle_setLocale()

SKWASM_EXPORT void textStyle_setLocale ( TextStyle style,
SkString locale 
)

Definition at line 109 of file text_style.cpp.

109 {
110 style->setLocale(*locale);
111}
void setLocale(const SkString &locale)
Definition: TextStyle.h:280

◆ textStyle_setTextBaseline()

SKWASM_EXPORT void textStyle_setTextBaseline ( TextStyle style,
TextBaseline  baseline 
)

Definition at line 61 of file text_style.cpp.

62 {
63 style->setTextBaseline(baseline);
64}
void setTextBaseline(TextBaseline baseline)
Definition: TextStyle.h:283

◆ textStyle_setWordSpacing()

SKWASM_EXPORT void textStyle_setWordSpacing ( TextStyle style,
SkScalar  wordSpacing 
)

Definition at line 94 of file text_style.cpp.

95 {
96 style->setWordSpacing(wordSpacing);
97}
void setWordSpacing(SkScalar wordSpacing)
Definition: TextStyle.h:272

Variable Documentation

◆ kTextHeightNone

const double kTextHeightNone = 0.0

Definition at line 9 of file text_style.cpp.