From 0f3d0c37dbcaf4ec271d5fe847becc9b1aa6f537 Mon Sep 17 00:00:00 2001 From: bungeman Date: Fri, 17 Feb 2017 18:03:49 -0500 Subject: Add SkTypeface::getVariationDesignPosition. Allow users to query a typeface's position in variation design space. Change-Id: I173ee9eefdddee6b2613435ebcc6b08c25b382ed Reviewed-on: https://skia-review.googlesource.com/8684 Commit-Queue: Ben Wagner Reviewed-by: Mike Reed --- include/ports/SkFontMgr.h | 51 +++++------------------------------------------ 1 file changed, 5 insertions(+), 46 deletions(-) (limited to 'include/ports') diff --git a/include/ports/SkFontMgr.h b/include/ports/SkFontMgr.h index 4103e8747e..b5879d35b8 100644 --- a/include/ports/SkFontMgr.h +++ b/include/ports/SkFontMgr.h @@ -8,9 +8,9 @@ #ifndef SkFontMgr_DEFINED #define SkFontMgr_DEFINED +#include "SkFontArguments.h" #include "SkFontStyle.h" #include "SkRefCnt.h" -#include "SkScalar.h" #include "SkTypes.h" class SkData; @@ -102,51 +102,10 @@ public: */ SkTypeface* createFromStream(SkStreamAsset*, int ttcIndex = 0) const; - struct FontParameters { - struct Axis { - SkFourByteTag fTag; - SkScalar fStyleValue; - }; - - FontParameters() : fCollectionIndex(0), fAxisCount(0), fAxes(nullptr) {} - - /** Specify the index of the desired font. - * - * Font formats like ttc, dfont, cff, cid, pfr, t42, t1, and fon may actually be indexed - * collections of fonts. - */ - FontParameters& setCollectionIndex(int collectionIndex) { - fCollectionIndex = collectionIndex; - return *this; - } - - /** Specify the GX variation axis values. - * - * Any axes not specified will use the default value. Specified axes not present in the - * font will be ignored. - * - * @param axes not copied. This pointer must remain valid for life of FontParameters. - */ - FontParameters& setAxes(const Axis* axes, int axisCount) { - fAxisCount = axisCount; - fAxes = axes; - return *this; - } - - int getCollectionIndex() const { - return fCollectionIndex; - } - const Axis* getAxes(int* axisCount) const { - *axisCount = fAxisCount; - return fAxes; - } - private: - int fCollectionIndex; - int fAxisCount; - const Axis* fAxes; - }; + // deprecated, use SkFontArguments instead. + using FontParameters = SkFontArguments; /* Experimental, API subject to change. */ - SkTypeface* createFromStream(SkStreamAsset*, const FontParameters&) const; + SkTypeface* createFromStream(SkStreamAsset*, const SkFontArguments&) const; /** * Create a typeface from the specified font data. @@ -187,7 +146,7 @@ protected: 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 FontParameters&) const; + virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const SkFontArguments&) const; virtual SkTypeface* onCreateFromFontData(std::unique_ptr) const; virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const = 0; -- cgit v1.2.3