26 FontStyleSet(
const char* familyName) : fFamilyName(familyName) {}
27 struct TypefaceEntry {
29 : fTypeface(
std::move(typeface)),
fStyle(style), fStyleName(styleName) {}
32 const char* fStyleName;
35 int count()
override {
return fTypefaces.size(); }
39 *style = fTypefaces[index].fStyle;
42 *
name = fTypefaces[index].fStyleName;
47 return fTypefaces[index].fTypeface;
54 SkString getFamilyName() {
return fFamilyName; }
56 std::vector<TypefaceEntry> fTypefaces;
64 for (
auto&& family : list.families) {
65 auto&& ss = fFamilies.emplace_back(sk_make_sp<FontStyleSet>(family.name));
66 for (
auto&& face : family.faces) {
67 ss->fTypefaces.emplace_back(face.typeface, face.typeface->fontStyle(), face.name);
70 fDefaultTypeface = face.typeface;
74 if (!fDefaultFamily) {
75 SkASSERTF(
false,
"expected TestTypeface to return a default");
76 fDefaultFamily = fFamilies[0];
77 fDefaultTypeface = fDefaultFamily->fTypefaces[0].fTypeface;
80#if defined(SK_ENABLE_SVG)
81 fFamilies.emplace_back(sk_make_sp<FontStyleSet>(
"Emoji"));
82 fFamilies.back()->fTypefaces.emplace_back(
85 fFamilies.emplace_back(sk_make_sp<FontStyleSet>(
"Planet"));
86 fFamilies.back()->fTypefaces.emplace_back(
94 *familyName = fFamilies[index]->getFamilyName();
104 if (strstr(familyName,
"ono")) {
107 if (strstr(familyName,
"ans")) {
110 if (strstr(familyName,
"erif")) {
113#if defined(SK_ENABLE_SVG)
114 if (strstr(familyName,
"oji")) {
117 if (strstr(familyName,
"Planet")) {
128 return styleSet->matchStyle(style);
144 int ttcIndex)
const override {
157 if (familyName ==
nullptr) {
162 typeface = fDefaultTypeface;
168 std::vector<sk_sp<FontStyleSet>> fFamilies;
SkStrokeRec::Style fStyle
#define SkASSERTF(cond, fmt,...)
sk_sp< SkFontStyleSet > createStyleSet(int index) const
virtual void onGetFamilyName(int index, SkString *familyName) const =0
sk_sp< SkFontStyleSet > matchFamily(const char familyName[]) const
virtual sk_sp< SkTypeface > onMakeFromData(sk_sp< SkData >, int ttcIndex) const =0
virtual sk_sp< SkFontStyleSet > onCreateStyleSet(int index) const =0
virtual sk_sp< SkTypeface > onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const =0
virtual sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const =0
virtual sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset >, int ttcIndex) const =0
virtual sk_sp< SkTypeface > onMakeFromStreamArgs(std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const =0
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
virtual sk_sp< SkTypeface > onMatchFamilyStyle(const char familyName[], const SkFontStyle &) const =0
virtual sk_sp< SkTypeface > onLegacyMakeTypeface(const char familyName[], SkFontStyle) const =0
virtual sk_sp< SkTypeface > onMakeFromFile(const char path[], int ttcIndex) const =0
virtual int onCountFamilies() const =0
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()
static const List & Typefaces()
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