29 bool sysFont,
SkString familyName,
int index)
31 , fIsSysFont(sysFont), fFamilyName(
std::move(familyName)), fIndex(index)
37 *familyName = fFamilyName;
41 desc->setFamilyName(fFamilyName.
c_str());
61 SkString familyName,
const char path[],
int index)
62 :
INHERITED(style, isFixedPitch, sysFont,
std::move(familyName), index)
73 std::unique_ptr<SkFontData> data = this->
cloneFontData(args, &style);
81 return sk_make_sp<SkTypeface_FreeTypeStream>(
82 std::move(data), familyName, style, this->
isFixedPitch());
87 std::unique_ptr<SkStreamAsset> stream(this->
onOpenStream(&index));
91 return std::make_unique<SkFontData>(std::move(stream), index, 0,
nullptr, 0,
nullptr, 0);
97 : fFamilyName(
std::move(familyName)) {}
104 return fStyles.
size();
110 *style = fStyles[index]->fontStyle();
119 return fStyles[index];
129 : fDefaultFamily(nullptr)
135 static const char* defaultNames[] = {
136 "Arial",
"Verdana",
"Times New Roman",
"Droid Sans",
"DejaVu Serif",
nullptr
138 for (
size_t i = 0; i < std::size(defaultNames); ++i) {
140 if (
nullptr == set) {
151 fDefaultFamily = set;
154 if (
nullptr == fDefaultFamily) {
155 fDefaultFamily = fFamilies[0];
160 return fFamilies.
size();
170 return fFamilies[index];
174 for (
int i = 0; i < fFamilies.
size(); ++i) {
186 return sset->matchStyle(fontStyle);
191 const char* bcp47[],
int bcp47Count,
198 return this->
makeFromStream(std::make_unique<SkMemoryStream>(std::move(data)), ttcIndex);
202 int ttcIndex)
const {
213 return stream ? this->
makeFromStream(std::move(stream), ttcIndex) :
nullptr;
static bool equals(T *a, T *b)
sk_sp< T > sk_ref_sp(T *obj)
const void * data() const
void setFactoryId(SkTypeface::FactoryId factoryId)
virtual void loadSystemFonts(const SkFontScanner *, Families *) const =0
sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset >, int ttcIndex) const override
int onCountFamilies() const override
sk_sp< SkFontStyleSet > onCreateStyleSet(int index) const override
SkFontMgr_Custom(const SystemFontLoader &loader)
sk_sp< SkTypeface > onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const override
sk_sp< SkTypeface > onMatchFamilyStyle(const char familyName[], const SkFontStyle &fontStyle) const override
sk_sp< SkTypeface > onLegacyMakeTypeface(const char familyName[], SkFontStyle style) const override
sk_sp< SkTypeface > onMakeFromData(sk_sp< SkData > data, int ttcIndex) const override
sk_sp< SkTypeface > onMakeFromFile(const char path[], int ttcIndex) const override
sk_sp< SkTypeface > onMakeFromStreamArgs(std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const override
void onGetFamilyName(int index, SkString *familyName) const override
sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const override
sk_sp< SkTypeface > makeFromStream(std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const
void getFamilyName(int index, SkString *familyName) const
sk_sp< SkFontStyleSet > matchFamily(const char familyName[]) const
void appendTypeface(sk_sp< SkTypeface > typeface)
void getStyle(int index, SkFontStyle *style, SkString *name) override
SkFontStyleSet_Custom(SkString familyName)
sk_sp< SkTypeface > matchStyle(const SkFontStyle &pattern) override
sk_sp< SkTypeface > createTypeface(int index) override
sk_sp< SkTypeface > matchStyleCSS3(const SkFontStyle &pattern)
virtual sk_sp< SkTypeface > matchStyle(const SkFontStyle &pattern)=0
static std::unique_ptr< SkStreamAsset > MakeFromFile(const char path[])
void set(const SkString &src)
const char * c_str() const
void onGetFamilyName(SkString *familyName) const override
void onGetFontDescriptor(SkFontDescriptor *desc, bool *isLocal) const override
SkTypeface_Custom(const SkFontStyle &style, bool isFixedPitch, bool sysFont, SkString familyName, int index)
sk_sp< SkTypeface > onMakeClone(const SkFontArguments &args) const override
std::unique_ptr< SkStreamAsset > onOpenStream(int *) const override
std::unique_ptr< SkFontData > onMakeFontData() const override
SkTypeface_File(const SkFontStyle &style, bool isFixedPitch, bool sysFont, SkString familyName, const char path[], int index)
sk_sp< SkTypeface > onMakeClone(const SkFontArguments &args) const override
std::unique_ptr< SkStreamAsset > onOpenStream(int *ttcIndex) const override
std::unique_ptr< SkFontData > onMakeFontData() const override
std::unique_ptr< SkFontData > cloneFontData(const SkFontArguments &, SkFontStyle *style) const
static sk_sp< SkTypeface > MakeFromStream(std::unique_ptr< SkStreamAsset >, const SkFontArguments &)
void getFamilyName(SkString *name) const
SkFontStyle fontStyle() const
bool isFixedPitch() const
T & emplace_back(Args &&... args)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args