diff options
author | Hal Canary <halcanary@google.com> | 2018-05-31 14:50:58 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-01 14:30:56 +0000 |
commit | 39ccf5d386ae07d4fdfaac6c6e89c325efb61255 (patch) | |
tree | ce1771c8f7c93057d5c27c0b84c54ab65743ff18 /tools/fonts | |
parent | 1989c4995c9a5c6441e80a95de289bc870aabedb (diff) |
Fix compile when SK_XML undefined
Change-Id: Ia23b07434939acbf544854b94c4b10810c20ae1a
Reviewed-on: https://skia-review.googlesource.com/131221
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'tools/fonts')
-rw-r--r-- | tools/fonts/SkTestFontMgr.cpp | 24 | ||||
-rw-r--r-- | tools/fonts/SkTestSVGTypeface.cpp | 6 |
2 files changed, 22 insertions, 8 deletions
diff --git a/tools/fonts/SkTestFontMgr.cpp b/tools/fonts/SkTestFontMgr.cpp index 4513a2f8d1..d2aadaa62a 100644 --- a/tools/fonts/SkTestFontMgr.cpp +++ b/tools/fonts/SkTestFontMgr.cpp @@ -5,11 +5,16 @@ * found in the LICENSE file. */ +#include <vector> + #include "SkFontDescriptor.h" #include "SkTestFontMgr.h" #include "sk_tool_utils.h" #include "SkTestTypeface.h" + +#ifdef SK_XML #include "SkTestSVGTypeface.h" +#endif namespace { @@ -90,20 +95,23 @@ private: class FontMgr final : public SkFontMgr { public: FontMgr() { - fFamilies[0] = sk_make_sp<FontStyleSet>(0); - fFamilies[1] = sk_make_sp<FontStyleSet>(1); - fFamilies[2] = sk_make_sp<FontStyleSet>(2); - fFamilies[3] = sk_make_sp<JustOneTypefaceStyleSet>(SkTestSVGTypeface::Default()); + fFamilies.push_back(sk_make_sp<FontStyleSet>(0)); + fFamilies.push_back(sk_make_sp<FontStyleSet>(1)); + fFamilies.push_back(sk_make_sp<FontStyleSet>(2)); + #ifdef SK_XML + fFamilies.push_back(sk_make_sp<JustOneTypefaceStyleSet>(SkTestSVGTypeface::Default())); + #endif } - int onCountFamilies() const override { return SK_ARRAY_COUNT(fFamilies); } + int onCountFamilies() const override { return fFamilies.size(); } void onGetFamilyName(int index, SkString* familyName) const override { *familyName = kFamilyNames[index]; } SkFontStyleSet* onCreateStyleSet(int index) const override { - return SkRef(fFamilies[index].get()); + sk_sp<SkFontStyleSet> ref = fFamilies[index]; + return ref.release(); } SkFontStyleSet* onMatchFamily(const char familyName[]) const override { @@ -111,7 +119,9 @@ public: if (strstr(familyName, "ans")) { return this->createStyleSet(0); } if (strstr(familyName, "erif")) { return this->createStyleSet(1); } if (strstr(familyName, "ono")) { return this->createStyleSet(2); } + #ifdef SK_XML if (strstr(familyName, "oji")) { return this->createStyleSet(3); } + #endif } return this->createStyleSet(0); } @@ -164,7 +174,7 @@ public: } private: - sk_sp<SkFontStyleSet> fFamilies[4]; + std::vector<sk_sp<SkFontStyleSet>> fFamilies; }; } diff --git a/tools/fonts/SkTestSVGTypeface.cpp b/tools/fonts/SkTestSVGTypeface.cpp index 199c3b5df6..0ab59cfb28 100644 --- a/tools/fonts/SkTestSVGTypeface.cpp +++ b/tools/fonts/SkTestSVGTypeface.cpp @@ -5,6 +5,10 @@ * found in the LICENSE file. */ +#include "SkTestSVGTypeface.h" + +#ifdef SK_XML + #include "Resources.h" #include "SkAdvancedTypefaceMetrics.h" #include "SkBitmap.h" @@ -35,7 +39,6 @@ #include "SkSize.h" #include "SkStream.h" #include "SkSurface.h" -#include "SkTestSVGTypeface.h" #include "SkTDArray.h" #include "SkTemplates.h" #include "SkUtils.h" @@ -1296,3 +1299,4 @@ void SkTestSVGTypeface::exportTtxColr(SkWStream* out) const { out->writeText("</ttFont>\n"); } +#endif // SK_XML |