aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2017-02-17 18:03:49 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-23 18:41:57 +0000
commit0f3d0c37dbcaf4ec271d5fe847becc9b1aa6f537 (patch)
treecae67def2ed8a8ba416132b609cb98fe7563c691 /src/core
parent6d67396bf06fb603825bf6a792a2e1c8eb405fe0 (diff)
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 <bungeman@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkFontMgr.cpp8
-rw-r--r--src/core/SkTypeface.cpp11
2 files changed, 15 insertions, 4 deletions
diff --git a/src/core/SkFontMgr.cpp b/src/core/SkFontMgr.cpp
index 03ac2eba83..8ce0b39682 100644
--- a/src/core/SkFontMgr.cpp
+++ b/src/core/SkFontMgr.cpp
@@ -132,11 +132,11 @@ SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) con
return this->onCreateFromStream(stream, ttcIndex);
}
-SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, const FontParameters& params) const {
+SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, const SkFontArguments& args) const {
if (nullptr == stream) {
return nullptr;
}
- return this->onCreateFromStream(stream, params);
+ return this->onCreateFromStream(stream, args);
}
SkTypeface* SkFontMgr::createFromFontData(std::unique_ptr<SkFontData> data) const {
@@ -147,8 +147,8 @@ SkTypeface* SkFontMgr::createFromFontData(std::unique_ptr<SkFontData> data) cons
}
// This implementation is temporary until it can be made pure virtual.
-SkTypeface* SkFontMgr::onCreateFromStream(SkStreamAsset* stream, const FontParameters& p) const {
- return this->createFromStream(stream, p.getCollectionIndex());
+SkTypeface* SkFontMgr::onCreateFromStream(SkStreamAsset* stream, const SkFontArguments& args) const{
+ return this->createFromStream(stream, args.getCollectionIndex());
}
// This implementation is temporary until it can be made pure virtual.
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 70c0c76d06..2d8f920ba9 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -73,6 +73,11 @@ protected:
SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const override {
return new EmptyLocalizedStrings;
}
+ int onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[],
+ int coordinateCount) const override
+ {
+ return 0;
+ }
int onGetTableTags(SkFontTableTag tags[]) const override { return 0; }
size_t onGetTableData(SkFontTableTag, size_t, size_t, void*) const override {
return 0;
@@ -202,6 +207,12 @@ sk_sp<SkTypeface> SkTypeface::MakeDeserialize(SkStream* stream) {
///////////////////////////////////////////////////////////////////////////////
+int SkTypeface::getVariationDesignPosition(
+ SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const
+{
+ return this->onGetVariationDesignPosition(coordinates, coordinateCount);
+}
+
int SkTypeface::countTables() const {
return this->onGetTableTags(nullptr);
}