diff options
author | Ben Wagner <bungeman@google.com> | 2017-02-17 18:38:52 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-17 18:39:09 +0000 |
commit | 7d07d4663822c05e421f1f50460a985ab43adac4 (patch) | |
tree | 708aca529955646b35468d4364dd75517765ad9a /include/ports | |
parent | 87e7f820f74a990a59fb8f1d5c182584ce586ecf (diff) |
Revert "Add SkTypeface::getVariationDesignPosition."
This reverts commit 87e7f820f74a990a59fb8f1d5c182584ce586ecf.
Reason for revert: Failed a test on Mac
Original change's description:
> Add SkTypeface::getVariationDesignPosition.
>
> Allow users to query a typeface's position in variation design space.
>
> Change-Id: I5d80c8ff658708a5d1aa386ec5b7396dcb621198
> Reviewed-on: https://skia-review.googlesource.com/7130
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
>
TBR=bungeman@google.com,reed@google.com,reviews@skia.org,drott@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: Ia65792083642dbe9333a62eb75d162931b57cffd
Reviewed-on: https://skia-review.googlesource.com/8670
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'include/ports')
-rw-r--r-- | include/ports/SkFontMgr.h | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/include/ports/SkFontMgr.h b/include/ports/SkFontMgr.h index b5879d35b8..4103e8747e 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,10 +102,51 @@ public: */ SkTypeface* createFromStream(SkStreamAsset*, int ttcIndex = 0) const; - // deprecated, use SkFontArguments instead. - using FontParameters = SkFontArguments; + 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; + }; /* Experimental, API subject to change. */ - SkTypeface* createFromStream(SkStreamAsset*, const SkFontArguments&) const; + SkTypeface* createFromStream(SkStreamAsset*, const FontParameters&) const; /** * Create a typeface from the specified font data. @@ -146,7 +187,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 SkFontArguments&) const; + virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const FontParameters&) const; virtual SkTypeface* onCreateFromFontData(std::unique_ptr<SkFontData>) const; virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const = 0; |