41 const char*
text =
"Hello World";
42 sktxt::ParagraphStyle paragraph_style;
43 sktxt::TextStyle text_style;
44 text_style.setFontFamilies({SkString(
"Roboto")});
45 text_style.setColor(SK_ColorBLACK);
46 auto builder = sktxt::ParagraphBuilder::make(
47 paragraph_style, font_collection_, SkUnicodes::ICU::Make());
48 builder->pushStyle(text_style);
49 builder->addText(
text);
51 auto paragraph = builder->Build();
52 while (state.KeepRunning()) {
53 paragraph->markDirty();
54 paragraph->layout(300);
60 "This is a very long sentence to test if the text will properly wrap "
61 "around and go to the next line. Sometimes, short sentence. Longer "
62 "sentences are okay too because they are necessary. Very short. "
63 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod "
64 "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim "
65 "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea "
66 "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate "
67 "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint "
68 "occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
69 "mollit anim id est laborum. "
70 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod "
71 "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim "
72 "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea "
73 "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate "
74 "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint "
75 "occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
76 "mollit anim id est laborum.";
77 sktxt::ParagraphStyle paragraph_style;
78 sktxt::TextStyle text_style;
79 text_style.setFontFamilies({SkString(
"Roboto")});
80 text_style.setColor(SK_ColorBLACK);
81 auto builder = sktxt::ParagraphBuilder::make(
82 paragraph_style, font_collection_, SkUnicodes::ICU::Make());
83 builder->pushStyle(text_style);
84 builder->addText(
text);
86 auto paragraph = builder->Build();
87 while (state.KeepRunning()) {
88 paragraph->markDirty();
89 paragraph->layout(300);
95 "This is a very long sentence to test if the text will properly wrap "
96 "around and go to the next line. Sometimes, short sentence. Longer "
97 "sentences are okay too because they are necessary. Very short. "
98 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod "
99 "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim "
100 "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea "
101 "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate "
102 "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint "
103 "occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
104 "mollit anim id est laborum. "
105 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod "
106 "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim "
107 "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea "
108 "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate "
109 "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint "
110 "occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
111 "mollit anim id est laborum.";
112 sktxt::ParagraphStyle paragraph_style;
113 paragraph_style.setTextAlign(sktxt::TextAlign::kJustify);
114 sktxt::TextStyle text_style;
115 text_style.setFontFamilies({SkString(
"Roboto")});
116 text_style.setColor(SK_ColorBLACK);
117 auto builder = sktxt::ParagraphBuilder::make(
118 paragraph_style, font_collection_, SkUnicodes::ICU::Make());
119 builder->pushStyle(text_style);
120 builder->addText(
text);
122 auto paragraph = builder->Build();
123 while (state.KeepRunning()) {
124 paragraph->markDirty();
125 paragraph->layout(300);
130 const char*
text =
"-";
131 sktxt::ParagraphStyle paragraph_style;
132 sktxt::TextStyle text_style;
133 text_style.setFontFamilies({SkString(
"Roboto")});
134 text_style.setColor(SK_ColorBLACK);
135 auto builder = sktxt::ParagraphBuilder::make(
136 paragraph_style, font_collection_, SkUnicodes::ICU::Make());
137 for (
int i = 0;
i < 1000; ++
i) {
138 builder->pushStyle(text_style);
139 builder->addText(
text);
141 auto paragraph = builder->Build();
142 while (state.KeepRunning()) {
143 paragraph->markDirty();
144 paragraph->layout(300);
149 std::vector<uint16_t>
text;
150 text.reserve(state.range(0));
151 for (uint16_t
i = 0;
i < state.range(0); ++
i) {
152 text.push_back(
i % 5 == 0 ?
' ' :
i);
154 std::u16string u16_text(
text.data(),
text.data() +
text.size());
155 sktxt::ParagraphStyle paragraph_style;
156 sktxt::TextStyle text_style;
157 text_style.setFontFamilies({SkString(
"Roboto")});
158 text_style.setColor(SK_ColorBLACK);
159 auto builder = sktxt::ParagraphBuilder::make(
160 paragraph_style, font_collection_, SkUnicodes::ICU::Make());
161 builder->pushStyle(text_style);
162 builder->addText(u16_text);
164 auto paragraph = builder->Build();
165 while (state.KeepRunning()) {
166 paragraph->markDirty();
167 paragraph->layout(300);
169 state.SetComplexityN(state.range(0));
177 const char*
text =
"vry shrt ";
178 sktxt::ParagraphStyle paragraph_style;
179 sktxt::TextStyle text_style;
180 text_style.setFontFamilies({SkString(
"Roboto")});
181 text_style.setColor(SK_ColorBLACK);
182 auto builder = sktxt::ParagraphBuilder::make(
183 paragraph_style, sk_make_sp<sktxt::TestFontCollection>(
txt::GetFontDir()),
184 SkUnicodes::ICU::Make());
185 for (
int i = 0;
i < 1000; ++
i) {
186 builder->pushStyle(text_style);
187 builder->addText(
text);
189 auto paragraph = builder->Build();
190 while (state.KeepRunning()) {
191 paragraph->markDirty();
192 paragraph->layout(300);
194 state.SetComplexityN(state.range(0));
202 const char*
text =
"This is a simple sentence to test drawing.";
203 sktxt::ParagraphStyle paragraph_style;
204 sktxt::TextStyle text_style;
205 text_style.setFontFamilies({SkString(
"Roboto")});
206 text_style.setColor(SK_ColorBLACK);
207 auto builder = sktxt::ParagraphBuilder::make(
208 paragraph_style, font_collection_, SkUnicodes::ICU::Make());
209 builder->pushStyle(text_style);
210 builder->addText(
text);
212 auto paragraph = builder->Build();
213 paragraph->layout(300);
215 while (state.KeepRunning()) {
216 paragraph->paint(canvas_.get(), offset % 700, 10);
223 "Hello world! This is a simple sentence to test drawing. Hello world! "
224 "This is a simple sentence to test drawing. Hello world! This is a "
225 "simple sentence to test drawing.Hello world! This is a simple sentence "
226 "to test drawing. Hello world! "
227 "This is a simple sentence to test drawing. Hello world! This is a "
228 "simple sentence to test drawing.Hello world! This is a simple sentence "
229 "to test drawing. Hello world! "
230 "This is a simple sentence to test drawing. Hello world! This is a "
231 "simple sentence to test drawing.Hello world! This is a simple sentence "
232 "to test drawing. Hello world! "
233 "This is a simple sentence to test drawing. Hello world! This is a "
234 "simple sentence to test drawing.Hello world! This is a simple sentence "
235 "to test drawing. Hello world! "
236 "This is a simple sentence to test drawing. Hello world! This is a "
237 "simple sentence to test drawing.Hello world! This is a simple sentence "
238 "to test drawing. Hello world! "
239 "This is a simple sentence to test drawing. Hello world! This is a "
240 "simple sentence to test drawing.";
241 sktxt::ParagraphStyle paragraph_style;
242 sktxt::TextStyle text_style;
243 text_style.setFontFamilies({SkString(
"Roboto")});
244 text_style.setColor(SK_ColorBLACK);
245 auto builder = sktxt::ParagraphBuilder::make(
246 paragraph_style, font_collection_, SkUnicodes::ICU::Make());
247 builder->pushStyle(text_style);
248 builder->addText(
text);
250 auto paragraph = builder->Build();
251 paragraph->layout(300);
253 while (state.KeepRunning()) {
254 paragraph->paint(canvas_.get(), offset % 700, 10);
261 "Hello world! This is a simple sentence to test drawing. Hello world! "
262 "This is a simple sentence to test drawing.";
263 sktxt::ParagraphStyle paragraph_style;
264 sktxt::TextStyle text_style;
265 text_style.setFontFamilies({SkString(
"Roboto")});
266 text_style.setColor(SK_ColorBLACK);
268 text_style.setDecoration(
static_cast<sktxt::TextDecoration
>(
269 sktxt::TextDecoration::kLineThrough | sktxt::TextDecoration::kOverline |
270 sktxt::TextDecoration::kUnderline));
271 auto builder = sktxt::ParagraphBuilder::make(
272 paragraph_style, font_collection_, SkUnicodes::ICU::Make());
273 text_style.setDecorationStyle(sktxt::TextDecorationStyle::kSolid);
274 builder->pushStyle(text_style);
275 builder->addText(
text);
277 text_style.setDecorationStyle(sktxt::TextDecorationStyle::kDotted);
278 builder->pushStyle(text_style);
279 builder->addText(
text);
281 text_style.setDecorationStyle(sktxt::TextDecorationStyle::kWavy);
282 builder->pushStyle(text_style);
283 builder->addText(
text);
285 auto paragraph = builder->Build();
286 paragraph->layout(300);
288 while (state.KeepRunning()) {
289 paragraph->paint(canvas_.get(), offset % 700, 10);
295 const char*
text =
"Hello World";
296 sktxt::ParagraphStyle paragraph_style;
297 sktxt::TextStyle text_style;
298 text_style.setFontFamilies({SkString(
"Roboto")});
299 text_style.setColor(SK_ColorBLACK);
300 while (state.KeepRunning()) {
301 auto builder = sktxt::ParagraphBuilder::make(
302 paragraph_style, font_collection_, SkUnicodes::ICU::Make());
303 builder->pushStyle(text_style);
304 builder->addText(
text);
306 auto paragraph = builder->Build();