32 {
34 if (!jtxt) {
35 return false;
36 }
37
42 if (!font_name || !
text || !text_size || !line_height) {
43 return false;
44 }
45
49 return false;
50 }
51
59
64 };
65 v->
fHAlign = gAlignMap[std::min<size_t>(ParseDefault<size_t>((*jtxt)[
"j"], 0),
67
68
70 if (jsz->size() == 2) {
71 v->
fBox.
setWH(ParseDefault<SkScalar>((*jsz)[0], 0),
72 ParseDefault<SkScalar>((*jsz)[1], 0));
73 }
74 }
75
76
78 if (jps->size() == 2) {
79 v->
fBox.
offset(ParseDefault<SkScalar>((*jps)[0], 0),
80 ParseDefault<SkScalar>((*jps)[1], 0));
81 }
82 }
83
84 static constexpr Shaper::Direction gDirectionMap[] = {
85 Shaper::Direction::kLTR,
86 Shaper::Direction::kRTL,
87 };
90
91 static constexpr Shaper::ResizePolicy gResizeMap[] = {
93 Shaper::ResizePolicy::kScaleToFit,
94 Shaper::ResizePolicy::kDownscaleToFit,
95 };
96
98 ParseDefault<size_t>((*jtxt)["sk_rs"], 0)),
100
101
102 v->
fMinTextSize = ParseDefault<SkScalar>((*jtxt)[
"mf"], 0.0f);
104 v->
fMaxLines = ParseDefault<size_t> ((*jtxt)[
"xl"], 0);
105
106
108 ? Shaper::LinebreakPolicy::kExplicit
109 : Shaper::LinebreakPolicy::kParagraph;
110
111
112
114 if (text_mode >= 0) {
115
117 ? Shaper::LinebreakPolicy::kExplicit
118 : Shaper::LinebreakPolicy::kParagraph;
119 }
120
121
122 static constexpr Shaper::Capitalization gCapMap[] = {
124 Shaper::Capitalization::kUpperCase,
125 };
126 v->
fCapitalization = gCapMap[std::min<size_t>(ParseDefault<size_t>((*jtxt)[
"ca"], 0),
128
129
131 : Shaper::VAlign::kTop;
132
133 static constexpr Shaper::VAlign gVAlignMap[] = {
134 Shaper::VAlign::kHybridTop,
135 Shaper::VAlign::kHybridCenter,
136 Shaper::VAlign::kHybridBottom,
137 Shaper::VAlign::kVisualTop,
138 Shaper::VAlign::kVisualCenter,
139 Shaper::VAlign::kVisualBottom,
140 };
141 size_t vj;
145 } else {
147 }
149
150
151 switch (vj) {
152 case 0:
153 case 1:
154 case 2:
155 static_assert(
std::size(gVAlignMap) > 2);
157 break;
158 case 3:
159
160 v->
fVAlign = Shaper::VAlign::kHybridCenter;
161 v->
fResize = Shaper::ResizePolicy::kScaleToFit;
162 break;
163 case 4:
164
165 v->
fVAlign = Shaper::VAlign::kHybridCenter;
166 v->
fResize = Shaper::ResizePolicy::kDownscaleToFit;
167 break;
168 default:
170 "Ignoring unknown 'sk_vj' value: %zu", vj);
171 break;
172 }
173 }
174
177 if (!jcolor) {
178 return false;
179 }
180
181 ColorValue color_vec;
182 if (!
skottie::Parse(*jcolor,
static_cast<VectorValue*
>(&color_vec))) {
183 return false;
184 }
185
186 *c = color_vec;
187 return true;
188 };
189
192
196 ? TextPaintOrder::kFillStroke
197 : TextPaintOrder::kStrokeFill;
198
203 };
204 v->
fStrokeJoin = gJoins[std::min<size_t>(ParseDefault<size_t>((*jtxt)[
"lj"], 1) - 1,
206 }
207
208 return true;
209}
@ kMiter_Join
extends to miter limit
@ kBevel_Join
connects outside edges
void set(const SkString &src)
const char * begin() const
void log(Logger::Level, const skjson::Value *, const char fmt[],...) const SK_PRINTF_LIKE(4
const FontInfo * findFont(const SkString &name) const
static float max(float r, float g, float b)
static float min(float r, float g, float b)
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
font
Font Metadata and Metrics.
T ParseDefault(const skjson::Value &v, const T &defaultValue)
bool Parse(const skjson::Value &, T *)
void setWH(float width, float height)
void offset(float dx, float dy)
sk_sp< SkTypeface > fTypeface
SkPaint::Join fStrokeJoin
Shaper::Direction fDirection
Shaper::LinebreakPolicy fLineBreak
TextPaintOrder fPaintOrder
Shaper::Capitalization fCapitalization
Shaper::ResizePolicy fResize
SkTextUtils::Align fHAlign