aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkFontMgr_custom.cpp
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/ports/SkFontMgr_custom.cpp
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/ports/SkFontMgr_custom.cpp')
-rw-r--r--src/ports/SkFontMgr_custom.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp
index 4e4887d27d..91a590827c 100644
--- a/src/ports/SkFontMgr_custom.cpp
+++ b/src/ports/SkFontMgr_custom.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkFontArguments.h"
#include "SkFontDescriptor.h"
#include "SkFontHost_FreeType_common.h"
#include "SkFontMgr.h"
@@ -200,7 +201,7 @@ SkTypeface* SkFontMgr_Custom::onCreateFromStream(SkStreamAsset* bareStream, int
}
SkTypeface* SkFontMgr_Custom::onCreateFromStream(SkStreamAsset* s,
- const FontParameters& params) const
+ const SkFontArguments& args) const
{
using Scanner = SkTypeface_FreeType::Scanner;
std::unique_ptr<SkStreamAsset> stream(s);
@@ -208,19 +209,18 @@ SkTypeface* SkFontMgr_Custom::onCreateFromStream(SkStreamAsset* s,
SkFontStyle style;
SkString name;
Scanner::AxisDefinitions axisDefinitions;
- if (!fScanner.scanFont(stream.get(), params.getCollectionIndex(),
+ if (!fScanner.scanFont(stream.get(), args.getCollectionIndex(),
&name, &style, &isFixedPitch, &axisDefinitions))
{
return nullptr;
}
- int paramAxisCount;
- const FontParameters::Axis* paramAxes = params.getAxes(&paramAxisCount);
+ const SkFontArguments::VariationPosition position = args.getVariationDesignPosition();
SkAutoSTMalloc<4, SkFixed> axisValues(axisDefinitions.count());
- Scanner::computeAxisValues(axisDefinitions, paramAxes, paramAxisCount, axisValues, name);
+ Scanner::computeAxisValues(axisDefinitions, position, axisValues, name);
- auto data = skstd::make_unique<SkFontData>(std::move(stream), params.getCollectionIndex(),
- axisValues.get(), axisDefinitions.count());
+ auto data = skstd::make_unique<SkFontData>(std::move(stream), args.getCollectionIndex(),
+ axisValues.get(), axisDefinitions.count());
return new SkTypeface_Stream(std::move(data), style, isFixedPitch, false, name);
}