diff options
author | Ben Wagner <bungeman@google.com> | 2018-06-26 11:22:37 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-12 17:30:20 +0000 |
commit | e346b1eea442065261c14f92b304031e1330e491 (patch) | |
tree | ac71ca13242dad662d3bf157370c943596ce4dd0 /include/core/SkTypeface.h | |
parent | a4704078b9d7f6c86cdd29c80840bfc4f15bea1a (diff) |
Add SkTypeface::getVariationDesignParameters
This adds a way for users to query the axis parameters for a typeface.
Change-Id: Idc2ac0d84bc7ae2ca484ae410cba5b01883418e5
Reviewed-on: https://skia-review.googlesource.com/137706
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'include/core/SkTypeface.h')
-rw-r--r-- | include/core/SkTypeface.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index 4118152dea..51f339ccfa 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -11,6 +11,7 @@ #include "../private/SkOnce.h" #include "../private/SkWeakRefCnt.h" #include "SkFontArguments.h" +#include "SkFontParameters.h" #include "SkFontStyle.h" #include "SkRect.h" #include "SkString.h" @@ -71,6 +72,20 @@ public: int getVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const; + /** Copy into 'parameters' (allocated by the caller) the design variation parameters. + * + * @param parameters the buffer into which to write the design variation parameters. + * @param coordinateCount the number of entries available through 'parameters'. + * + * @return The number of axes, or -1 if there is an error. + * If 'parameters != nullptr' and 'parameterCount >= numAxes' then 'parameters' will be + * filled with the variation parameters describing the position of this typeface in design + * variation space. It is possible the number of axes can be retrieved but actual parameters + * cannot. + */ + int getVariationDesignParameters(SkFontParameters::Variation::Axis parameters[], + int parameterCount) const; + /** Return a 32bit value for this typeface, unique for the underlying font data. Will never return 0. */ @@ -341,6 +356,9 @@ protected: SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const = 0; + virtual int onGetVariationDesignParameters( + SkFontParameters::Variation::Axis parameters[], int parameterCount) const; + virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0; virtual int onCharsToGlyphs(const void* chars, Encoding, SkGlyphID glyphs[], |