30#include <initializer_list>
75 const char* inNames[] = {
76 "sans",
"sans-serif",
"serif",
"monospace",
"times",
"helvetica"
81 if (
nullptr == first.
get()) {
86 for (
int j = 0; j < 10; ++j) {
92 "Request \"%s\" First Name: \"%s\" Id: %x Received Name \"%s\" Id %x",
110 if (FLAGS_verboseFontMgr) {
114 for (
int j = 0; j <
set->count(); ++j) {
117 set->getStyle(j, &fs, &sname);
119 if (FLAGS_verboseFontMgr) {
187 std::unique_ptr<SkStreamAsset>
onOpenStream(
int* ttcIndex)
const override {
return nullptr; }
208 int onGetUPEM()
const override {
return 0; }
218 return new EmptyLocalizedStrings;
223 int coordinateCount)
const override
228 int parameterCount)
const override
240 TestFontStyleSet(std::initializer_list<SkFontStyle> styles) : fStyles(styles) {}
241 int count()
override {
return static_cast<int>(fStyles.size()); }
244 *style = fStyles[index];
248 if (index < 0 || this->
count() <= index) {
257 std::vector<SkFontStyle> fStyles;
280 struct StyleSetTest {
281 TestFontStyleSet styleSet;
286 std::vector<Case> cases;
289 { normal_normal_500, normal_normal_400 },
291 { normal_normal_400, normal_normal_400 },
292 { normal_normal_500, normal_normal_500 },
297 { normal_normal_500, normal_normal_300 },
299 { normal_normal_300, normal_normal_300 },
300 { normal_normal_400, normal_normal_500 },
301 { normal_normal_500, normal_normal_500 },
306 { condensed_normal_100,condensed_normal_900,condensed_italic_100,condensed_italic_900,
307 expanded_normal_100, expanded_normal_900, expanded_italic_100, expanded_italic_900 },
309 { condensed_normal_100, condensed_normal_100 },
310 { condensed_normal_900, condensed_normal_900 },
311 { condensed_italic_100, condensed_italic_100 },
312 { condensed_italic_900, condensed_italic_900 },
313 { expanded_normal_100, expanded_normal_100 },
314 { expanded_normal_900, expanded_normal_900 },
315 { expanded_italic_100, expanded_italic_100 },
316 { expanded_italic_900, expanded_italic_900 },
321 { condensed_normal_100,condensed_italic_100,expanded_normal_100,expanded_italic_100 },
323 { condensed_normal_100, condensed_normal_100 },
324 { condensed_normal_900, condensed_normal_100 },
325 { condensed_italic_100, condensed_italic_100 },
326 { condensed_italic_900, condensed_italic_100 },
327 { expanded_normal_100, expanded_normal_100 },
328 { expanded_normal_900, expanded_normal_100 },
329 { expanded_italic_100, expanded_italic_100 },
330 { expanded_italic_900, expanded_italic_100 },
335 { condensed_normal_900,condensed_italic_900,expanded_normal_900,expanded_italic_900 },
337 { condensed_normal_100, condensed_normal_900 },
338 { condensed_normal_900, condensed_normal_900 },
339 { condensed_italic_100, condensed_italic_900 },
340 { condensed_italic_900, condensed_italic_900 },
341 { expanded_normal_100, expanded_normal_900 },
342 { expanded_normal_900, expanded_normal_900 },
343 { expanded_italic_100, expanded_italic_900 },
344 { expanded_italic_900, expanded_italic_900 },
349 { condensed_normal_100,condensed_normal_900,expanded_normal_100,expanded_normal_900 },
351 { condensed_normal_100, condensed_normal_100 },
352 { condensed_normal_900, condensed_normal_900 },
353 { condensed_italic_100, condensed_normal_100 },
354 { condensed_italic_900, condensed_normal_900 },
355 { expanded_normal_100, expanded_normal_100 },
356 { expanded_normal_900, expanded_normal_900 },
357 { expanded_italic_100, expanded_normal_100 },
358 { expanded_italic_900, expanded_normal_900 },
363 { condensed_normal_100,expanded_normal_100 },
365 { condensed_normal_100, condensed_normal_100 },
366 { condensed_normal_900, condensed_normal_100 },
367 { condensed_italic_100, condensed_normal_100 },
368 { condensed_italic_900, condensed_normal_100 },
369 { expanded_normal_100, expanded_normal_100 },
370 { expanded_normal_900, expanded_normal_100 },
371 { expanded_italic_100, expanded_normal_100 },
372 { expanded_italic_900, expanded_normal_100 },
377 { condensed_normal_900,expanded_normal_900 },
379 { condensed_normal_100, condensed_normal_900 },
380 { condensed_normal_900, condensed_normal_900 },
381 { condensed_italic_100, condensed_normal_900 },
382 { condensed_italic_900, condensed_normal_900 },
383 { expanded_normal_100, expanded_normal_900 },
384 { expanded_normal_900, expanded_normal_900 },
385 { expanded_italic_100, expanded_normal_900 },
386 { expanded_italic_900, expanded_normal_900 },
391 { condensed_italic_100,condensed_italic_900,expanded_italic_100,expanded_italic_900 },
393 { condensed_normal_100, condensed_italic_100 },
394 { condensed_normal_900, condensed_italic_900 },
395 { condensed_italic_100, condensed_italic_100 },
396 { condensed_italic_900, condensed_italic_900 },
397 { expanded_normal_100, expanded_italic_100 },
398 { expanded_normal_900, expanded_italic_900 },
399 { expanded_italic_100, expanded_italic_100 },
400 { expanded_italic_900, expanded_italic_900 },
405 { condensed_italic_100,expanded_italic_100 },
407 { condensed_normal_100, condensed_italic_100 },
408 { condensed_normal_900, condensed_italic_100 },
409 { condensed_italic_100, condensed_italic_100 },
410 { condensed_italic_900, condensed_italic_100 },
411 { expanded_normal_100, expanded_italic_100 },
412 { expanded_normal_900, expanded_italic_100 },
413 { expanded_italic_100, expanded_italic_100 },
414 { expanded_italic_900, expanded_italic_100 },
419 { condensed_italic_900,expanded_italic_900 },
421 { condensed_normal_100, condensed_italic_900 },
422 { condensed_normal_900, condensed_italic_900 },
423 { condensed_italic_100, condensed_italic_900 },
424 { condensed_italic_900, condensed_italic_900 },
425 { expanded_normal_100, expanded_italic_900 },
426 { expanded_normal_900, expanded_italic_900 },
427 { expanded_italic_100, expanded_italic_900 },
428 { expanded_italic_900, expanded_italic_900 },
433 { condensed_normal_100,condensed_normal_900,condensed_italic_100,condensed_italic_900 },
435 { condensed_normal_100, condensed_normal_100 },
436 { condensed_normal_900, condensed_normal_900 },
437 { condensed_italic_100, condensed_italic_100 },
438 { condensed_italic_900, condensed_italic_900 },
439 { expanded_normal_100, condensed_normal_100 },
440 { expanded_normal_900, condensed_normal_900 },
441 { expanded_italic_100, condensed_italic_100 },
442 { expanded_italic_900, condensed_italic_900 },
447 { condensed_normal_100,condensed_italic_100 },
449 { condensed_normal_100, condensed_normal_100 },
450 { condensed_normal_900, condensed_normal_100 },
451 { condensed_italic_100, condensed_italic_100 },
452 { condensed_italic_900, condensed_italic_100 },
453 { expanded_normal_100, condensed_normal_100 },
454 { expanded_normal_900, condensed_normal_100 },
455 { expanded_italic_100, condensed_italic_100 },
456 { expanded_italic_900, condensed_italic_100 },
461 { condensed_normal_900,condensed_italic_900 },
463 { condensed_normal_100, condensed_normal_900 },
464 { condensed_normal_900, condensed_normal_900 },
465 { condensed_italic_100, condensed_italic_900 },
466 { condensed_italic_900, condensed_italic_900 },
467 { expanded_normal_100, condensed_normal_900 },
468 { expanded_normal_900, condensed_normal_900 },
469 { expanded_italic_100, condensed_italic_900 },
470 { expanded_italic_900, condensed_italic_900 },
475 { condensed_normal_100,condensed_normal_900 },
477 { condensed_normal_100, condensed_normal_100 },
478 { condensed_normal_900, condensed_normal_900 },
479 { condensed_italic_100, condensed_normal_100 },
480 { condensed_italic_900, condensed_normal_900 },
481 { expanded_normal_100, condensed_normal_100 },
482 { expanded_normal_900, condensed_normal_900 },
483 { expanded_italic_100, condensed_normal_100 },
484 { expanded_italic_900, condensed_normal_900 },
489 { condensed_normal_100 },
491 { condensed_normal_100, condensed_normal_100 },
492 { condensed_normal_900, condensed_normal_100 },
493 { condensed_italic_100, condensed_normal_100 },
494 { condensed_italic_900, condensed_normal_100 },
495 { expanded_normal_100, condensed_normal_100 },
496 { expanded_normal_900, condensed_normal_100 },
497 { expanded_italic_100, condensed_normal_100 },
498 { expanded_italic_900, condensed_normal_100 },
503 { condensed_normal_900 },
505 { condensed_normal_100, condensed_normal_900 },
506 { condensed_normal_900, condensed_normal_900 },
507 { condensed_italic_100, condensed_normal_900 },
508 { condensed_italic_900, condensed_normal_900 },
509 { expanded_normal_100, condensed_normal_900 },
510 { expanded_normal_900, condensed_normal_900 },
511 { expanded_italic_100, condensed_normal_900 },
512 { expanded_italic_900, condensed_normal_900 },
517 { condensed_italic_100,condensed_italic_900 },
519 { condensed_normal_100, condensed_italic_100 },
520 { condensed_normal_900, condensed_italic_900 },
521 { condensed_italic_100, condensed_italic_100 },
522 { condensed_italic_900, condensed_italic_900 },
523 { expanded_normal_100, condensed_italic_100 },
524 { expanded_normal_900, condensed_italic_900 },
525 { expanded_italic_100, condensed_italic_100 },
526 { expanded_italic_900, condensed_italic_900 },
531 { condensed_italic_100 },
533 { condensed_normal_100, condensed_italic_100 },
534 { condensed_normal_900, condensed_italic_100 },
535 { condensed_italic_100, condensed_italic_100 },
536 { condensed_italic_900, condensed_italic_100 },
537 { expanded_normal_100, condensed_italic_100 },
538 { expanded_normal_900, condensed_italic_100 },
539 { expanded_italic_100, condensed_italic_100 },
540 { expanded_italic_900, condensed_italic_100 },
545 { condensed_italic_900 },
547 { condensed_normal_100, condensed_italic_900 },
548 { condensed_normal_900, condensed_italic_900 },
549 { condensed_italic_100, condensed_italic_900 },
550 { condensed_italic_900, condensed_italic_900 },
551 { expanded_normal_100, condensed_italic_900 },
552 { expanded_normal_900, condensed_italic_900 },
553 { expanded_italic_100, condensed_italic_900 },
554 { expanded_italic_900, condensed_italic_900 },
559 { expanded_normal_100,expanded_normal_900,
560 expanded_italic_100,expanded_italic_900 },
562 { condensed_normal_100, expanded_normal_100 },
563 { condensed_normal_900, expanded_normal_900 },
564 { condensed_italic_100, expanded_italic_100 },
565 { condensed_italic_900, expanded_italic_900 },
566 { condensed_obliqu_100, expanded_italic_100 },
567 { condensed_obliqu_900, expanded_italic_900 },
568 { expanded_normal_100, expanded_normal_100 },
569 { expanded_normal_900, expanded_normal_900 },
570 { expanded_italic_100, expanded_italic_100 },
571 { expanded_italic_900, expanded_italic_900 },
572 { expanded_obliqu_100, expanded_italic_100 },
573 { expanded_obliqu_900, expanded_italic_900 },
578 { expanded_normal_100,expanded_italic_100 },
580 { condensed_normal_100, expanded_normal_100 },
581 { condensed_normal_900, expanded_normal_100 },
582 { condensed_italic_100, expanded_italic_100 },
583 { condensed_italic_900, expanded_italic_100 },
584 { expanded_normal_100, expanded_normal_100 },
585 { expanded_normal_900, expanded_normal_100 },
586 { expanded_italic_100, expanded_italic_100 },
587 { expanded_italic_900, expanded_italic_100 },
592 { expanded_normal_900,expanded_italic_900 },
594 { condensed_normal_100, expanded_normal_900 },
595 { condensed_normal_900, expanded_normal_900 },
596 { condensed_italic_100, expanded_italic_900 },
597 { condensed_italic_900, expanded_italic_900 },
598 { expanded_normal_100, expanded_normal_900 },
599 { expanded_normal_900, expanded_normal_900 },
600 { expanded_italic_100, expanded_italic_900 },
601 { expanded_italic_900, expanded_italic_900 },
606 { expanded_normal_100,expanded_normal_900 },
608 { condensed_normal_100, expanded_normal_100 },
609 { condensed_normal_900, expanded_normal_900 },
610 { condensed_italic_100, expanded_normal_100 },
611 { condensed_italic_900, expanded_normal_900 },
612 { expanded_normal_100, expanded_normal_100 },
613 { expanded_normal_900, expanded_normal_900 },
614 { expanded_italic_100, expanded_normal_100 },
615 { expanded_italic_900, expanded_normal_900 },
620 { expanded_normal_100 },
622 { condensed_normal_100, expanded_normal_100 },
623 { condensed_normal_900, expanded_normal_100 },
624 { condensed_italic_100, expanded_normal_100 },
625 { condensed_italic_900, expanded_normal_100 },
626 { expanded_normal_100, expanded_normal_100 },
627 { expanded_normal_900, expanded_normal_100 },
628 { expanded_italic_100, expanded_normal_100 },
629 { expanded_italic_900, expanded_normal_100 },
634 { expanded_normal_900 },
636 { condensed_normal_100, expanded_normal_900 },
637 { condensed_normal_900, expanded_normal_900 },
638 { condensed_italic_100, expanded_normal_900 },
639 { condensed_italic_900, expanded_normal_900 },
640 { expanded_normal_100, expanded_normal_900 },
641 { expanded_normal_900, expanded_normal_900 },
642 { expanded_italic_100, expanded_normal_900 },
643 { expanded_italic_900, expanded_normal_900 },
648 { expanded_italic_100,expanded_italic_900 },
650 { condensed_normal_100, expanded_italic_100 },
651 { condensed_normal_900, expanded_italic_900 },
652 { condensed_italic_100, expanded_italic_100 },
653 { condensed_italic_900, expanded_italic_900 },
654 { expanded_normal_100, expanded_italic_100 },
655 { expanded_normal_900, expanded_italic_900 },
656 { expanded_italic_100, expanded_italic_100 },
657 { expanded_italic_900, expanded_italic_900 },
662 { expanded_italic_100 },
664 { condensed_normal_100, expanded_italic_100 },
665 { condensed_normal_900, expanded_italic_100 },
666 { condensed_italic_100, expanded_italic_100 },
667 { condensed_italic_900, expanded_italic_100 },
668 { expanded_normal_100, expanded_italic_100 },
669 { expanded_normal_900, expanded_italic_100 },
670 { expanded_italic_100, expanded_italic_100 },
671 { expanded_italic_900, expanded_italic_100 },
676 { expanded_italic_900 },
678 { condensed_normal_100, expanded_italic_900 },
679 { condensed_normal_900, expanded_italic_900 },
680 { condensed_italic_100, expanded_italic_900 },
681 { condensed_italic_900, expanded_italic_900 },
682 { expanded_normal_100, expanded_italic_900 },
683 { expanded_normal_900, expanded_italic_900 },
684 { expanded_italic_100, expanded_italic_900 },
685 { expanded_italic_900, expanded_italic_900 },
690 { normal_normal_100, normal_normal_900 },
692 { normal_normal_300, normal_normal_100 },
693 { normal_normal_400, normal_normal_100 },
694 { normal_normal_500, normal_normal_100 },
695 { normal_normal_600, normal_normal_900 },
700 { normal_normal_100, normal_normal_400, normal_normal_900 },
702 { normal_normal_300, normal_normal_100 },
703 { normal_normal_400, normal_normal_400 },
704 { normal_normal_500, normal_normal_400 },
705 { normal_normal_600, normal_normal_900 },
710 { normal_normal_100, normal_normal_500, normal_normal_900 },
712 { normal_normal_300, normal_normal_100 },
713 { normal_normal_400, normal_normal_500 },
714 { normal_normal_500, normal_normal_500 },
715 { normal_normal_600, normal_normal_900 },
722 { normal_normal_300, invalidFontStyle },
723 { normal_normal_400, invalidFontStyle },
724 { normal_normal_500, invalidFontStyle },
725 { normal_normal_600, invalidFontStyle },
729 { expanded_normal_100,expanded_normal_900,
730 expanded_italic_100,expanded_italic_900,
731 expanded_obliqu_100,expanded_obliqu_900, },
733 { condensed_normal_100, expanded_normal_100 },
734 { condensed_normal_900, expanded_normal_900 },
735 { condensed_italic_100, expanded_italic_100 },
736 { condensed_italic_900, expanded_italic_900 },
737 { condensed_obliqu_100, expanded_obliqu_100 },
738 { condensed_obliqu_900, expanded_obliqu_900 },
739 { expanded_normal_100, expanded_normal_100 },
740 { expanded_normal_900, expanded_normal_900 },
741 { expanded_italic_100, expanded_italic_100 },
742 { expanded_italic_900, expanded_italic_900 },
743 { expanded_obliqu_100, expanded_obliqu_100 },
744 { expanded_obliqu_900, expanded_obliqu_900 },
748 { expanded_normal_100,expanded_normal_900,
749 expanded_obliqu_100,expanded_obliqu_900, },
751 { condensed_normal_100, expanded_normal_100 },
752 { condensed_normal_900, expanded_normal_900 },
753 { condensed_italic_100, expanded_obliqu_100 },
754 { condensed_italic_900, expanded_obliqu_900 },
755 { condensed_obliqu_100, expanded_obliqu_100 },
756 { condensed_obliqu_900, expanded_obliqu_900 },
757 { expanded_normal_100, expanded_normal_100 },
758 { expanded_normal_900, expanded_normal_900 },
759 { expanded_italic_100, expanded_obliqu_100 },
760 { expanded_italic_900, expanded_obliqu_900 },
761 { expanded_obliqu_100, expanded_obliqu_100 },
762 { expanded_obliqu_900, expanded_obliqu_900 },
766 { expanded_italic_100,expanded_italic_900,
767 expanded_obliqu_100,expanded_obliqu_900, },
769 { condensed_normal_100, expanded_obliqu_100 },
770 { condensed_normal_900, expanded_obliqu_900 },
771 { condensed_italic_100, expanded_italic_100 },
772 { condensed_italic_900, expanded_italic_900 },
773 { condensed_obliqu_100, expanded_obliqu_100 },
774 { condensed_obliqu_900, expanded_obliqu_900 },
775 { expanded_normal_100, expanded_obliqu_100 },
776 { expanded_normal_900, expanded_obliqu_900 },
777 { expanded_italic_100, expanded_italic_100 },
778 { expanded_italic_900, expanded_italic_900 },
779 { expanded_obliqu_100, expanded_obliqu_100 },
780 { expanded_obliqu_900, expanded_obliqu_900 },
786 for (
const StyleSetTest::Case& testCase :
test.cases) {
sk_bzero(glyphs, sizeof(glyphs))
const SkFont newFont(font.makeWithSize(36))
DECLARE_bool(verboseFontMgr) DEF_TEST(FontMgr_Font
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
REPORTER_ASSERT(reporter, 24==font.getSize())
DEF_TEST(FontMgr_AliasNames, reporter)
static float next(float f)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
@ kUTF8
uses bytes to represent UTF-8 or ASCII
sk_sp< T > sk_ref_sp(T *obj)
sk_sp< SkFontStyleSet > createStyleSet(int index) const
sk_sp< SkTypeface > matchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const
void getFamilyName(int index, SkString *familyName) const
sk_sp< SkFontStyleSet > matchFamily(const char familyName[]) const
int countFamilies() const
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
sk_sp< SkTypeface > matchStyleCSS3(const SkFontStyle &pattern)
virtual sk_sp< SkTypeface > createTypeface(int index)=0
virtual sk_sp< SkTypeface > matchStyle(const SkFontStyle &pattern)=0
virtual void getStyle(int index, SkFontStyle *, SkString *style)=0
static constexpr SkFontStyle Normal()
SkTypeface * getTypeface() const
static std::unique_ptr< SkScalerContext > MakeEmpty(sk_sp< SkTypeface > typeface, const SkScalerContextEffects &effects, const SkDescriptor *desc)
const char * c_str() const
SkTypefaceID uniqueID() const
void getFamilyName(SkString *name) const
SkFontStyle fontStyle() const
SkTypeface(const SkFontStyle &style, bool isFixedPitch=false)
void getGlyphToUnicodeMap(SkUnichar *glyphToUnicode) const override
bool onGlyphMaskNeedsCurrentColor() const override
void onCharsToGlyphs(const SkUnichar *chars, int count, SkGlyphID glyphs[]) const override
int onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const override
SkTypeface::LocalizedStrings * onCreateFamilyNameIterator() const override
int onGetUPEM() const override
void getPostScriptGlyphNames(SkString *) const override
bool onGetPostScriptName(SkString *) const override
std::unique_ptr< SkAdvancedTypefaceMetrics > onGetAdvancedMetrics() const override
void onGetFamilyName(SkString *familyName) const override
int onGetVariationDesignParameters(SkFontParameters::Variation::Axis parameters[], int parameterCount) const override
int onGetTableTags(SkFontTableTag tags[]) const override
std::unique_ptr< SkStreamAsset > onOpenStream(int *ttcIndex) const override
size_t onGetTableData(SkFontTableTag tag, size_t offset, size_t length, void *data) const override
std::unique_ptr< SkScalerContext > onCreateScalerContext(const SkScalerContextEffects &, const SkDescriptor *desc) const override
void onFilterRec(SkScalerContextRec *rec) const override
sk_sp< SkTypeface > onMakeClone(const SkFontArguments &args) const override
int onCountGlyphs() const override
void onGetFontDescriptor(SkFontDescriptor *desc, bool *serialize) const override
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
DEF_SWITCHES_START aot vmservice shared library name
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
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 set
font
Font Metadata and Metrics.