diff options
Diffstat (limited to 'include/ports')
-rw-r--r-- | include/ports/SkFontMgr.h | 59 | ||||
-rw-r--r-- | include/ports/SkFontMgr_indirect.h | 9 |
2 files changed, 17 insertions, 51 deletions
diff --git a/include/ports/SkFontMgr.h b/include/ports/SkFontMgr.h index 08e406a97d..b13e113a2e 100644 --- a/include/ports/SkFontMgr.h +++ b/include/ports/SkFontMgr.h @@ -95,28 +95,26 @@ public: * or NULL if the data is not recognized. The caller must call unref() on * the returned object if it is not null. */ - sk_sp<SkTypeface> makeFromData(sk_sp<SkData>, int ttcIndex = 0) const; + SkTypeface* createFromData(SkData*, int ttcIndex = 0) const; /** * Create a typeface for the specified stream and TTC index * (pass 0 for none) or NULL if the stream is not recognized. The caller * must call unref() on the returned object if it is not null. */ - sk_sp<SkTypeface> makeFromStream(std::unique_ptr<SkStreamAsset>, int ttcIndex = 0) const; + SkTypeface* createFromStream(SkStreamAsset*, int ttcIndex = 0) const; -#ifdef SK_SUPPORT_LEGACY_FONTMGR_API + // deprecated, use SkFontArguments instead. using FontParameters = SkFontArguments; -#endif - /* Experimental, API subject to change. */ - sk_sp<SkTypeface> makeFromStream(std::unique_ptr<SkStreamAsset>, const SkFontArguments&) const; + SkTypeface* createFromStream(SkStreamAsset*, const SkFontArguments&) const; /** * Create a typeface from the specified font data. * Will return NULL if the typeface could not be created. * The caller must call unref() on the returned object if it is not null. */ - sk_sp<SkTypeface> makeFromFontData(std::unique_ptr<SkFontData>) const; + SkTypeface* createFromFontData(std::unique_ptr<SkFontData>) const; /** * Create a typeface for the specified fileName and TTC index @@ -124,18 +122,9 @@ public: * not recognized. The caller must call unref() on the returned object * if it is not null. */ - sk_sp<SkTypeface> makeFromFile(const char path[], int ttcIndex = 0) const; - - sk_sp<SkTypeface> legacyMakeTypeface(const char familyName[], SkFontStyle style) const; - -#ifdef SK_SUPPORT_LEGACY_FONTMGR_API - SkTypeface* createFromData(SkData* data, int ttcIndex = 0) const; - SkTypeface* createFromStream(SkStreamAsset* strm, int ttcIndex = 0) const; - SkTypeface* createFromStream(SkStreamAsset* strm, const SkFontArguments& args) const; - SkTypeface* createFromFontData(std::unique_ptr<SkFontData> fd) const; SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; + SkTypeface* legacyCreateTypeface(const char familyName[], SkFontStyle style) const; -#endif /** Return the default fontmgr. */ static sk_sp<SkFontMgr> RefDefault(); @@ -156,38 +145,14 @@ protected: virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, const SkFontStyle&) const = 0; -#ifdef SK_SUPPORT_LEGACY_FONTMGR_API - // legacy virtuals - virtual SkTypeface* onCreateFromData(SkData*, int) const { return nullptr; } - virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int) const { return nullptr; } + virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; + virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const = 0; + // TODO: make pure virtual. virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const SkFontArguments&) const; virtual SkTypeface* onCreateFromFontData(std::unique_ptr<SkFontData>) const; - virtual SkTypeface* onCreateFromFile(const char[], int) const { return nullptr; } - virtual SkTypeface* onLegacyCreateTypeface(const char[], SkFontStyle) const { - return nullptr; - } - - // new virtuals express as calling legacy versions - - virtual sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData> data, int ttcIndex) const; - virtual sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset> strm, - int ttcIndex) const; - virtual sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset> strm, - const SkFontArguments& args) const; - virtual sk_sp<SkTypeface> onMakeFromFontData(std::unique_ptr<SkFontData> fd) const; - virtual sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const; - virtual sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle style) const; -#else - virtual sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) 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; - virtual sk_sp<SkTypeface> onMakeFromFontData(std::unique_ptr<SkFontData>) const; - virtual sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const = 0; - - virtual sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle) const = 0; -#endif + virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const = 0; + + virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) const = 0; private: diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h index 04e903ed14..251d74a83a 100644 --- a/include/ports/SkFontMgr_indirect.h +++ b/include/ports/SkFontMgr_indirect.h @@ -50,10 +50,11 @@ protected: SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember, const SkFontStyle& fontStyle) const override; - sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>, int ttcIndex) const override; - sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const override; - sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override; - sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle) const override; + SkTypeface* onCreateFromStream(SkStreamAsset* stream, int ttcIndex) const override; + SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override; + SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override; + + SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) const override; private: SkTypeface* createTypefaceFromFontId(const SkFontIdentity& fontId) const; |