aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2017-02-23 20:48:43 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-23 20:48:53 +0000
commit97043299cb352f50f604878b7a1dc8ad127fc1c6 (patch)
tree3363bfc674ab808e735336898386076d9c3b9558 /tests
parent3f81f3703a68755c88f5cc4a87728b98f34c4cd4 (diff)
Revert "Add SkTypeface::getVariationDesignPosition."
This reverts commit 0f3d0c37dbcaf4ec271d5fe847becc9b1aa6f537. Reason for revert: <INSERT REASONING HERE> Original change's description: > 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> > TBR=bungeman@google.com,reed@google.com,reviews@skia.org,drott@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I484fe52c1f89e7b6d0024dcabf7c59d0e8b5b5e7 Reviewed-on: https://skia-review.googlesource.com/8929 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/FontMgrAndroidParserTest.cpp12
-rw-r--r--tests/FontMgrTest.cpp6
-rw-r--r--tests/TypefaceTest.cpp79
3 files changed, 6 insertions, 91 deletions
diff --git a/tests/FontMgrAndroidParserTest.cpp b/tests/FontMgrAndroidParserTest.cpp
index cbcfb3be2a..92dbd951c0 100644
--- a/tests/FontMgrAndroidParserTest.cpp
+++ b/tests/FontMgrAndroidParserTest.cpp
@@ -90,13 +90,13 @@ void DumpLoadedFonts(SkTDArray<FontFamily*> fontFamilies, const char* label) {
for (int j = 0; j < fontFamilies[i]->fFonts.count(); ++j) {
const FontFileInfo& ffi = fontFamilies[i]->fFonts[j];
SkDebugf(" file (%d) %s#%d", ffi.fWeight, ffi.fFileName.c_str(), ffi.fIndex);
- for (const auto& coordinate : ffi.fVariationDesignPosition) {
+ for (const auto& axis : ffi.fAxes) {
SkDebugf(" @'%c%c%c%c'=%f",
- (coordinate.axis >> 24) & 0xFF,
- (coordinate.axis >> 16) & 0xFF,
- (coordinate.axis >> 8) & 0xFF,
- (coordinate.axis ) & 0xFF,
- coordinate.value);
+ (axis.fTag >> 24) & 0xFF,
+ (axis.fTag >> 16) & 0xFF,
+ (axis.fTag >> 8) & 0xFF,
+ (axis.fTag ) & 0xFF,
+ axis.fStyleValue);
}
SkDebugf("\n");
}
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index b6a0cc5a74..50e2d5a606 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -150,12 +150,6 @@ static void test_matchStyleCSS3(skiatest::Reporter* reporter) {
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;
diff --git a/tests/TypefaceTest.cpp b/tests/TypefaceTest.cpp
index 4786cc278c..2a3b32d2cf 100644
--- a/tests/TypefaceTest.cpp
+++ b/tests/TypefaceTest.cpp
@@ -6,9 +6,6 @@
*/
#include "SkData.h"
-#include "SkFixed.h"
-#include "SkFontMgr.h"
-#include "SkMakeUnique.h"
#include "SkOTTable_OS_2.h"
#include "SkSFNTHeader.h"
#include "SkStream.h"
@@ -90,77 +87,6 @@ DEF_TEST(TypefaceStyle, reporter) {
}
}
-DEF_TEST(TypefaceAxes, reporter) {
- std::unique_ptr<SkStreamAsset> distortable(GetResourceAsStream("/fonts/Distortable.ttf"));
- if (!distortable) {
- REPORT_FAILURE(reporter, "distortable", SkString());
- return;
- }
-
- sk_sp<SkFontMgr> fm = SkFontMgr::RefDefault();
- const SkFontArguments::VariationPosition::Coordinate position[] = {
- { SkSetFourByteTag('w','g','h','t'), SK_ScalarSqrt2 }
- };
- SkFontArguments params;
- params.setVariationDesignPosition({position, SK_ARRAY_COUNT(position)});
- // TODO: if axes are set and the back-end doesn't support them, should we create the typeface?
- sk_sp<SkTypeface> typeface(fm->createFromStream(distortable.release(), params));
-
- int count = typeface->getVariationDesignPosition(nullptr, 0);
- if (count == -1) {
- return;
- }
- REPORTER_ASSERT(reporter, count == SK_ARRAY_COUNT(position));
-
- SkFontArguments::VariationPosition::Coordinate positionRead[SK_ARRAY_COUNT(position)];
- count = typeface->getVariationDesignPosition(positionRead, SK_ARRAY_COUNT(positionRead));
- REPORTER_ASSERT(reporter, count == SK_ARRAY_COUNT(position));
-
- REPORTER_ASSERT(reporter, positionRead[0].axis == position[0].axis);
-
- // Convert to fixed for "almost equal".
- SkFixed fixedRead = SkScalarToFixed(positionRead[0].value);
- SkFixed fixedOriginal = SkScalarToFixed(position[0].value);
- REPORTER_ASSERT(reporter, fixedRead == fixedOriginal);
-}
-
-DEF_TEST(TypefaceVariationIndex, reporter) {
- std::unique_ptr<SkStreamAsset> distortable(GetResourceAsStream("/fonts/Distortable.ttf"));
- if (!distortable) {
- REPORT_FAILURE(reporter, "distortable", SkString());
- return;
- }
-
- sk_sp<SkFontMgr> fm = SkFontMgr::RefDefault();
- SkFontArguments params;
- // The first named variation position in Distortable is 'Thin'.
- params.setCollectionIndex(0x00010000);
- sk_sp<SkTypeface> typeface(fm->createFromStream(distortable.release(), params));
- if (!typeface) {
- // FreeType is the only weird thing that supports this, Skia just needs to make sure if it
- // gets one of these things make sense.
- return;
- }
-
- int count = typeface->getVariationDesignPosition(nullptr, 0);
- if (!(count == 1)) {
- REPORT_FAILURE(reporter, "count == 1", SkString());
- return;
- }
-
- SkFontArguments::VariationPosition::Coordinate positionRead[1];
- count = typeface->getVariationDesignPosition(positionRead, SK_ARRAY_COUNT(positionRead));
- if (count == -1) {
- return;
- }
- if (!(count == 1)) {
- REPORT_FAILURE(reporter, "count == 1", SkString());
- return;
- }
- REPORTER_ASSERT(reporter, positionRead[0].axis == SkSetFourByteTag('w','g','h','t'));
- REPORTER_ASSERT(reporter, positionRead[0].value == 0.5);
-}
-
DEF_TEST(Typeface, reporter) {
sk_sp<SkTypeface> t1(SkTypeface::MakeFromName(nullptr, SkFontStyle()));
@@ -208,11 +134,6 @@ protected:
SK_ABORT("unimplemented");
return nullptr;
}
- 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; }
};