31static DEFINE_bool(verboseParagraph,
false,
"paragraph samples very verbose.");
38 return sk_ref_sp<SkUnicode>(factory->getUnicode());
57 fFC = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
false,
true);
63 return FLAGS_verboseParagraph;
88class ParagraphSlide1 :
public ParagraphSlide_Base {
90 ParagraphSlide1() {
fName =
"Paragraph1"; }
99 std::tuple<std::string, bool, bool, int, SkColor, SkColor, bool, TextDecorationStyle>>
118 paint.setAntiAlias(
true);
129 auto fontCollection = sk_make_sp<FontCollection>();
131 for (
auto i = 1;
i < 5; ++
i) {
137 for (
auto para : gParagraph) {
141 : SkFontStyle::Weight::kNormal_Weight,
142 SkFontStyle::Width::kNormal_Width,
143 std::get<2>(
para) ? SkFontStyle::Slant::kItalic_Slant
144 : SkFontStyle::Slant::kUpright_Slant);
154 if (std::get<6>(
para)) {
158 auto decoration = (
i % 4);
159 if (decoration == 3) {
173 (std::get<2>(
para) ?
", italic" :
"") +
" " +
175 (std::get<4>(
para) != bg ?
", background" :
"") +
176 (std::get<5>(
para) != fg ?
", foreground" :
"") +
177 (std::get<6>(
para) ?
", shadow" :
"") +
178 (
test ?
", decorations " + deco :
"") +
";";
183 auto paragraph =
builder.Build();
184 paragraph->layout(
w - margin * 2);
185 paragraph->paint(canvas, margin, margin);
187 canvas->
translate(0, paragraph->getHeight());
192class ParagraphSlide2 :
public ParagraphSlide_Base {
194 ParagraphSlide2() {
fName =
"Paragraph2"; }
197 std::vector<const char*> cupertino = {
198 "google_logogoogle_gsuper_g_logo 1 "
199 "google_logogoogle_gsuper_g_logo 12 "
200 "google_logogoogle_gsuper_g_logo 123 "
201 "google_logogoogle_gsuper_g_logo 1234 "
202 "google_logogoogle_gsuper_g_logo 12345 "
203 "google_logogoogle_gsuper_g_logo 123456 "
204 "google_logogoogle_gsuper_g_logo 1234567 "
205 "google_logogoogle_gsuper_g_logo 12345678 "
206 "google_logogoogle_gsuper_g_logo 123456789 "
207 "google_logogoogle_gsuper_g_logo 1234567890 "
208 "google_logogoogle_gsuper_g_logo 123456789 "
209 "google_logogoogle_gsuper_g_logo 12345678 "
210 "google_logogoogle_gsuper_g_logo 1234567 "
211 "google_logogoogle_gsuper_g_logo 123456 "
212 "google_logogoogle_gsuper_g_logo 12345 "
213 "google_logogoogle_gsuper_g_logo 1234 "
214 "google_logogoogle_gsuper_g_logo 123 "
215 "google_logogoogle_gsuper_g_logo 12 "
216 "google_logogoogle_gsuper_g_logo 1 "
217 "google_logogoogle_gsuper_g_logo "
218 "google_logogoogle_gsuper_g_logo "
219 "google_logogoogle_gsuper_g_logo "
220 "google_logogoogle_gsuper_g_logo "
221 "google_logogoogle_gsuper_g_logo "
222 "google_logogoogle_gsuper_g_logo"};
223 std::vector<const char*>
text = {
224 "My neighbor came over to say,\n"
225 "Although not in a neighborly way,\n\n"
226 "That he'd knock me around,\n\n\n"
227 "If I didn't stop the sound,\n\n\n\n"
228 "Of the classical music I play."};
230 std::vector<const char*> long_word = {
231 "A_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_"
232 "very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_"
233 "very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_"
234 "very_very_very_very_very_very_very_long_text"};
236 std::vector<const char*> very_long = {
237 "A very very very very very very very very very very very very very very very very "
238 "very very very very very very very very very very very very very very very very "
239 "very very very very very very very very very very very very very very very very "
240 "very very very very very very very long text"};
242 std::vector<const char*> very_word = {
243 "A very_very_very_very_very_very_very_very_very_very "
244 "very_very_very_very_very_very_very_very_very_very very very very very very very "
245 "very very very very very very very very very very very very very very very very "
246 "very very very very very very very very very very very very very long text"};
293 auto fontCollection = sk_make_sp<FontCollection>();
297 const char* text1 =
"RaisedButton";
298 const char* text2 =
"(\n";
299 const char* text3 =
" child: ";
300 const char* text4 =
"const";
301 const char* text5 =
"Text";
302 const char* text6 =
"'BUTTON TITLE'";
303 const char* text7 =
"),\n";
306 builder.addText(text1, strlen(text1));
308 builder.addText(text2, strlen(text2));
309 builder.addText(text3, strlen(text3));
310 builder.pushStyle(style(constant));
311 builder.addText(text4, strlen(text4));
315 builder.addText(text5, strlen(text5));
318 builder.pushStyle(style(literal));
319 builder.addText(text6, strlen(text6));
321 builder.addText(text7, strlen(text7));
323 auto paragraph =
builder.Build();
324 paragraph->layout(
w - 20);
326 paragraph->paint(canvas, 20, 20);
331 paint.setAntiAlias(
true);
341 const char* ff =
"sans-serif",
SkScalar fs = 24,
342 size_t lineLimit = 30,
343 const std::u16string& ellipsis = u
"\u2026") {
352 paint.setAntiAlias(
true);
384 for (
auto& part :
text) {
386 builder.addText(part, strlen(part));
390 auto paragraph =
builder.Build();
391 paragraph->layout(
w - margin * 2);
392 paragraph->paint(canvas, margin, margin);
394 canvas->
translate(0, paragraph->getHeight() + margin);
407 paint.setAntiAlias(
true);
422 auto fontCollection = sk_make_sp<FontCollection>();
427 auto paragraph =
builder.Build();
428 paragraph->layout(
w - margin * 2);
429 paragraph->layout(
w - margin);
430 paragraph->paint(canvas, margin, margin);
432 canvas->
translate(0, paragraph->getHeight() + margin);
436class ParagraphSlide3 :
public ParagraphSlide_Base {
438 ParagraphSlide3() {
fName =
"Paragraph3"; }
442 {
"Flutter is an open-source project to help developers "
443 "build high-performance, high-fidelity, mobile apps for "
445 "from a single codebase. This design lab is a playground "
446 "and showcase of Flutter's many widgets, behaviors, "
447 "animations, layouts, and more."};
453 const std::string
line =
454 "World domination is such an ugly phrase - I prefer to call it world optimisation";
477 const std::u16string& ellipsis = u
"\u2026") {
486 paint.setAntiAlias(
true);
505 paraStyle.
setTextDirection(RTL ? TextDirection::kRtl : TextDirection::kLtr);
507 auto fontCollection = sk_make_sp<FontCollection>();
517 auto paragraph =
builder.Build();
518 paragraph->layout(
w - margin * 2);
519 paragraph->paint(canvas, margin, margin);
522 std::u16string
mirror(
const std::string&
text) {
529 for (
auto i =
text.size();
i > 0; --
i) {
530 auto ch =
text[
i - 1];
533 }
else if (ch ==
'.') {
544 std::u16string
normal(
const std::string&
text) {
547 for (
auto ch :
text) {
555class ParagraphSlide5 :
public ParagraphSlide_Base {
557 ParagraphSlide5() {
fName =
"Paragraph5"; }
564 const std::u16string text1 =
565 u
"A \u202ENAC\u202Cner, exceedingly \u202ENAC\u202Cny,\n"
566 "One morning remarked to his granny:\n"
567 "A \u202ENAC\u202Cner \u202ENAC\u202C \u202ENAC\u202C,\n"
568 "Anything that he \u202ENAC\u202C,\n"
569 "But a \u202ENAC\u202Cner \u202ENAC\u202C't \u202ENAC\u202C a \u202ENAC\u202C, "
570 "\u202ENAC\u202C he?";
574 bidi(canvas,
width,
height, u
"\u2067DETALOSI\u2069", u
"");
577 bidi(canvas,
width,
height, u
"\u202BDEDDEBME\u202C", u
"");
580 bidi(canvas,
width,
height, u
"\u202EEDIRREVO\u202C", u
"");
583 bidi(canvas,
width,
height, u
"\u200FTICILPMI\u200E", u
"");
589 u
"123 456 7890 \u202EZYXWV UTS RQP ONM LKJ IHG FED CBA\u202C.",
602 const std::u16string&
text,
603 const std::u16string& expected,
605 const char* ff =
"Roboto",
607 const std::u16string& ellipsis = u
"\u2026") {
649 const std::u16string text0 = u
"\u202Dabc";
650 const std::u16string text1 = u
"\u202EFED";
651 const std::u16string text2 = u
"\u202Dghi";
652 const std::u16string text3 = u
"\u202ELKJ";
653 const std::u16string text4 = u
"\u202Dmno";
673 auto paragraph =
builder.Build();
676 SkDebugf(
"Text: >%s<\n", impl->text().data());
679 paragraph->layout(
w - margin * 2);
680 paragraph->paint(canvas, margin, margin);
684class ParagraphSlide6 :
public ParagraphSlide_Base {
686 ParagraphSlide6() {
fName =
"Paragraph6"; }
689 auto ff =
"HangingS";
762 const char* logo1 =
"S";
763 const char* logo2 =
"kia";
764 const char* logo3 =
"Sk";
765 const char* logo4 =
"ia";
766 const char* logo5 =
"Ski";
767 const char* logo6 =
"a";
772 builder.addText(logo1, strlen(logo1));
775 builder.addText(logo2, strlen(logo2));
781 builder.addText(logo3, strlen(logo3));
784 builder.addText(logo4, strlen(logo4));
790 builder.addText(logo5, strlen(logo5));
793 builder.addText(logo6, strlen(logo6));
796 auto paragraph =
builder.Build();
797 paragraph->layout(
w);
798 paragraph->paint(canvas, 40, 40);
802 const char* logo11 =
"S";
803 const char* logo12 =
"S";
804 const char* logo13 =
"S";
805 const char* logo14 =
"S";
806 const char* logo15 =
"S";
807 const char* logo16 =
"S";
812 builder.addText(logo11, strlen(logo11));
815 builder.addText(logo12, strlen(logo12));
821 builder.addText(logo13, strlen(logo13));
824 builder.addText(logo14, strlen(logo14));
830 builder.addText(logo15, strlen(logo15));
833 builder.addText(logo16, strlen(logo16));
836 auto paragraph =
builder.Build();
837 paragraph->layout(
w);
838 paragraph->paint(canvas, 40,
h);
852class ParagraphSlide7 :
public ParagraphSlide_Base {
854 ParagraphSlide7() {
fName =
"Paragraph7"; }
863 "World domination is such an ugly phrase - I prefer to call it world optimisation.";
882 auto paragraph =
builder.Build();
883 paragraph->layout(
w - 20);
884 paragraph->paint(canvas, 10, 10);
890 auto h = this->
size().height() / 4;
891 auto w = this->
size().width() / 2;
919class ParagraphSlide8 :
public ParagraphSlide_Base {
921 ParagraphSlide8() {
fName =
"Paragraph8"; }
930 "World domination is such an ugly phrase - I prefer to call it world optimisation.";
949 auto paragraph =
builder.Build();
950 paragraph->layout(
w - 20);
951 paragraph->paint(canvas, 10, 10);
957 auto h = this->
size().height() / 4;
958 auto w = this->
size().width() / 2;
986class ParagraphSlide9 :
public ParagraphSlide_Base {
988 ParagraphSlide9() {
fName =
"Paragraph9"; }
996 if (wordSpacing > 0) --wordSpacing;
1002 if (letterSpacing > 0) --letterSpacing;
1015 auto fontCollection = sk_make_sp<FontCollection>();
1017 fontCollection->enableFontFallback();
1020 "( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)("
1021 " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)("
1022 " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)";
1023 auto multiplier = 5.67;
1041 auto paragraph =
builder.Build();
1042 paragraph->layout(200 * multiplier);
1044 std::vector<size_t> sizes = {0, 1, 2, 8, 19, 21, 22, 30, 150};
1052 for (
size_t i = 0;
i < sizes.size() - 1; ++
i) {
1053 size_t from = sizes[
i];
1054 size_t to = sizes[
i + 1];
1055 auto boxes = paragraph->getRectsForRange(from, to, rect_height_style, rect_width_style);
1056 if (boxes.empty()) {
1059 for (
auto& box : boxes) {
1067 paragraph->paint(canvas, 0, 0);
1073 auto h = this->
size().height();
1074 auto w = this->
size().width();
1084class ParagraphSlide10 :
public ParagraphSlide_Base {
1086 ParagraphSlide10() {
fName =
"Paragraph10"; }
1090 auto multiplier = 5.67;
1091 const char*
text =
"English English 字典 字典 😀😃😄 😀😃😄";
1093 auto fontCollection = sk_make_sp<FontCollection>();
1095 fontCollection->enableFontFallback();
1110 builder.pushStyle(text_style);
1114 auto paragraph =
builder.Build();
1115 paragraph->layout(this->
size().width());
1117 paragraph->paint(canvas, 0, 0);
1121class ParagraphSlide11 :
public ParagraphSlide_Base {
1123 ParagraphSlide11() {
fName =
"Paragraph11"; }
1128 auto text =
"\U0001f469\U0000200D\U0001f469\U0000200D\U0001f466\U0001f469\U0000200D\U0001f469\U0000200D\U0001f467\U0000200D\U0001f467\U0001f1fa\U0001f1f8";
1139 auto fontCollection = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
true,
true);
1142 auto paragraph =
builder.Build();
1143 paragraph->layout(1000);
1144 paragraph->paint(canvas, 0, 0);
1152 {{ 0, 8},{1, 33}, {2, 34}, { 3, 19}, {4, 20},
1153 { 5, 21}, { 6, 22 }, { 7, 23 }, {8, 24 }, { 9, 25},
1154 { 10, 26}, { 11, 27}, {12, 28}, { 13, 21}, {14, 22 },
1155 { 15, 23}, {16, 24}, {17, 21}, { 18, 22}, {19, 21},
1156 { 20, 24}, { 21, 23}, };
1159 {{ 0, 4},{1, 17}, {2, 18}, { 3, 11}, {4, 12},
1160 { 5, 13}, { 6, 14 }, { 7, 15 }, {8, 16 }, { 9, 17},
1161 { 10, 18}, { 11, 19}, {12, 20}, { 13, 17}, {14, 18 },
1162 { 15, 19}, {16, 20}, {17, 19}, { 18, 20},
1165 auto rects = paragraph->getRectsForRange(7, 9, RectHeightStyle::kTight,
1166 RectWidthStyle::kTight);
1170 paint.setAntiAlias(
true);
1171 paint.setStrokeWidth(1);
1172 if (!rects.empty()) {
1176 for (
auto& query : hit1) {
1177 auto hitRects = paragraph->getRectsForRange(query.fX, query.fY, RectHeightStyle::kTight,
1178 RectWidthStyle::kTight);
1179 if (hitRects.size() >= 1 && hitRects[0].rect.width() > 0) {
1182 SkDebugf(
"+[%u:%u): Bad\n", query.fX, query.fY);
1187 for (
auto& query : miss) {
1188 auto missRects = paragraph->getRectsForRange(query.fX, query.fY,
1189 RectHeightStyle::kTight,
1190 RectWidthStyle::kTight);
1191 if (missRects.empty()) {
1194 SkDebugf(
"-[%u:%u): Bad\n", query.fX, query.fY);
1201class ParagraphSlide12 :
public ParagraphSlide_Base {
1203 ParagraphSlide12() {
fName =
"Paragraph12"; }
1208 const char*
text =
"Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges";
1221 auto paragraph =
builder.Build();
1222 paragraph->layout(1095.000000);
1223 auto result = paragraph->getRectsForRange(65, 66, RectHeightStyle::kTight, RectWidthStyle::kTight);
1224 paragraph->paint(canvas, 0, 0);
1229 paint.setAntiAlias(
true);
1230 paint.setStrokeWidth(1);
1237class ParagraphSlide14 :
public ParagraphSlide_Base {
1239 ParagraphSlide14() {
fName =
"Paragraph14"; }
1255 builder.pushStyle(text_style);
1256 builder.addText(
"Hello, wor!\nabcd.");
1257 auto paragraph =
builder.Build();
1258 paragraph->layout(300);
1259 paragraph->paint(canvas, 0, 0);
1263 paint.setAntiAlias(
true);
1264 paint.setStrokeWidth(1);
1269class ParagraphSlide15 :
public ParagraphSlide_Base {
1271 ParagraphSlide15() {
fName =
"Paragraph15"; }
1280 auto fontCollection = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
false);
1282 fontCollection->addFontFromFile(
"abc/abc.ttf",
"abc");
1283 fontCollection->addFontFromFile(
"abc/abc+grave.ttf",
"abc+grave");
1284 fontCollection->addFontFromFile(
"abc/abc+agrave.ttf",
"abc+agrave");
1291 builder.pushStyle(text_style);
1294 builder.pushStyle(text_style);
1300 builder.pushStyle(text_style);
1303 builder.pushStyle(text_style);
1306 auto paragraph =
builder.Build();
1307 paragraph->layout(800);
1308 paragraph->paint(canvas, 50, 50);
1313class ParagraphSlide16 :
public ParagraphSlide_Base {
1315 ParagraphSlide16() {
fName =
"Paragraph16"; }
1320 const char*
text =
"content";
1326 auto fontCollection = sk_make_sp<FontCollection>();
1328 fontCollection->enableFontFallback();
1336 builder.pushStyle(text_style);
1339 auto paragraph =
builder.Build();
1340 paragraph->layout(800);
1341 paragraph->paint(canvas, 0, 0);
1345class ParagraphSlide17 :
public ParagraphSlide_Base {
1347 ParagraphSlide17() {
fName =
"Paragraph17"; }
1352 auto fontCollection = sk_make_sp<FontCollection>();
1354 fontCollection->enableFontFallback();
1357 auto multiplier = 5.67;
1360 const char*
text =
">S͛ͭ̋͆̈̔̇͗̍͑̎ͪͮͧͣ̽ͫͣ́ͬ̀͌͑͂͗͒̍̔̄ͧ̏̉̌̊̊̿̀̌̃̄͐̓̓̚̚҉̵̡͜͟͝͠͏̸̵̡̧͜҉̷̡͇̜̘̻̺̘̟̝͙̬̘̩͇̭̼̥̖̤̦͎k͉̩̘͚̜̹̗̗͍̤̥̱͉̳͕͖̤̲̣͚̮̞̬̲͍͔̯̻̮̞̭͈̗̫͓̂ͨ̉ͪ̒͋͛̀̍͊ͧ̿̅͆̓̔̔ͬ̇̑̿ͩ͗ͮ̎͌̿̄ͅP̴̵̡̡̛̪͙̼̣̟̩̭̫̱͙̬͔͉͍̘̠͉̦̝̘̥̟̗͖̫̤͕̙̬̦͍̱̖̮̱͑͐̎̃̒͐͋̚͘͞a̶̶̵̵̵̶̶̡̧̢̢̺͔̣͖̭̺͍̤͚̱̜̰̥͕̬̥̲̞̥̘͇͚̺̰͚̪̺͔̤͍̓̿͆̎͋̓ͦ̈́ͦ̌́̄͗̌̓͌̕͜͜͟͢͝͡ŕ͎̝͕͉̻͎̤̭͚̗̳̖̙̘͚̫͖͓͚͉͔͈̟̰̟̬̗͓̟͚̱̕͡ͅͅͅa̸̶̢̛̛̽ͮͩ̅͒ͫ͗͂̎ͦ̈́̓̚͘͜͢͡҉̷̵̶̢̡̜̮̦̜̥̜̯̙͓͔̼̗̻͜͜ͅḡ̢̛͕̗͖̖̤̦̘͔ͨͨ̊͒ͩͭͤ̍̅̃ͪ̋̏̓̍̋͗̋ͨ̏̽̈́̔̀̋̉ͫ̅̂ͭͫ̏͒͋ͥ̚͜r̶̢̧̧̥̤̼̀̂̒ͪ͌̿͌̅͛ͨͪ͒̍ͥ̉ͤ̌̿̆́ͭ͆̃̒ͤ͛̊ͧ̽͘͝͠a̧̢̧̢͑͑̓͑ͮ̃͂̄͛́̈́͋̂͌̽̄͒̔́̇ͨͧͭ͐ͦ̋ͨ̍ͦ̍̋͆̔ͧ͑͋͌̈̓͛͛̚͢͜͜͏̴̢̧̛̳͍̹͚̰̹̻͔p̨̡͆ͦͣ͊̽̔͂̉ͣ̔ͣ̌̌̉̃̋̂͒ͫ̄̎̐͗̉̌̃̽̽́̀̚͘͜͟҉̱͉h̭̮̘̗͔̜̯͔͈̯̺͔̗̣̭͚̱̰̙̼̹͚̣̻̥̲̮͍̤͜͝<";
1364 paint.setColor(ltgray);
1370 builder.pushStyle(text_style);
1372 auto paragraph =
builder.Build();
1373 paragraph->layout(10000);
1374 paragraph->paint(canvas, 0, 0);
1380 std::u16string COMBINING_DOWN = u
"\u0316\u0317\u0318\u0319\u031c\u031d\u031e\u031f\u0320\u0324\u0325\u0326\u0329\u032a\u032b\u032c\u032d\u032e\u032f\u0330\u0331\u0332\u0333\u0339\u033a\u033b\u033c\u0345\u0347\u0348\u0349\u034d\u034e\u0353\u0354\u0355\u0356\u0359\u035a\u0323";
1381 std::u16string COMBINING_UP = u
"\u030d\u030e\u0304\u0305\u033f\u0311\u0306\u0310\u0352\u0357\u0351\u0307\u0308\u030a\u0342\u0343\u0344\u034a\u034b\u034c\u0303\u0302\u030c\u0350\u0300\u0301\u030b\u030f\u0312\u0313\u0314\u033d\u0309\u0363\u0364\u0365\u0366\u0367\u0368\u0369\u036a\u036b\u036c\u036d\u036e\u035b\u0346\u031a";
1382 std::u16string COMBINING_MIDDLE = u
"\u0315\u031b\u0340\u0341\u0358\u0321\u0322\u0327\u0328\u0334\u0335\u0336\u034f\u035c\u035d\u035e\u035f\u0360\u0362\u0338\u0337\u0361\u0489";
1384 std::u16string randomMarks(std::u16string& combiningMarks) {
1386 auto num = std::rand() % (combiningMarks.size() / 1);
1387 for (
size_t i = 0;
i < num; ++
i) {
1388 auto index = std::rand() % combiningMarks.size();
1389 result += combiningMarks[index];
1395 std::u16string zalgo(
const std::string& victim) {
1397 for (
auto& c : victim) {
1399 result += randomMarks(COMBINING_UP);
1400 result += randomMarks(COMBINING_MIDDLE);
1401 result += randomMarks(COMBINING_DOWN);
1407class ParagraphSlide18 :
public ParagraphSlide_Base {
1409 ParagraphSlide18() {
fName =
"Paragraph18"; }
1430 bool animate(
double nanos)
override {
1431 if (++fIndex > fLimit) {
1446 auto multiplier = 5.67;
1447 auto fontCollection = sk_make_sp<FontCollection>();
1449 fontCollection->enableFontFallback();
1457 paint.setColor(ltgray);
1462 if (fRedraw || fRepeat) {
1464 if (fRedraw || fParagraph ==
nullptr) {
1466 builder.pushStyle(text_style);
1467 auto utf16text = zalgo.zalgo(
"SkParagraph");
1474 SkDebugf(
"Text:>%s<\n", impl->text().data());
1477 fParagraph->layout(1000);
1478 fParagraph->paint(canvas, 300, 200);
1480 for (
auto&
run : impl->runs()) {
1482 if (
run.font().getTypeface() !=
nullptr) {
1483 run.font().getTypeface()->getFamilyName(&fontFamily);
1485 if (
run.font().getTypeface() !=
nullptr) {
1486 for (
size_t i = 0;
i <
run.size(); ++
i) {
1487 auto glyph =
run.glyphs().begin() +
i;
1502 bool fRedraw =
true;
1503 bool fRepeat =
false;
1506 std::unique_ptr<Paragraph> fParagraph;
1509class ParagraphSlide19 :
public ParagraphSlide_Base {
1511 ParagraphSlide19() {
fName =
"Paragraph19"; }
1516 auto fontCollection = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
false,
true);
1518 std::u16string
text = u
"\u0068\u0301\u0350\u0312\u0357\u030C\u0369\u0305\u036C\u0304\u0310\u033F\u0366\u0350\u0343\u0364\u0369\u0311\u0309\u030E\u0365\u031B\u0340\u0337\u0335\u035E\u0334\u0328\u0360\u0360\u0315\u035F\u0340\u0340\u0362\u0360\u0322\u031B\u031B\u0337\u0340\u031E\u031F\u032A\u0331\u0345\u032F\u0332\u032E\u0333\u0353\u0320\u0345\u031C\u031F\u033C\u0325\u0355\u032C\u0325\u033Aa\u0307\u0312\u034B\u0308\u0312\u0346\u0313\u0346\u0304\u0307\u0344\u0305\u0342\u0368\u0346\u036A\u035B\u030F\u0365\u0307\u0340\u0328\u0322\u0361\u0489\u034F\u0328\u0334\u035F\u0335\u0362\u0489\u0360\u0358\u035E\u0360\u035D\u0341\u0337\u0337\u032E\u0326\u032D\u0359\u0318\u033C\u032F\u0333\u035A\u034D\u0319\u031C\u0353\u033C\u0345\u0359\u0331\u033B\u0331\u033C";
1525 builder.pushStyle(text_style);
1527 auto paragraph =
builder.Build();
1528 paragraph->layout(this->
size().width());
1529 paragraph->paint(canvas, 0, 0);
1533class ParagraphSlide20 :
public ParagraphSlide_Base {
1535 ParagraphSlide20() {
fName =
"Paragraph20"; }
1540 auto fontCollection = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
false,
true);
1542 const char*
text =
"Manage your google account";
1551 builder.pushStyle(text_style);
1553 auto paragraph =
builder.Build();
1554 paragraph->layout(this->
size().width());
1555 paragraph->paint(canvas, 0, 0);
1559class ParagraphSlide21 :
public ParagraphSlide_Base {
1561 ParagraphSlide21() {
fName =
"Paragraph21"; }
1566 const char*
text =
"Referral Code";
1573 builder.pushStyle(text_style);
1575 auto paragraph =
builder.Build();
1576 paragraph->layout(0);
1577 paragraph->paint(canvas, 0, 0);
1581class ParagraphSlide22 :
public ParagraphSlide_Base {
1583 ParagraphSlide22() {
fName =
"Paragraph22"; }
1603 paragraph_style.
setTextDirection(direction ? TextDirection::kLtr : TextDirection::kRtl);
1604 auto collection = getFontCollection();
1606 collection->getParagraphCache()->reset();
1607 collection->getParagraphCache()->turnOn(
false);
1612 builder.pushStyle(text_style);
1613 builder.addText(
"I have got a ");
1615 builder.pushStyle(text_style);
1616 builder.addText(
"lovely bunch");
1618 builder.pushStyle(text_style);
1619 builder.addText(
" of coconuts.");
1620 auto paragraph =
builder.Build();
1621 paragraph->layout(this->
size().width());
1622 paragraph->paint(canvas, 0, 0);
1623 collection->getParagraphCache()->turnOn(
true);
1627 bool direction =
false;
1630class ParagraphSlide23 :
public ParagraphSlide_Base {
1632 ParagraphSlide23() {
fName =
"Paragraph23"; }
1637 const char*
text =
"Text with shadow";
1648 builder.pushStyle(text_style);
1650 auto paragraph =
builder.Build();
1651 paragraph->layout(300);
1652 paragraph->paint(canvas, 0, 0);
1658 paint.setAntiAlias(
true);
1659 paint.setStrokeWidth(1);
1677class ParagraphSlide24 :
public ParagraphSlide_Base {
1679 ParagraphSlide24() {
fName =
"Paragraph24"; }
1692 builder.pushStyle(text_style);
1693 builder.addText(
"Right_to_left:");
1694 auto paragraph =
builder.Build();
1695 paragraph->layout(this->
size().
width());
1696 paragraph->paint(canvas, 0, 0);
1701 builder.pushStyle(text_style);
1702 builder.addText(
"Right_to_left+");
1703 auto paragraph =
builder.Build();
1704 paragraph->layout(this->
size().
width());
1705 paragraph->paint(canvas, 0, 0);
1710 builder.pushStyle(text_style);
1711 builder.addText(
"Right_to_left.");
1712 auto paragraph =
builder.Build();
1713 paragraph->layout(this->
size().
width());
1714 paragraph->paint(canvas, 0, 0);
1719class ParagraphSlide25 :
public ParagraphSlide_Base {
1721 ParagraphSlide25() {
fName =
"Paragraph25"; }
1743 auto fontCollection = getFontCollection();
1745 const char* text1 =
"Go to device settings ";
1746 const char* text2 =
"and set up a passcode.";
1761 builder.pushStyle(text_style);
1763 placeholder_style.
fHeight = 32;
1764 placeholder_style.
fWidth = 32;
1767 placeholder_style.
fAlignment = PlaceholderAlignment::kMiddle;
1768 builder.addPlaceholder(placeholder_style);
1770 placeholder_style.
fHeight = 19;
1771 placeholder_style.
fWidth = 41;
1774 placeholder_style.
fAlignment = PlaceholderAlignment::kTop;
1775 builder.addPlaceholder(placeholder_style);
1776 auto paragraph =
builder.Build();
1777 paragraph->layout(280);
1778 paragraph->paint(canvas, 0, 0);
1783class ParagraphSlide26 :
public ParagraphSlide_Base {
1785 ParagraphSlide26() {
fName =
"Paragraph26"; }
1788 auto fontCollection = sk_make_sp<FontCollection>();
1795 paint.setAntiAlias(
true);
1810 builder.addText(u
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ut dolor ornare, fermentum nibh in, consectetur libero. Ut id semper est. Sed malesuada, est id bibendum egestas, urna risus tristique nibh, euismod interdum risus turpis nec purus. Maecenas dolor nisl, consectetur in vestibulum et, tincidunt id leo. Duis maximus, odio eget tristique commodo, lacus tellus dapibus leo, consequat pellentesque arcu nisi sit amet diam. Quisque euismod venenatis egestas. Mauris posuere volutpat iaculis. Suspendisse finibus tempor urna, dignissim venenatis sapien finibus eget. Donec interdum lacus ac venenatis fringilla. Curabitur eget lacinia augue. Vestibulum eu vulputate odio. Quisque nec imperdiet");
1812 auto paragraph =
builder.Build();
1813 paragraph->layout(this->
size().
width() / 2);
1815 std::vector<LineMetrics>
lines;
1816 paragraph->getLineMetrics(
lines);
1819 paragraph->paint(canvas, 0, 0);
1823class ParagraphSlide27 :
public ParagraphSlide_Base {
1825 ParagraphSlide27() {
fName =
"Paragraph27"; }
1828 auto fontCollection = sk_make_sp<FontCollection>();
1830 fontCollection->enableFontFallback();
1831 fontCollection->getParagraphCache()->turnOn(
false);
1881 SkDebugf(
"draw '%s' dir:%s align:%s\n", t,
1882 td == TextDirection::kLtr ?
"left" :
"right",
1883 ta == TextAlign::kLeft ?
"left" :
"right");
1890 builder.pushStyle(text_style);
1893 builder.pushStyle(text_style);
1896 builder.pushStyle(text_style);
1899 builder.pushStyle(text_style);
1902 builder.pushStyle(text_style);
1904 auto paragraph =
builder.Build();
1905 paragraph->layout(
width);
1906 paragraph->paint(canvas, 0, 0);
1908 for (
auto&
line : impl->lines()) {
1910 SkDebugf(
"line[%d]: %f\n", (
int)(&line - impl->lines().begin()),
1913 line.iterateThroughVisualRuns(
true,
1915 *
width =
line.measureTextInsideOneRun(textRange,
run, runOffset, 0,
true, TextLine::TextAdjustment::GlyphCluster).
clip.width();
1917 SkDebugf(
"%zu[%zu: %zu) @%f + %f %s\n",
1919 run->leftToRight() ?
"left" :
"right");
1924 auto boxes = paragraph->getRectsForRange(0, 100, RectHeightStyle::kTight, RectWidthStyle::kTight);
1926 for (
auto& box : boxes) {
1929 box.rect.fLeft, box.rect.fRight, box.rect.fTop, box.rect.fBottom,
1930 box.direction == TextDirection::kLtr ?
"left" :
"right");
1932 canvas->
drawRect(box.rect, even ? red : blue);
1940 draw(
w,
h, TextDirection::kRtl, TextAlign::kRight,
"RTL+RIGHT#1234567890");
1941 draw(
w,
h, TextDirection::kRtl, TextAlign::kRight,
"قففغغغغقففغغغغقففغغغ");
1943 draw(
w,
h, TextDirection::kLtr, TextAlign::kRight,
"LTR+RIGHT#1234567890");
1944 draw(
w,
h, TextDirection::kLtr, TextAlign::kRight,
"قففغغغغقففغغغغقففغغغ");
1946 draw(
w,
h, TextDirection::kRtl, TextAlign::kLeft,
"RTL+LEFT##1234567890");
1947 draw(
w,
h, TextDirection::kRtl, TextAlign::kLeft,
"قففغغغغقففغغغغقففغغغ");
1949 draw(
w,
h, TextDirection::kLtr, TextAlign::kLeft,
"LTR+LEFT##1234567890");
1950 draw(
w,
h, TextDirection::kLtr, TextAlign::kLeft,
"قففغغغغقففغغغغقففغغغ");
1954class ParagraphSlide28 :
public ParagraphSlide_Base {
1956 ParagraphSlide28() {
fName =
"Paragraph28"; }
1960 const char*
text =
"AAAAA BBBBB CCCCC DDDDD EEEEE FFFFF GGGGG HHHHH IIIII JJJJJ KKKKK LLLLL MMMMM NNNNN OOOOO PPPPP QQQQQ";
1965 auto collection = getFontCollection();
1971 builder.pushStyle(text_style);
1973 auto paragraph =
builder.Build();
1975 paragraph->layout(360 -
s);
1976 paragraph->paint(canvas, 0, 0);
1987class ParagraphSlide29 :
public ParagraphSlide_Base {
1989 ParagraphSlide29() {
fName =
"Paragraph29"; }
1993 const char*
text =
"ffi";
1996 auto collection = getFontCollection();
2004 builder.pushStyle(text_style);
2006 auto paragraph =
builder.Build();
2007 paragraph->layout(this->
size().width());
2008 paragraph->paint(canvas, 0, 0);
2009 auto width = paragraph->getLongestLine();
2010 auto height = paragraph->getHeight();
2012 auto f1Pos = paragraph->getGlyphPositionAtCoordinate(
width/6,
height/2);
2013 auto f2Pos = paragraph->getGlyphPositionAtCoordinate(
width/2,
height/2);
2014 auto iPos = paragraph->getGlyphPositionAtCoordinate(
width*5/6,
height/2);
2020 auto f1 = paragraph->getRectsForRange(0, 1, RectHeightStyle::kTight,
2021 RectWidthStyle::kTight);
2026 SkDebugf(
"f1: [%f:%f] %s\n", rf1.rect.fLeft, rf1.rect.fRight,
2027 rf1.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
2030 auto f2 = paragraph->getRectsForRange(1, 2, RectHeightStyle::kTight,
2031 RectWidthStyle::kTight);
2036 SkDebugf(
"f2: [%f:%f] %s\n", rf2.rect.fLeft, rf2.rect.fRight,
2037 rf2.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
2040 auto fi = paragraph->getRectsForRange(2, 3, RectHeightStyle::kTight,
2041 RectWidthStyle::kTight);
2046 SkDebugf(
"i: [%f:%f] %s\n", rfi.rect.fLeft, rfi.rect.fRight,
2047 rfi.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
2053class ParagraphSlide30 :
public ParagraphSlide_Base {
2055 ParagraphSlide30() {
fName =
"Paragraph30"; }
2059 const std::u16string
text =
2060 u
"\U0001f469\u200D\U0001f469\u200D\U0001f466\U0001f469\u200D\U0001f469\u200D\U0001f467\u200D\U0001f467\U0001f1fa\U0001f1f8";
2063 auto fontCollection = sk_make_sp<FontCollection>();
2065 fontCollection->enableFontFallback();
2074 builder.pushStyle(text_style);
2076 auto paragraph =
builder.Build();
2077 paragraph->layout(this->
size().width());
2078 paragraph->paint(canvas, 0, 0);
2079 std::pair<size_t, size_t> rects[] = {
2080 { 0, 2}, { 0, 4}, {0, 8},
2081 {23, 25}, {23, 27}, {23, 31}, {23, 39}, {23, 55}, {21, 23},
2082 {1, 3}, {1, 5}, {1, 9}, {1, 17}, {1, 33},
2083 { 2, 4}, {2, 6}, {2, 10}, {2, 18}, {2, 34},
2084 {3, 5}, {3, 7}, {3, 11}, {3, 19},
2085 {4, 6}, {4, 8}, {4, 12}, {4, 20},
2086 {5, 7}, {5, 9}, {5, 13}, {5, 21},
2087 {6, 8}, {6, 10}, {6, 14}, {6, 22},
2088 {7, 9}, {7, 11}, {7, 15}, {7, 23},
2089 {8, 10}, {8, 12}, {8, 16}, {8,24},
2090 {9, 11}, {9, 13}, {9, 17}, {9, 25},
2091 {10, 12}, {10, 14}, {10, 18}, {10, 26},
2092 {11, 13}, {11, 15}, {11, 19}, {11, 27},
2093 {12, 14}, {12, 16}, {12, 20}, {12, 28},
2094 {13, 15}, {13, 17}, {13, 21},
2095 {14, 16}, {14, 18}, {14, 22},
2096 {15, 17}, {15, 19}, {15, 23},
2097 {16, 18}, {16, 20}, {16, 24},
2103 {22, 24}, {22, 26}, {22, 30}, {22, 38}, {22, 54},
2107 for (
auto rect: rects) {
2108 auto results = paragraph->getRectsForRange(
2109 rect.first,
rect.second, RectHeightStyle::kTight, RectWidthStyle::kTight);
2111 if (!results.empty()) {
2113 SkDebugf(
"[%f : %f]\n", results[0].
rect.fLeft,results[0].rect.fRight);
2119class ParagraphSlide31 :
public ParagraphSlide_Base {
2121 ParagraphSlide31() {
fName =
"Paragraph31"; }
2127 auto fontCollection = sk_make_sp<FontCollection>();
2129 fontCollection->enableFontFallback();
2137 builder.pushStyle(text_style);
2140 auto paragraph =
builder.Build();
2141 paragraph->layout(this->
size().width());
2142 paragraph->paint(canvas, 0, 0);
2146class ParagraphSlide32 :
public ParagraphSlide_Base {
2148 ParagraphSlide32() {
fName =
"Paragraph32"; }
2154 auto fontCollection = sk_make_sp<FontCollection>();
2156 fontCollection->enableFontFallback();
2165 builder.pushStyle(text_style);
2166 builder.addText(u
"\u904d ko ");
2168 builder.pushStyle(text_style);
2169 builder.addText(u
"\u904d zh-Hant ");
2171 builder.pushStyle(text_style);
2172 builder.addText(u
"\u904d zh-Hans ");
2174 builder.pushStyle(text_style);
2175 builder.addText(u
"\u904d zh-HK ");
2176 auto paragraph =
builder.Build();
2177 paragraph->layout(this->
size().width());
2178 paragraph->paint(canvas, 0, 0);
2182class ParagraphSlide33 :
public ParagraphSlide_Base {
2184 ParagraphSlide33() {
fName =
"Paragraph33"; }
2190 auto fontCollection = sk_make_sp<FontCollection>();
2192 fontCollection->enableFontFallback();
2201 builder.pushStyle(text_style);
2202 builder.addText(u
"AAAAA \U0001f600 BBBBB CCCCC DDDDD EEEEE");
2203 auto paragraph =
builder.Build();
2204 paragraph->layout(this->
size().width() / 2);
2209 paragraph->paint(canvas, 0, 0);
2213class ParagraphSlide34 :
public ParagraphSlide_Base {
2215 ParagraphSlide34() {
fName =
"Paragraph34"; }
2220 auto text =
"ضخمة ص ،😁😂🤣ضضض ؤ،،😗😗😍😋شسي،😗😁😁ؤرى،😗😃😄😍ببب،🥰😅🥰🥰🥰ثيلااتن";
2223 auto fontCollection = sk_make_sp<FontCollection>();
2225 fontCollection->enableFontFallback();
2233 builder.pushStyle(text_style);
2235 auto paragraph =
builder.Build();
2236 paragraph->layout(1041);
2243 while (wordPos < 72) {
2244 auto res2 = paragraph->getWordBoundary(wordPos);
2245 if (res2.width() == 0) {
2249 auto res3 = paragraph->getRectsForRange(
2250 res2.start, res2.end,
2251 RectHeightStyle::kTight, RectWidthStyle::kTight);
2254 if (!res3.empty()) {
2258 paragraph->paint(canvas, 0, 0);
2262class ParagraphSlide35 :
public ParagraphSlide_Base {
2264 ParagraphSlide35() {
fName =
"Paragraph35"; }
2270 bool onClick(Click* click)
override {
2271 fPoint = click->fCurr;
2279 auto text = u
"hzbzzj sjsjjs sjkkahgafa\u09A4\u09A1\u09A4\u09A0\u09A4\u09A0 jsjzjgvsh sjsjsksbsbsjs sjjajajahhav jssjbxx jsisudg \u09AF\u09A0\u09AF\u09A0\u09A4\u09A0\u09A4\u09A0\u09A5 \u062A\u0624\u062A\u064A\u0646\u0646\u064A\u0621\u0646\u0627\u0644\u0631\u0631\u064A\u0644\u0627 \u062A\u062A\u0644\u0649 \u062A\u0627\u0631\u064A\u062E \u062A\u0633\u0628\u0628 \u0624\u062A\u064A\u062A\u0624\u062A\u0624\u062A\u0624\u062A\u0624 dhishsbs \u7238\u7238\u4E0D\u5BF9\u52B2\u5927\u5BB6\u90FD\u597D\u8BB0\u5F97\u8BB0\u5F97hshs\u099B\u09A1\u099B\u09A1\u099A jdjdj jdjdjd dbbdbdbdbddbnd\u09A2\u099B\u09A1\u09A2\u09A3\u099B\u09B0\u099A\u0998\u09A0\u09A0\u09B8\u09AB\u0997\u09A3\u09A4\u099C\u09B0\u09A5\u099B\u099B\u09A5\u09A6\u099D\u09A6\u09B2\u09A5\u09A4\u09A3\u09A2\u0997\u0996\u09A0\u0998\u0999\u09A3\u099A\u09A5\u09A4\u09A3\u062A\u0628\u0646\u064A\u0646 \u09A5\u09A3\u09A3 \u09A4\u0998\u0998\u0998\u099B\u09A4 \u09A4\u09A3 \u09A3\u0998\u09A2\u09A3\u0999\u0648\u064A\u0648\u0621\u062A\u064A\u0632\u0633\u0646\u0632\u0624\u0624\u0645\u0645\u0624\u0648\u0624\u0648\u0648\u064A\u0646\u0624\u0646\u0624\u0646\u0624\u0624 \u09A4\u09A4\u09A2\u09A2\u09A4\u09A4 \u0999\u0998\u0997\u09C1\u099B\u09A5 \u09A4\u0997\u0998\u09A3\u099A\u099C\u09A6\u09A5\u0632\u0624\u0648\u0624\u0648\u0624 \u09A4\u09A4\u09A3\u0998\u09A2\u09A4\u099B\u09A6\u09A5\u09A4\u0999\u0998\u09A3 \u0648\u0624\u0648\u0624\u0648\u0624\u0632\u0624\u0646\u0633\u0643\u0633\u0643\u0628\u0646\u09A4\u09AD\u0996\u0996\u099F\u09C0\u09C1\u099B\u09A6\u09C0\u09C1\u09C2\u09C7\u0648\u0624\u0646\u0621\u0646\u0624\u0646 \u09C7\u09C2\u09C0\u09C2\u099A\u09A3\u09A2\u09A4\u09A5\u09A5\u0632\u064A\u09C7\u09C2\u09C0\u09C2\u099A\u09A3\u09A2\u09AE\u09A4\u09A5\u09A5 \U0001f34d\U0001f955\U0001f4a7\U0001f4a7\U0001f4a6\U0001f32a";
2280 auto fontCollection = sk_make_sp<FontCollection>();
2282 fontCollection->enableFontFallback();
2291 builder.pushStyle(text_style);
2293 auto paragraph =
builder.Build();
2294 paragraph->layout(this->
size().width());
2298 auto res1 = paragraph->getRectsForRange(360, 361, RectHeightStyle::kTight, RectWidthStyle::kTight);
2299 auto res2 = paragraph->getRectsForRange(359, 360, RectHeightStyle::kTight, RectWidthStyle::kTight);
2300 auto res3 = paragraph->getRectsForRange(358, 359, RectHeightStyle::kTight, RectWidthStyle::kTight);
2305 for (
auto& r : res) {
2314 paragraph->paint(canvas, 0, 0);
2321class ParagraphSlide36 :
public ParagraphSlide_Base {
2323 ParagraphSlide36() {
fName =
"Paragraph36"; }
2328 auto text =
"String is too big for WinMSVC";
2334 auto fontCollection = sk_make_sp<FontCollection>();
2336 fontCollection->enableFontFallback();
2344 builder.pushStyle(text_style);
2346 auto paragraph =
builder.Build();
2347 paragraph->layout(this->
size().width());
2349 paragraph->paint(canvas, 0, 0);
2353class ParagraphSlide37 :
public ParagraphSlide_Base {
2355 ParagraphSlide37() {
fName =
"Paragraph37"; }
2358 const char*
text =
"String is too big for WinMSVC";
2363 auto fontCollection = sk_make_sp<FontCollection>();
2365 fontCollection->enableFontFallback();
2373 builder.pushStyle(text_style);
2375 auto paragraph =
builder.Build();
2376 auto w = this->
size().width() / 2;
2377 paragraph->layout(
w);
2384 for (
auto& cluster: clusters) {
2385 SkDebugf(
"%zu: [%zu:%zu) %s\n", c++,
2386 cluster.textRange().start, cluster.textRange().end,
2387 cluster.isSoftBreak() ?
"soft" :
2388 cluster.isHardBreak() ?
"hard" :
2389 cluster.isWhitespaceBreak() ?
"spaces" :
"");
2392 auto lines = impl->lines();
2396 SkDebugf(
"%zu: [%zu:%zu)\n",
i++,
line.trimmedText().start,
line.trimmedText().end);
2400 paragraph->paint(canvas, 0, 0);
2404class ParagraphSlide38 :
public ParagraphSlide_Base {
2406 ParagraphSlide38() {
fName =
"Paragraph38"; }
2412 auto fontCollection = sk_make_sp<FontCollection>();
2414 fontCollection->enableFontFallback();
2428 builder.pushStyle(text_style);
2429 builder.addText(
"Double underline: {opopo}\n");
2434 builder.pushStyle(text_style);
2435 builder.addText(
"Double underline: {opopo}\n");
2439 builder.pushStyle(text_style);
2440 builder.addText(
"Dotted underline: {ijiji}\n");
2444 builder.pushStyle(text_style);
2445 builder.addText(
"Solid underline: {rqrqr}\n");
2449 builder.pushStyle(text_style);
2450 builder.addText(
"Dashed underline: {zyzyz}\n");
2454 builder.pushStyle(text_style);
2455 builder.addText(
"Wavy underline: {does not skip}\n");
2457 auto paragraph =
builder.Build();
2458 paragraph->layout(this->
size().width());
2459 paragraph->paint(canvas, 0, 0);
2463class ParagraphSlide39 :
public ParagraphSlide_Base {
2465 ParagraphSlide39() {
fName =
"Paragraph39"; }
2471 auto fontCollection = sk_make_sp<FontCollection>();
2473 fontCollection->enableFontFallback();
2482 builder.pushStyle(text_style);
2484 "text1 with line break\n"
2485 "text2 without line break text without line break text without line break text without line break text without line break text without line break "
2486 "text3 with line break\n"
2487 "text4 without line break text without line break text without line break text without line break text without line break text without line break "
2488 "text5 with line break\n"
2490 auto paragraph =
builder.Build();
2491 paragraph->layout(this->
size().width());
2492 paragraph->paint(canvas, 0, 0);
2496class ParagraphSlide41 :
public ParagraphSlide_Base {
2498 ParagraphSlide41() {
fName =
"Paragraph41"; }
2504 auto fontCollection = sk_make_sp<FontCollection>();
2506 fontCollection->enableFontFallback();
2511 line.setAntiAlias(
true);
2512 line.setStrokeWidth(1);
2527 builder.pushStyle(text_style);
2528 builder.addText(
"World domination is such an ugly phrase - I prefer to call it world optimisation");
2529 auto paragraph =
builder.Build();
2530 paragraph->layout(this->
size().width());
2531 paragraph->paint(canvas, 0, 0);
2532 canvas->
drawLine(0, paragraph->getHeight(), paragraph->getMaxWidth(), paragraph->getHeight(),
line);
2533 canvas->
translate(0, paragraph->getHeight());
2543class ParagraphSlide42 :
public ParagraphSlide_Base {
2545 ParagraphSlide42() {
fName =
"Paragraph42"; }
2549 SkString text(
"Atwater Peel Sherbrooke Bonaventure\nhi\nwasssup!");
2552 auto fontCollection = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
true,
true);
2562 builder.pushStyle(text_style);
2564 auto paragraph =
builder.Build();
2565 paragraph->layout(this->
size().width());
2567 auto boxes = paragraph->getRectsForRange(0, 7, RectHeightStyle::kIncludeLineSpacingTop, RectWidthStyle::kMax);
2568 for (
auto& box : boxes) {
2574 auto boxes2 = paragraph->getRectsForRange(0, 7, RectHeightStyle::kTight, RectWidthStyle::kMax);
2575 for (
auto& box : boxes2) {
2581 paragraph->paint(canvas, 0, 0);
2585class ParagraphSlide43 :
public ParagraphSlide_Base {
2587 ParagraphSlide43() {
fName =
"Paragraph43"; }
2591 SkString text(
"World domination is such an ugly phrase - I prefer to call it world optimisation");
2594 auto fontCollection = sk_make_sp<FontCollection>();
2596 fontCollection->enableFontFallback();
2608 builder.pushStyle(text_style);
2610 auto paragraph =
builder.Build();
2611 paragraph->layout(this->
size().width() / 4);
2612 paragraph->paint(canvas, 0, 0);
2616class ParagraphSlide44 :
public ParagraphSlide_Base {
2618 ParagraphSlide44() {
fName =
"Paragraph44"; }
2622 const std::u16string
text = u
"The quick brown fox \U0001f98a ate a zesty ham burger fons \U0001f354."
2623 "The \U0001f469\u200D\U0001f469\u200D\U0001f467\u200D\U0001f467 laughed.";
2626 auto fontCollection = sk_make_sp<FontCollection>();
2628 fontCollection->enableFontFallback();
2638 builder.pushStyle(text_style);
2640 auto paragraph =
builder.Build();
2641 paragraph->layout(305);
2642 paragraph->paint(canvas, 0, 0);
2646class ParagraphSlide45 :
public ParagraphSlide_Base {
2648 ParagraphSlide45() {
fName =
"Paragraph45"; }
2654 std::set<std::pair<std::string, std::string>> font_paths = {
2655 {
"Roboto",
"Roboto-Regular.ttf"},
2656 {
"Roboto",
"Roboto-Bold.ttf"},
2657 {
"Noto",
"NotoSansCJK-Regular.ttc"},
2658 {
"Noto",
"NotoSansCJK-Bold.ttc"},
2659 {
"Emoji",
"NotoColorEmoji.ttf"}};
2663 for (
auto& pair : font_paths) {
2666 path += pair.second;
2674 font_collection->setAssetFontManager(std::move(font_provider));
2675 font_collection->getParagraphCache()->turnOn(
false);
2677 const std::u16string
text = u
"❤️🕵🏾♀️ 🕵🏾 👩🏾⚕️ 👨🏾⚕️ 👩🏾🌾 👨🏾🌾 👩🏾🍳 👨🏾🍳 👩🏾🎓 👨🏾🎓 👩🏾🎤 👨🏾🎤 👩🏾🏫 👨🏾🏫 👩🏾🏭 👨🏾🏭 👩🏾💻 👨🏾💻 👩🏾💼 👨🏾💼 👩🏾🔧 👨🏾🔧 👩🏾🔬 👨🏾🔬 👩🏾🎨 👨🏾🎨 👩🏾🚒 👨🏾🚒 👩🏾✈️ 👨🏾✈️ 👩🏾🚀 👨🏾🚀 👩🏾⚖️ 👨🏾⚖️ 🤶🏾 🎅🏾";
2692 builder.pushStyle(text_style);
2694 auto paragraph =
builder.Build();
2695 paragraph->layout(this->
size().width());
2696 paragraph->paint(canvas, 0, 0);
2700class ParagraphSlide46 :
public ParagraphSlide_Base {
2702 ParagraphSlide46() {
fName =
"Paragraph46"; }
2706 auto text =
"XXXXXXXXXX\nYYYYYYYYYY\nZZZZZZZZZZ";
2709 auto fontCollection = sk_make_sp<FontCollection>();
2711 fontCollection->enableFontFallback();
2715 auto column = this->
size().width()/3;
2722 builder.pushStyle(text_style);
2724 auto paragraph =
builder.Build();
2725 paragraph->layout(column);
2726 paragraph->paint(canvas,
x, 000);
2727 paragraph->paint(canvas,
x, 200);
2728 paragraph->paint(canvas,
x, 400);
2735class ParagraphSlide47 :
public ParagraphSlide_Base {
2737 ParagraphSlide47() {
fName =
"Paragraph47"; }
2746 auto fontCollection = sk_make_sp<FontCollection>();
2757 const char* hello =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do";
2759 builder->addText(hello, strlen(hello));
2761 auto paragraph =
builder->Build();
2762 paragraph->layout(100);
2763 paragraph->paint(canvas, 200, 200);
2765 paragraph->layout(200);
2766 paragraph->paint(canvas, 200, 300);
2774 builder2->addText(hello, strlen(hello));
2776 auto paragraph2 = builder2->Build();
2777 paragraph2->layout(100);
2778 paragraph2->paint(canvas, 200, 400);
2780 paragraph2->layout(200);
2781 paragraph2->paint(canvas, 200, 500);
2786class ParagraphSlide48 :
public ParagraphSlide_Base {
2788 ParagraphSlide48() {
fName =
"Paragraph48"; }
2798 auto fontCollection = sk_make_sp<FontCollection>();
2807 const char* hello =
"👶 487";
2809 builder->addText(hello, strlen(hello));
2811 auto paragraph =
builder->Build();
2812 paragraph->layout(200);
2813 paragraph->paint(canvas, 200, 200);
2815 const char* hello2 =
"487";
2817 builder2->addText(hello2, strlen(hello2));
2819 auto paragraph2 = builder2->Build();
2820 paragraph2->layout(200);
2821 paragraph2->paint(canvas, 200, 300);
2823 const char* hello3 =
" 👶 487";
2825 builder3->addText(hello3, strlen(hello3));
2827 auto paragraph3 = builder3->Build();
2828 paragraph3->layout(200);
2829 paragraph3->paint(canvas, 200, 400);
2834class ParagraphSlide49 :
public ParagraphSlide_Base {
2836 ParagraphSlide49() {
fName =
"Paragraph49"; }
2840 auto fontCollection = getFontCollection();
2841 fontCollection->disableFontFallback();
2842 const char*
text =
"AAAAAAAAA\n";
2850 builder.pushStyle(text_style);
2853 placeholder_style.
fHeight = 42;
2854 placeholder_style.
fWidth = 45;
2858 builder.addPlaceholder(placeholder_style);
2859 auto paragraph =
builder.Build();
2860 paragraph->layout(360);
2861 paragraph->paint(canvas, 0, 0);
2865class ParagraphSlide50 :
public ParagraphSlide_Base {
2867 ParagraphSlide50() {
fName =
"Paragraph50"; }
2872 auto fontCollection = sk_make_sp<FontCollection>();
2885 builder.pushStyle(text_style);
2888 auto paragraph =
builder.Build();
2889 paragraph->layout(360);
2890 paragraph->paint(canvas, 0, 0);
2894class ParagraphSlide51 :
public ParagraphSlide_Base {
2896 ParagraphSlide51() {
fName =
"Paragraph51"; }
2901 auto fontCollection = sk_make_sp<FontCollection>();
2903 fontCollection->enableFontFallback();
2911 builder.pushStyle(text_style);
2912 builder.addText(u
"\u0e41\u0e2a\u0e19\u0e2a\u0e31\nabc");
2914 auto paragraph =
builder.Build();
2915 paragraph->layout(1000);
2916 paragraph->paint(canvas, 0, 0);
2920class ParagraphSlide52 :
public ParagraphSlide_Base {
2922 ParagraphSlide52() {
fName =
"Paragraph52"; }
2928 auto fontCollection = sk_make_sp<FontCollection>();
2930 fontCollection->enableFontFallback();
2934 const char*
text =
" 😀 😃";
2944 builder.pushStyle(text_style);
2948 auto paragraph =
builder.Build();
2949 paragraph->layout(this->
size().width());
2951 paragraph->paint(canvas, 0, 0);
2955 const char*
text =
" 😀 A";
2965 builder.pushStyle(text_style);
2969 auto paragraph =
builder.Build();
2970 paragraph->layout(this->
size().width());
2972 paragraph->paint(canvas, 0, 400);
2978class ParagraphSlide53 :
public ParagraphSlide_Base {
2980 ParagraphSlide53() {
fName =
"Paragraph53"; }
2984 const char* text1 =
"אאא בבב גגג דדד ההה";
2985 const char* text2 =
"ששש תתת";
2988 auto fontCollection = sk_make_sp<FontCollection>();
2990 fontCollection->enableFontFallback();
2999 builder.pushStyle(text_style);
3004 auto paragraph =
builder.Build();
3005 paragraph->layout(this->
size().
width());
3006 paragraph->paint(canvas, 0, 0);
3007 canvas->
translate(0, paragraph->getHeight() + 20);
3015 builder.pushStyle(text_style);
3018 builder.pushStyle(text_style);
3022 auto paragraph =
builder.Build();
3023 paragraph->layout(this->
size().
width());
3024 paragraph->paint(canvas, 0, 0);
3025 canvas->
translate(0, paragraph->getHeight() + 20);
3031class ParagraphSlide54 :
public ParagraphSlide_Base {
3033 ParagraphSlide54() {
fName =
"Paragraph54"; }
3039 auto text =
"👨👩👧👦😀";
3042 auto fontCollection = getFontCollection();
3044 fontCollection->enableFontFallback();
3055 builder.pushStyle(text_style);
3058 auto paragraph =
builder.Build();
3059 paragraph->layout(this->
size().width());
3060 paragraph->paint(canvas, 0, 0);
3064class ParagraphSlide55 :
public ParagraphSlide_Base {
3066 ParagraphSlide55() {
fName =
"Paragraph55"; }
3070 std::string
text(
"يَهْدِيْكُمُ اللَّهُ وَيُصْلِحُ بَالَكُمُ");
3075 auto fontCollection = getFontCollection();
3076 fontCollection->disableFontFallback();
3086 builder.pushStyle(text_style);
3089 builder.pushStyle(text_style);
3092 builder.pushStyle(text_style);
3095 auto paragraph =
builder.Build();
3096 paragraph->layout(this->
size().width());
3097 paragraph->paint(canvas, 0, 0);
3101class ParagraphSlide56 :
public ParagraphSlide_Base {
3103 ParagraphSlide56() {
fName =
"Paragraph56"; }
3107 auto text =
"BAM BAM BAM by Jade Baraldo\n"
3108 "Now on Top 100 Music Videos United States";
3110 auto fontCollection = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
false);
3111 fontCollection->addFontFromFile(
"music/Roboto-Regular.ttf",
"roboto");
3112 fontCollection->addFontFromFile(
"music/NotoSansCJK-Regular.ttc",
"noto");
3113 fontCollection->addFontFromFile(
"music/NotoColorEmoji.ttf",
"emoji");
3124 builder.pushStyle(text_style);
3126 auto paragraph =
builder.Build();
3127 paragraph->layout(this->
size().width());
3128 paragraph->paint(canvas, 0, 0);
3132class ParagraphSlide57 :
public ParagraphSlide_Base {
3134 ParagraphSlide57() {
fName =
"Paragraph57"; }
3139 auto fontCollection = sk_make_sp<FontCollection>();
3141 fontCollection->enableFontFallback();
3150 builder.pushStyle(text_style);
3151 builder.addText(
"בבבב\n\nאאאא");
3153 auto paragraph =
builder.Build();
3154 paragraph->layout(this->
size().width());
3155 paragraph->paint(canvas, 0, 0);
3157 auto height = paragraph->getHeight();
3158 auto res1 = paragraph->getGlyphPositionAtCoordinate(0,0);
3159 auto res2 = paragraph->getGlyphPositionAtCoordinate(0,
height / 2);
3160 auto res3 = paragraph->getGlyphPositionAtCoordinate(0,
height);
3167class ParagraphSlide58 :
public ParagraphSlide_Base {
3169 ParagraphSlide58() {
fName =
"Paragraph58"; }
3174 auto fontCollection = getFontCollection();
3176 fontCollection->enableFontFallback();
3185 builder.pushStyle(text_style);
3186 builder.addText(u
"Text1 Google\u00A0Pay Text2");
3188 auto paragraph =
builder.Build();
3189 paragraph->layout(this->
size().width());
3190 paragraph->paint(canvas, 0, 0);
3194class ParagraphSlide59 :
public ParagraphSlide_Base {
3196 ParagraphSlide59() {
fName =
"Paragraph59"; }
3200 auto fontCollection = getFontCollection();
3210 builder.pushStyle(text_style);
3211 builder.addText(
"The quick brown fox ate a hamburgerfons and got sick.");
3212 auto paragraph =
builder.Build();
3213 paragraph->layout(this->
size().
width());
3215 paragraph->paint(canvas, 0, 0);
3222 info->font.getMetrics(&metrics);
3224 auto first =
info->positions[0]; first.offset(
info->origin.fX,
info->origin.fY);
3227 info->advanceX - first.fX,
3234 paragraph->paint(canvas, 0, 0);
3238class ParagraphSlide60 :
public ParagraphSlide_Base {
3240 ParagraphSlide60() {
fName =
"Paragraph60"; }
3246 auto fontCollection = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
true,
true);
3255 builder.pushStyle(text_style);
3257 auto paragraph =
builder.Build();
3258 paragraph->layout(this->
size().
width());
3259 auto result = paragraph->getGlyphPositionAtCoordinate(20, 2);
3264class ParagraphSlide61 :
public ParagraphSlide_Base {
3266 ParagraphSlide61() {
fName =
"Paragraph61"; }
3272 auto fontCollection = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
true,
true);
3281 builder.pushStyle(text_style);
3282 builder.addText(
"______________________");
3283 auto paragraph =
builder.Build();
3284 paragraph->layout(132.0f);
3285 paragraph->paint(canvas, 0, 0);
3286 std::vector<LineMetrics> metrics;
3287 paragraph->getLineMetrics(metrics);
3288 for (
auto& metric : metrics) {
3289 SkDebugf(
"Line[%zu:%zu <= %zu <= %zu)\n", metric.fStartIndex, metric.fEndExcludingWhitespaces, metric.fEndIndex, metric.fEndIncludingNewline);
3295class ParagraphSlide62 :
public ParagraphSlide_Base {
3297 ParagraphSlide62() {
fName =
"Paragraph62"; }
3303 auto fontCollection = sk_make_sp<FontCollection>();
3315 builder.pushStyle(text_style);
3318 auto paragraph =
builder.Build();
3320 paragraph->paint(canvas, 0, 0);
3322 for (
auto x = 0.0f;
x < paragraph->getMaxIntrinsicWidth();
x += 5.0f) {
3323 auto pos = paragraph->getGlyphPositionAtCoordinate(
x, paragraph->getHeight() / 2);
3325 auto rects = paragraph->getRectsForRange(0,
p,RectHeightStyle::kTight, RectWidthStyle::kTight);
3330 for (
auto&
rect : rects) {
3342class ParagraphSlide63 :
public ParagraphSlide_Base {
3344 ParagraphSlide63() {
fName =
"Paragraph63"; }
3349 auto fontCollection = getFontCollection();
3367 builder.pushStyle(text_style);
3369 auto paragraph =
builder.Build();
3371 paragraph->paint(canvas, 0, 0);
3372 SkDebugf(
"height=%f\n", paragraph->getHeight());
3385class ParagraphSlide64 :
public ParagraphSlide_Base {
3387 ParagraphSlide64() {
fName =
"Paragraph64"; }
3390 auto fontCollection = getFontCollection();
3392 fontCollection->enableFontFallback();
3400 builder.pushStyle(text_style);
3402 builder.addText(
"حَاوِلْ نُطْقَ \"كَيْفَ حَالُكَ؟\"");
3405 auto paragraph =
builder.Build();
3407 paragraph->layout(paragraph->getMaxIntrinsicWidth() + 1);
3408 paragraph->paint(canvas, 0, 0);
3413class ParagraphSlide66 :
public ParagraphSlide_Base {
3415 ParagraphSlide66() {
fName =
"Paragraph66"; }
3418 auto fontCollection = sk_make_sp<TestFontCollection>(
GetResourcePath(
"fonts").c_str(),
true);
3419 fontCollection->disableFontFallback();
3420 fontCollection->addFontFromFile(
"abc/abc.ttf",
"abc");
3433 fontCollection->enableFontFallback();
3435 fontCollection->disableFontFallback();
3439 builder.pushStyle(text_style);
3440 builder.addText(u
"abc \u2026 abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc");
3441 auto paragraph =
builder.Build();
3442 paragraph->layout(this->
size().width());
3443 paragraph->paint(canvas, 0, 0);
3444 canvas->
translate(0, paragraph->getHeight());
3454class ParagraphSlide67 :
public ParagraphSlide_Base {
3456 ParagraphSlide67() {
fName =
"Paragraph67"; }
3459 auto fontCollection = getFontCollection();
3461 fontCollection->enableFontFallback();
3499 if (
text[0] ==
'u') {
3501 }
else if (
text[0] ==
'o') {
3504 }
else if (
text[0] ==
's') {
3509 builder.pushStyle(text_style1);
3511 builder.pushStyle(text_style);
3515 auto paragraph =
builder.Build();
3516 paragraph->layout(this->
size().
width());
3517 paragraph->paint(canvas, 0, 0);
3531 canvas->
translate(0, paragraph->getHeight());
3534 draw(
"+++++++++++++++++++");
3535 draw(
"AAA\nBBB\nCCC",
true);
3536 draw(
"===================");
3537 draw(
"underline\nBBB\nCCC",
true);
3538 draw(
"===================");
3539 draw(
"strike\nBBB\nCCC",
true);
3540 draw(
"===================");
3541 draw(
"overline\nBBB\nCCC",
true);
3542 draw(
"===================");
3546class ParagraphSlide68 :
public ParagraphSlide_Base {
3548 ParagraphSlide68() {
fName =
"Paragraph68"; }
3551 auto fontCollection = getFontCollection();
3553 fontCollection->enableFontFallback();
3581 auto draw = [&](
const char*
text) {
3583 builder.pushStyle(text_style1);
3586 auto paragraph =
builder.Build();
3587 paragraph->layout(this->
size().
width());
3588 paragraph->paint(canvas, 0, 0);
3589 SkDebugf(
"paragraph='%s' %f\n",
text, paragraph->getHeight());
3590 canvas->
translate(0, paragraph->getHeight() + 20);
3598class ParagraphSlide_MultiStyle_Logo :
public ParagraphSlide_Base {
3600 ParagraphSlide_MultiStyle_Logo() {
fName =
SkString(
"ParagraphSlide_MultiStyle_Logo"); }
3626 const char* logo1 =
"google_";
3627 const char* logo2 =
"logo";
3628 const char* logo3 =
"go";
3629 const char* logo4 =
"ogle_logo";
3630 const char* logo5 =
"google_lo";
3631 const char* logo6 =
"go";
3638 builder.addText(logo1, strlen(logo1));
3643 builder.addText(logo2, strlen(logo2));
3650 builder.addText(logo3, strlen(logo3));
3655 builder.addText(logo4, strlen(logo4));
3662 builder.addText(logo5, strlen(logo5));
3667 builder.addText(logo6, strlen(logo6));
3669 auto paragraph =
builder.Build();
3670 paragraph->layout(
width - 40);
3671 paragraph->paint(canvas, 20, 20);
3677class ParagraphSlide_MultiStyle_FFI :
public ParagraphSlide_Base {
3679 ParagraphSlide_MultiStyle_FFI() {
fName =
SkString(
"ParagraphSlide_MultiStyle_FFI"); }
3685 auto collection = getFontCollection();
3694 builder.pushStyle(text_style);
3697 builder.pushStyle(text_style);
3700 builder.pushStyle(text_style);
3702 auto paragraph =
builder.Build();
3703 paragraph->layout(this->
size().width());
3704 paragraph->paint(canvas, 0, 0);
3705 auto width = paragraph->getLongestLine();
3706 auto height = paragraph->getHeight();
3708 auto f1Pos = paragraph->getGlyphPositionAtCoordinate(
width/3 * 0 + 5,
height/2);
3709 auto f2Pos = paragraph->getGlyphPositionAtCoordinate(
width/3 * 1 + 5,
height/2);
3710 auto iPos = paragraph->getGlyphPositionAtCoordinate(
width/3 * 2 + 5,
height/2);
3716 auto f1 = paragraph->getRectsForRange(0, 1, RectHeightStyle::kTight,
3717 RectWidthStyle::kTight);
3722 SkDebugf(
"f1: [%f:%f] %s\n", rf1.rect.fLeft, rf1.rect.fRight,
3723 rf1.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3726 auto f2 = paragraph->getRectsForRange(1, 2, RectHeightStyle::kTight,
3727 RectWidthStyle::kTight);
3732 SkDebugf(
"f2: [%f:%f] %s\n", rf2.rect.fLeft, rf2.rect.fRight,
3733 rf2.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3736 auto fi = paragraph->getRectsForRange(2, 3, RectHeightStyle::kTight,
3737 RectWidthStyle::kTight);
3742 SkDebugf(
"i: [%f:%f] %s\n", rfi.rect.fLeft, rfi.rect.fRight,
3743 rfi.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3750class ParagraphSlide_MultiStyle_EmojiFamily :
public ParagraphSlide_Base {
3752 ParagraphSlide_MultiStyle_EmojiFamily() {
fName =
SkString(
"ParagraphSlide_MultiStyle_EmojiFamily"); }
3758 auto fontCollection = sk_make_sp<FontCollection>();
3760 fontCollection->enableFontFallback();
3768 builder.pushStyle(text_style);
3769 builder.addText(u
"\U0001F468\u200D\U0001F469\u200D\U0001F467\u200D\U0001F466");
3770 auto paragraph =
builder.Build();
3771 paragraph->layout(this->
size().width());
3774 paint.setAntiAlias(
true);
3775 paint.setStrokeWidth(1);
3778 paragraph->paint(canvas, 0, 0);
3779 auto width = paragraph->getLongestLine();
3780 auto height = paragraph->getHeight();
3782 auto pos00 = paragraph->getGlyphPositionAtCoordinate(
width/4,
height/4);
3783 auto pos10 = paragraph->getGlyphPositionAtCoordinate(
width*3/4,
height/2);
3784 auto pos01 = paragraph->getGlyphPositionAtCoordinate(
width/4,
height/2);
3785 auto pos11 = paragraph->getGlyphPositionAtCoordinate(
width*3/4,
height*3/4);
3786 SkDebugf(
"%d(%s) %d(%s) %d(%s) %d(%s)\n",
3792 auto f1 = paragraph->getRectsForRange(0, 2, RectHeightStyle::kTight,
3793 RectWidthStyle::kTight);
3798 SkDebugf(
"f1: [%f:%f] %s\n", rf1.rect.fLeft, rf1.rect.fRight,
3799 rf1.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3802 auto f2 = paragraph->getRectsForRange(4, 6, RectHeightStyle::kTight,
3803 RectWidthStyle::kTight);
3808 SkDebugf(
"f2: [%f:%f] %s\n", rf2.rect.fLeft, rf2.rect.fRight,
3809 rf2.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3812 auto f3 = paragraph->getRectsForRange(8, 10, RectHeightStyle::kTight,
3813 RectWidthStyle::kTight);
3818 SkDebugf(
"i: [%f:%f] %s\n", rf3.rect.fLeft, rf3.rect.fRight,
3819 rf3.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3822 auto f4 = paragraph->getRectsForRange(8, 10, RectHeightStyle::kTight,
3823 RectWidthStyle::kTight);
3828 SkDebugf(
"i: [%f:%f] %s\n", rf4.rect.fLeft, rf4.rect.fRight,
3829 rf4.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3836class ParagraphSlide_MultiStyle_Arabic1 :
public ParagraphSlide_Base {
3838 ParagraphSlide_MultiStyle_Arabic1() {
fName =
"SkStringParagraphSlide_MultiStyle_Arabic1"; }
3842 auto fontCollection = getFontCollection();
3844 fontCollection->enableFontFallback();
3854 builder.pushStyle(text_style);
3857 builder.pushStyle(text_style);
3860 builder.pushStyle(text_style);
3862 auto paragraph =
builder.Build();
3863 paragraph->layout(this->
size().
width());
3864 paragraph->paint(canvas, 0, 0);
3866 auto width = paragraph->getLongestLine();
3867 auto height = paragraph->getHeight();
3869 auto f1Pos = paragraph->getGlyphPositionAtCoordinate(
width/6,
height/2);
3870 auto f2Pos = paragraph->getGlyphPositionAtCoordinate(
width/2,
height/2);
3871 auto iPos = paragraph->getGlyphPositionAtCoordinate(
width*5/6,
height/2);
3877 auto f1 = paragraph->getRectsForRange(0, 1, RectHeightStyle::kTight,
3878 RectWidthStyle::kTight);
3883 SkDebugf(
"f1: [%f:%f] %s\n", rf1.rect.fLeft, rf1.rect.fRight,
3884 rf1.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3887 auto f2 = paragraph->getRectsForRange(1, 2, RectHeightStyle::kTight,
3888 RectWidthStyle::kTight);
3893 SkDebugf(
"f2: [%f:%f] %s\n", rf2.rect.fLeft, rf2.rect.fRight,
3894 rf2.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3897 auto fi = paragraph->getRectsForRange(2, 3, RectHeightStyle::kTight,
3898 RectWidthStyle::kTight);
3903 SkDebugf(
"i: [%f:%f] %s\n", rfi.rect.fLeft, rfi.rect.fRight,
3904 rfi.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3911class ParagraphSlide_MultiStyle_Zalgo :
public ParagraphSlide_Base {
3913 ParagraphSlide_MultiStyle_Zalgo() {
fName =
SkString(
"ParagraphSlide_MultiStyle_Zalgo"); }
3919 std::u16string
text = u
">S͛ͭ̋͆̈̔̇͗̍͑̎ͪͮͧͣ̽ͫͣ́ͬ̀͌͑͂͗͒̍̔̄ͧ̏̉̌̊̊̿̀̌̃̄͐̓̓̚̚҉̵̡͜͟͝͠͏̸̵̡̧͜҉̷̡͇̜̘̻̺̘̟̝͙̬̘̩͇̭̼̥̖̤̦͎k͉̩̘͚̜̹̗̗͍̤̥̱͉̳͕͖̤̲̣͚̮̞̬̲͍͔̯̻̮̞̭͈̗̫͓̂ͨ̉ͪ̒͋͛̀̍͊ͧ̿̅͆̓̔̔ͬ̇̑̿ͩ͗ͮ̎͌̿̄ͅP̴̵̡̡̛̪͙̼̣̟̩̭̫̱͙̬͔͉͍̘̠͉̦̝̘̥̟̗͖̫̤͕̙̬̦͍̱̖̮̱͑͐̎̃̒͐͋̚͘͞a̶̶̵̵̵̶̶̡̧̢̢̺͔̣͖̭̺͍̤͚̱̜̰̥͕̬̥̲̞̥̘͇͚̺̰͚̪̺͔̤͍̓̿͆̎͋̓ͦ̈́ͦ̌́̄͗̌̓͌̕͜͜͟͢͝͡ŕ͎̝͕͉̻͎̤̭͚̗̳̖̙̘͚̫͖͓͚͉͔͈̟̰̟̬̗͓̟͚̱̕͡ͅͅͅa̸̶̢̛̛̽ͮͩ̅͒ͫ͗͂̎ͦ̈́̓̚͘͜͢͡҉̷̵̶̢̡̜̮̦̜̥̜̯̙͓͔̼̗̻͜͜ͅḡ̢̛͕̗͖̖̤̦̘͔ͨͨ̊͒ͩͭͤ̍̅̃ͪ̋̏̓̍̋͗̋ͨ̏̽̈́̔̀̋̉ͫ̅̂ͭͫ̏͒͋ͥ̚͜r̶̢̧̧̥̤̼̀̂̒ͪ͌̿͌̅͛ͨͪ͒̍ͥ̉ͤ̌̿̆́ͭ͆̃̒ͤ͛̊ͧ̽͘͝͠a̧̢̧̢͑͑̓͑ͮ̃͂̄͛́̈́͋̂͌̽̄͒̔́̇ͨͧͭ͐ͦ̋ͨ̍ͦ̍̋͆̔ͧ͑͋͌̈̓͛͛̚͢͜͜͏̴̢̧̛̳͍̹͚̰̹̻͔p̨̡͆ͦͣ͊̽̔͂̉ͣ̔ͣ̌̌̉̃̋̂͒ͫ̄̎̐͗̉̌̃̽̽́̀̚͘͜͟҉̱͉h̭̮̘̗͔̜̯͔͈̯̺͔̗̣̭͚̱̰̙̼̹͚̣̻̥̲̮͍̤͜͝<";
3920 auto K =
text.find(u
"k");
3921 auto P =
text.find(u
"P");
3922 auto h =
text.find(u
"h");
3923 auto fontCollection = sk_make_sp<FontCollection>();
3925 fontCollection->enableFontFallback();
3932 builder.pushStyle(text_style);
3936 builder.pushStyle(text_style);
3937 builder.addText(std::u16string(
text.data() +
K + 3,
P -
K - 3 + 6));
3939 builder.pushStyle(text_style);
3943 builder.pushStyle(text_style);
3945 auto paragraph =
builder.Build();
3946 paragraph->layout(this->
size().width());
3947 paragraph->paint(canvas, 0, 0);
3948 auto height = paragraph->getHeight();
3950 auto resSK = paragraph->getRectsForRange(0,
K, RectHeightStyle::kTight,
3951 RectWidthStyle::kTight);
3953 if (resSK.empty()) {
3957 SkDebugf(
"rectSk: [%f:%f] %s\n", rectSK.rect.fLeft, rectSK.rect.fRight,
3958 rectSK.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3961 auto resKP = paragraph->getRectsForRange(
K,
P, RectHeightStyle::kTight,
3962 RectWidthStyle::kTight);
3964 if (resKP.empty()) {
3968 SkDebugf(
"rectkP: [%f:%f] %s\n", rectKP.rect.fLeft, rectKP.rect.fRight,
3969 rectKP.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3972 auto resPh = paragraph->getRectsForRange(
P,
h, RectHeightStyle::kTight,
3973 RectWidthStyle::kTight);
3975 if (resPh.empty()) {
3979 SkDebugf(
"rectPh: [%f:%f] %s\n", rectPh.rect.fLeft, rectPh.rect.fRight,
3980 rectPh.direction == TextDirection::kRtl ?
"rtl" :
"ltr");
3982 auto posK = paragraph->getGlyphPositionAtCoordinate(rectSK.rect.center().fX,
height/2);
3983 auto posP = paragraph->getGlyphPositionAtCoordinate(rectKP.rect.center().fX,
height/2);
3984 auto posH = paragraph->getGlyphPositionAtCoordinate(rectPh.rect.center().fX,
height/2);
3994class ParagraphSlide_MultiStyle_Arabic2 :
public ParagraphSlide_Base {
3996 ParagraphSlide_MultiStyle_Arabic2() {
fName =
SkString(
"ParagraphSlide_MultiStyle_Arabic2"); }
3999 auto fontCollection = getFontCollection();
4001 fontCollection->enableFontFallback();
4011 builder.pushStyle(text_style);
4012 builder.addText(u
"\u062c\u064e\u0627\u0653");
4014 builder.pushStyle(text_style);
4015 builder.addText(u
"\u064e\u0647\u064f");
4016 auto paragraph =
builder.Build();
4017 paragraph->layout(this->
size().
width());
4018 paragraph->paint(canvas, 0, 0);
4022class ParagraphSlideMixedTextDirection :
public ParagraphSlide_Base {
4024 ParagraphSlideMixedTextDirection() {
fName =
"ParagraphSlideMixedTextDirection"; }
4027 auto fontCollection = getFontCollection();
4029 fontCollection->enableFontFallback();
4042 builder.pushStyle(text_style);
4044 auto paragraph =
builder.Build();
4045 paragraph->layout(this->
size().
width());
4046 paragraph->paint(canvas, 0, 0);
4047 canvas->
translate(0, paragraph->getHeight() + 10);
4050 draw(u
"English text (defalt LTR)", 1, TextDirection::kLtr);
4051 draw(u
"English text (defalt RTL)", 1, TextDirection::kRtl);
4052 draw(u
"تظاهرات و(defalt LTR) تجمعات اعتراضی در سراسر کشور ۲۳ مهر", 2, TextDirection::kLtr);
4053 draw(u
"تظاهرات و(defalt RTL) تجمعات اعتراضی در سراسر کشور ۲۳ مهر", 2, TextDirection::kRtl);
4057class ParagraphSlideGetPath :
public ParagraphSlide_Base {
4059 ParagraphSlideGetPath() {
fName =
"ParagraphSlideGetPath"; }
4062 auto fontCollection = getFontCollection();
4064 fontCollection->enableFontFallback();
4074 builder.pushStyle(text_style);
4075 builder.addText(
"Multi lined sticky notes drawn as paths");
4076 auto paragraph =
builder.Build();
4077 paragraph->layout(this->
size().
width());
4082 for (
auto&
line : impl->lines()) {
4083 line.ensureTextBlobCachePopulated();
4084 for (
auto& rec :
line.fTextBlobCache) {
4085 auto paths = Paragraph::GetPath(rec.fBlob.get());
4098class ParagraphSlideExperiment :
public ParagraphSlide_Base {
4100 ParagraphSlideExperiment() {
fName =
"ParagraphSlideExperiment"; }
4103 auto fontCollection = getFontCollection();
4105 fontCollection->disableFontFallback();
4116 builder.pushStyle(text_style);
4117 builder.addText(
"Sticky notes\non multple lines\nwith bounds around glyphs");
4118 auto paragraph =
builder.Build();
4119 paragraph->layout(this->
size().
width());
4120 paragraph->paint(canvas, 0, 0);
4127 paint.setAntiAlias(
true);
4128 paint.setStrokeWidth(1);
4129 for (
auto i = 0;
i <
info->count; ++
i) {
4137 canvas->
translate(0, paragraph->getHeight() + 20);
4142 builder.pushStyle(text_style);
4143 builder.addText(
"Sticky notes with glyphs changing position");
4144 auto paragraph =
builder.Build();
4145 paragraph->layout(this->
size().
width());
4146 paragraph->paint(canvas, 0, 0);
4152 for (
auto i = 0;
i <
info->count; ++
i) {
4156 }
else if (
i % 3 == 1) {
4163 paragraph->paint(canvas, 0, 0);
4164 canvas->
translate(0, paragraph->getHeight() + 40);
4169 builder.pushStyle(text_style);
4170 builder.addText(
"Multi 😀 lined sticky notes drawn as paths");
4171 auto paragraph =
builder.Build();
4172 paragraph->layout(300);
4174 std::vector<LineMetrics> metrics;
4175 paragraph->getLineMetrics(metrics);
4177 for (
size_t lineNum = 0; lineNum < paragraph->lineNumber(); ++lineNum) {
4179 paragraph->getPath(lineNum, &paths);
4180 auto&
line = metrics[lineNum];
4190class ParagraphSlideGlyphs :
public ParagraphSlide_Base {
4192 ParagraphSlideGlyphs() {
fName =
"ParagraphSlideGlyphs"; }
4196 const char* text1 =
"World domination is such an ugly phrase - I prefer to call it world optimisation";
4198 "左線読設重説切abc後碁給能上目秘使約。満毎冠行 来昼本可 def 必図将発確年。今属場育"
4199 "図情闘陰野高備込制詩西校客。審対江置講今固残必託地集済決維駆年策。立得庭"
4200 "際輝求佐抗蒼提夜合逃表。注統天言件自謙雅載報紙喪。作画稿愛器灯女書利変探"
4201 "訃第金線朝開化建。子戦年帝励害表月幕株漠新期刊人秘。図的海力生禁挙保天戦"
4203 const char* text3 =
"من أسر وإعلان الخاصّة وهولندا،, عل def قائمة الضغوط بالمabcطالبة تلك. الصفحة "
4204 "بمباركة التقليدية قام عن. تصفح";
4205 auto fontCollection = sk_make_sp<FontCollection>();
4207 fontCollection->enableFontFallback();
4219 builder.pushStyle(text_style);
4222 auto paragraph =
builder.Build();
4223 paragraph->layout(this->
size().width());
4224 paragraph->paint(canvas, 0, 0);
4225 canvas->
translate(0, paragraph->getHeight() + 20);
4228 draw(text1, TextDirection::kLtr);
4229 draw(text2, TextDirection::kLtr);
4230 draw(text3, TextDirection::kLtr);
4235class ParagraphSlideEllipsisInRTL :
public ParagraphSlide_Base {
4237 ParagraphSlideEllipsisInRTL() {
fName =
"ParagraphSlideEllipsisInRTL"; }
4240 auto fontCollection = getFontCollection();
4242 fontCollection->enableFontFallback();
4251 auto draw = [&](
const std::u16string&
text) {
4254 builder.pushStyle(text_style);
4256 auto paragraph =
builder.Build();
4257 paragraph->layout(this->
size().
width());
4258 paragraph->paint(canvas, 0, 0);
4259 canvas->
translate(0, paragraph->getHeight() + 10);
4262 draw(u
"你abcdefsdasdsasas");
4263 draw(u
"한111111111111111111");
4264 draw(u
"abcdefsdasds1112222");
4268class ParagraphSlideEmojiSequence :
public ParagraphSlide_Base {
4270 ParagraphSlideEmojiSequence() {
fName =
"ParagraphSlideEmojiSequence"; }
4273 auto fontCollection = sk_make_sp<FontCollection>();
4275 fontCollection->enableFontFallback();
4283 auto test = [&](
const char*
text) {
4285 builder.pushStyle(text_style);
4287 auto paragraph =
builder.Build();
4288 paragraph->layout(this->
size().
width());
4289 paragraph->paint(canvas, 0, 0);
4293 for (
auto&
run: impl->runs()) {
4295 run.font().getTypeface()->getFamilyName(&ff);
4324class ParagraphSlideWordSpacing :
public ParagraphSlide_Base {
4326 ParagraphSlideWordSpacing() {
fName =
"ParagraphWordSpacing"; }
4331 auto fontCollection = sk_make_sp<FontCollection>();
4333 fontCollection->enableFontFallback();
4345 builder.pushStyle(text_style);
4348 auto paragraph =
builder.Build();
4349 paragraph->layout(this->
size().
width());
4350 paragraph->paint(canvas, 0, 0);
4351 canvas->
translate(0, paragraph->getHeight() + 20);
4354 draw(TextDirection::kLtr, 20,
"Lorem ipsum dolor sit amet");
4355 draw(TextDirection::kRtl, 20,
"Lorem ipsum dolor sit amet");
4357 draw(TextDirection::kLtr, 20,
"טקסט ללא רווח בין מילים");
4358 draw(TextDirection::kRtl, 20,
"טקסט ללא רווח בין מילים");
4360 draw(TextDirection::kLtr, 20,
"نص مع عدم وجود مسافات بين الكلمات");
4361 draw(TextDirection::kRtl, 20,
"نص مع عدم وجود مسافات بين الكلمات");
4365class ParagraphSlideLast :
public ParagraphSlide_Base {
4367 ParagraphSlideLast() {
fName =
"ParagraphSlideLast"; }
4370 auto fontCollection = sk_make_sp<FontCollection>();
4372 fontCollection->enableFontFallback();
4380 auto test = [&](
const char*
text) {
4382 builder.pushStyle(text_style);
4384 auto paragraph =
builder.Build();
4385 paragraph->layout(this->
size().
width());
4386 paragraph->paint(canvas, 0, 0);
4390 for (
auto&
run: impl->runs()) {
4392 run.font().getTypeface()->getFamilyName(&ff);
4413DEF_SLIDE(
return new ParagraphSlide10();)
4414DEF_SLIDE(
return new ParagraphSlide11();)
4415DEF_SLIDE(
return new ParagraphSlide12();)
4416DEF_SLIDE(
return new ParagraphSlide14();)
4417DEF_SLIDE(
return new ParagraphSlide15();)
4418DEF_SLIDE(
return new ParagraphSlide16();)
4419DEF_SLIDE(
return new ParagraphSlide17();)
4420DEF_SLIDE(
return new ParagraphSlide18();)
4421DEF_SLIDE(
return new ParagraphSlide19();)
4422DEF_SLIDE(
return new ParagraphSlide20();)
4423DEF_SLIDE(
return new ParagraphSlide21();)
4424DEF_SLIDE(
return new ParagraphSlide22();)
4425DEF_SLIDE(
return new ParagraphSlide23();)
4426DEF_SLIDE(
return new ParagraphSlide24();)
4427DEF_SLIDE(
return new ParagraphSlide25();)
4428DEF_SLIDE(
return new ParagraphSlide26();)
4429DEF_SLIDE(
return new ParagraphSlide27();)
4430DEF_SLIDE(
return new ParagraphSlide28();)
4431DEF_SLIDE(
return new ParagraphSlide29();)
4432DEF_SLIDE(
return new ParagraphSlide30();)
4433DEF_SLIDE(
return new ParagraphSlide31();)
4434DEF_SLIDE(
return new ParagraphSlide32();)
4435DEF_SLIDE(
return new ParagraphSlide33();)
4436DEF_SLIDE(
return new ParagraphSlide34();)
4437DEF_SLIDE(
return new ParagraphSlide35();)
4438DEF_SLIDE(
return new ParagraphSlide36();)
4439DEF_SLIDE(
return new ParagraphSlide37();)
4440DEF_SLIDE(
return new ParagraphSlide38();)
4441DEF_SLIDE(
return new ParagraphSlide39();)
4442DEF_SLIDE(
return new ParagraphSlide41();)
4443DEF_SLIDE(
return new ParagraphSlide42();)
4444DEF_SLIDE(
return new ParagraphSlide43();)
4445DEF_SLIDE(
return new ParagraphSlide44();)
4446DEF_SLIDE(
return new ParagraphSlide45();)
4447DEF_SLIDE(
return new ParagraphSlide46();)
4448DEF_SLIDE(
return new ParagraphSlide47();)
4449DEF_SLIDE(
return new ParagraphSlide48();)
4450DEF_SLIDE(
return new ParagraphSlide49();)
4451DEF_SLIDE(
return new ParagraphSlide50();)
4452DEF_SLIDE(
return new ParagraphSlide51();)
4453DEF_SLIDE(
return new ParagraphSlide52();)
4454DEF_SLIDE(
return new ParagraphSlide53();)
4455DEF_SLIDE(
return new ParagraphSlide54();)
4456DEF_SLIDE(
return new ParagraphSlide55();)
4457DEF_SLIDE(
return new ParagraphSlide56();)
4458DEF_SLIDE(
return new ParagraphSlide57();)
4459DEF_SLIDE(
return new ParagraphSlide58();)
4460DEF_SLIDE(
return new ParagraphSlide59();)
4461DEF_SLIDE(
return new ParagraphSlide60();)
4462DEF_SLIDE(
return new ParagraphSlide61();)
4463DEF_SLIDE(
return new ParagraphSlide62();)
4464DEF_SLIDE(
return new ParagraphSlide63();)
4465DEF_SLIDE(
return new ParagraphSlide64();)
4466DEF_SLIDE(
return new ParagraphSlide66();)
4467DEF_SLIDE(
return new ParagraphSlide67();)
4468DEF_SLIDE(
return new ParagraphSlide68();)
4469DEF_SLIDE(
return new ParagraphSlide_MultiStyle_Logo();)
4470DEF_SLIDE(
return new ParagraphSlide_MultiStyle_FFI();)
4471DEF_SLIDE(
return new ParagraphSlide_MultiStyle_EmojiFamily();)
4472DEF_SLIDE(
return new ParagraphSlide_MultiStyle_Arabic1();)
4473DEF_SLIDE(
return new ParagraphSlide_MultiStyle_Zalgo();)
4474DEF_SLIDE(
return new ParagraphSlide_MultiStyle_Arabic2();)
4475DEF_SLIDE(
return new ParagraphSlideMixedTextDirection();)
4476DEF_SLIDE(
return new ParagraphSlideGetPath();)
4477DEF_SLIDE(
return new ParagraphSlideExperiment();)
4478DEF_SLIDE(
return new ParagraphSlideGlyphs();)
4479DEF_SLIDE(
return new ParagraphSlideEllipsisInRTL();)
4480DEF_SLIDE(
return new ParagraphSlideEmojiSequence();)
4481DEF_SLIDE(
return new ParagraphSlideWordSpacing();)
4482DEF_SLIDE(
return new ParagraphSlideLast();)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static DEFINE_bool(verboseParagraph, false, "paragraph samples very verbose.")
SkString GetResourcePath(const char *resource)
static unsigned mirror(SkFixed fx, int max)
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorLTGRAY
constexpr SkColor SK_ColorMAGENTA
#define SkColorSetRGB(r, g, b)
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
constexpr SkColor SK_ColorDKGRAY
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define SK_ScalarInfinity
sk_sp< SkUnicode > get_unicode()
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
virtual bool onClick(Click *)=0
virtual Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi)=0
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void translate(SkScalar dx, SkScalar dy)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
void clear(SkColor color)
void drawPath(const SkPath &path, const SkPaint &paint)
static sk_sp< SkData > MakeFromFileName(const char path[])
static constexpr SkFontStyle Bold()
static constexpr SkFontStyle Normal()
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
void setStrokeWidth(SkScalar width)
SkPath & addPath(const SkPath &src, SkScalar dx, SkScalar dy, AddPathMode mode=kAppend_AddPathMode)
const char * c_str() const
virtual void resize(SkScalar winWidth, SkScalar winHeight)
virtual void load(SkScalar winWidth, SkScalar winHeight)
SkSpan< Cluster > clusters()
void setDecorationStyle(TextDecorationStyle style)
void addShadow(TextShadow shadow)
void setFontFamilies(std::vector< SkString > families)
void setHeight(SkScalar height)
void setLetterSpacing(SkScalar letterSpacing)
void setWordSpacing(SkScalar wordSpacing)
void setColor(SkColor color)
void setHeightOverride(bool heightOverride)
void setFontStyle(SkFontStyle fontStyle)
void setBackgroundColor(SkPaint paint)
void setLocale(const SkString &locale)
void setFontSize(SkScalar size)
void setForegroundColor(SkPaint paint)
void setDecorationColor(SkColor color)
void setDecoration(TextDecoration decoration)
void setDecorationMode(TextDecorationMode mode)
void setDecorationThicknessMultiplier(SkScalar m)
static float max(float r, float g, float b)
constexpr SkColor4f kLtGray
constexpr SkColor4f kMagenta
constexpr SkColor4f kGreen
constexpr SkColor4f kWhite
constexpr SkColor4f kCyan
constexpr SkColor4f kBlack
constexpr SkColor4f kGray
constexpr SkColor4f kBlue
constexpr SkColor4f kYellow
sk_sp< SkBlender > blender SkRect rect
PODArray< SkColor > colors
sk_sp< Factory > BestAvailable()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port fallback
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
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
it will be possible to load the file into Perfetto s trace viewer disable asset fonts
font
Font Metadata and Metrics.
const myers::Point & get< 1 >(const myers::Segment &s)
const myers::Point & get< 0 >(const myers::Segment &s)
static void make(SkBitmap *bitmap, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace)
static SkString to_string(int n)
SkScalar fAscent
distance to reserve above baseline, typically negative
SkScalar fDescent
distance to reserve below baseline, typically positive
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeEmpty()
SkScalar fLeft
smaller x-axis bounds
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkScalar fRight
larger x-axis bounds
static constexpr SkRect MakeWH(float w, float h)
SkScalar fTop
smaller y-axis bounds
void setEllipsis(const std::u16string &ellipsis)
void setTextDirection(TextDirection direction)
void setTextStyle(const TextStyle &textStyle)
void setMaxLines(size_t maxLines)
void setHeight(SkScalar height)
void setStrutStyle(StrutStyle strutStyle)
void setTextHeightBehavior(TextHeightBehavior v)
void setTextAlign(TextAlign align)
PlaceholderAlignment fAlignment
void setFontFamilies(std::vector< SkString > families)
void setHeight(SkScalar height)
void setStrutEnabled(bool v)
void setForceStrutHeight(bool v)
void setHeightOverride(bool v)
void setFontSize(SkScalar size)
std::shared_ptr< const fml::Mapping > data