diff options
author | Herb Derby <herb@google.com> | 2017-01-20 16:07:52 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-23 17:09:37 +0000 |
commit | 9adfef8680c22ce8980031b4bcb9f1fadd066a80 (patch) | |
tree | 39cbe845eebfe3e1ce063910207b03d63443a29e /src | |
parent | 5b92e4ab8e1d238f3acbd775accae8c5436c1b71 (diff) |
Remove public APIs that use SkDataTable.
Change-Id: Ibb8f987efc585713a6f8061c72fb416d07be13b1
Reviewed-on: https://skia-review.googlesource.com/7352
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/fonts/SkFontMgr_indirect.cpp | 22 | ||||
-rw-r--r-- | src/ports/SkFontConfigInterface_direct.cpp | 49 | ||||
-rw-r--r-- | src/ports/SkFontConfigInterface_direct.h | 3 | ||||
-rw-r--r-- | src/ports/SkFontMgr_FontConfigInterface.cpp | 9 | ||||
-rw-r--r-- | src/ports/SkRemotableFontMgr_win_dw.cpp | 21 |
5 files changed, 8 insertions, 96 deletions
diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp index f594e2d888..f3ba9d1c25 100644 --- a/src/fonts/SkFontMgr_indirect.cpp +++ b/src/fonts/SkFontMgr_indirect.cpp @@ -5,7 +5,6 @@ * found in the LICENSE file. */ -#include "SkDataTable.h" #include "SkFontMgr.h" #include "SkFontMgr_indirect.h" #include "SkFontStyle.h" @@ -60,30 +59,17 @@ private: sk_sp<SkRemotableFontIdentitySet> fData; }; -void SkFontMgr_Indirect::set_up_family_names(const SkFontMgr_Indirect* self) { - self->fFamilyNames = self->fProxy->getFamilyNames(); -} - int SkFontMgr_Indirect::onCountFamilies() const { - fFamilyNamesInitOnce(SkFontMgr_Indirect::set_up_family_names, this); - return fFamilyNames->count(); + return 0; } void SkFontMgr_Indirect::onGetFamilyName(int index, SkString* familyName) const { - fFamilyNamesInitOnce(SkFontMgr_Indirect::set_up_family_names, this); - if (index >= fFamilyNames->count()) { - familyName->reset(); - return; - } - familyName->set(fFamilyNames->atStr(index)); + SkFAIL("Not implemented"); } SkFontStyleSet* SkFontMgr_Indirect::onCreateStyleSet(int index) const { - SkRemotableFontIdentitySet* set = fProxy->getIndex(index); - if (nullptr == set) { - return nullptr; - } - return new SkStyleSet_Indirect(this, index, set); + SkFAIL("Not implemented"); + return nullptr; } SkFontStyleSet* SkFontMgr_Indirect::onMatchFamily(const char familyName[]) const { diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp index c1a73e626c..d552befb5a 100644 --- a/src/ports/SkFontConfigInterface_direct.cpp +++ b/src/ports/SkFontConfigInterface_direct.cpp @@ -9,7 +9,6 @@ #include "SkAutoMalloc.h" #include "SkBuffer.h" -#include "SkDataTable.h" #include "SkFixed.h" #include "SkFontConfigInterface_direct.h" #include "SkFontStyle.h" @@ -685,51 +684,3 @@ bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[], SkStreamAsset* SkFontConfigInterfaceDirect::openStream(const FontIdentity& identity) { return SkStream::MakeFromFile(identity.fString.c_str()).release(); } - -/////////////////////////////////////////////////////////////////////////////// - -static bool find_name(const SkTDArray<const char*>& list, const char* str) { - int count = list.count(); - for (int i = 0; i < count; ++i) { - if (!strcmp(list[i], str)) { - return true; - } - } - return false; -} - -sk_sp<SkDataTable> SkFontConfigInterfaceDirect::getFamilyNames() { - FCLocker lock; - - FcPattern* pat = FcPatternCreate(); - SkAutoTCallVProc<FcPattern, FcPatternDestroy> autoDestroyPat(pat); - if (nullptr == pat) { - return nullptr; - } - - FcObjectSet* os = FcObjectSetBuild(FC_FAMILY, (char *)0); - SkAutoTCallVProc<FcObjectSet, FcObjectSetDestroy> autoDestroyOs(os); - if (nullptr == os) { - return nullptr; - } - - FcFontSet* fs = FcFontList(nullptr, pat, os); - SkAutoTCallVProc<FcFontSet, FcFontSetDestroy> autoDestroyFs(fs); - if (nullptr == fs) { - return nullptr; - } - - SkTDArray<const char*> names; - SkTDArray<size_t> sizes; - for (int i = 0; i < fs->nfont; ++i) { - FcPattern* match = fs->fonts[i]; - const char* famName = get_string(match, FC_FAMILY); - if (famName && !find_name(names, famName)) { - *names.append() = famName; - *sizes.append() = strlen(famName) + 1; - } - } - - return SkDataTable::MakeCopyArrays((const void*const*)names.begin(), - sizes.begin(), names.count()); -} diff --git a/src/ports/SkFontConfigInterface_direct.h b/src/ports/SkFontConfigInterface_direct.h index 6cd0a8f9ba..829f87092d 100644 --- a/src/ports/SkFontConfigInterface_direct.h +++ b/src/ports/SkFontConfigInterface_direct.h @@ -24,9 +24,6 @@ public: SkStreamAsset* openStream(const FontIdentity&) override; - // new APIs - sk_sp<SkDataTable> getFamilyNames() override; - protected: virtual bool isAccessible(const char* filename); diff --git a/src/ports/SkFontMgr_FontConfigInterface.cpp b/src/ports/SkFontMgr_FontConfigInterface.cpp index f5e3ef0e05..4795ba5974 100644 --- a/src/ports/SkFontMgr_FontConfigInterface.cpp +++ b/src/ports/SkFontMgr_FontConfigInterface.cpp @@ -154,7 +154,6 @@ static bool find_by_FontIdentity(SkTypeface* cachedTypeface, void* ctx) { class SkFontMgr_FCI : public SkFontMgr { sk_sp<SkFontConfigInterface> fFCI; - sk_sp<SkDataTable> fFamilyNames; SkTypeface_FreeType::Scanner fScanner; mutable SkMutex fMutex; @@ -168,21 +167,21 @@ class SkFontMgr_FCI : public SkFontMgr { public: SkFontMgr_FCI(sk_sp<SkFontConfigInterface> fci) : fFCI(std::move(fci)) - , fFamilyNames(fFCI->getFamilyNames()) , fCache(kMaxSize) {} protected: int onCountFamilies() const override { - return fFamilyNames->count(); + return 0; } void onGetFamilyName(int index, SkString* familyName) const override { - familyName->set(fFamilyNames->atStr(index)); + SkFAIL("Not implemented."); } SkFontStyleSet* onCreateStyleSet(int index) const override { - return this->onMatchFamily(fFamilyNames->atStr(index)); + SkFAIL("Not implemented."); + return nullptr; } SkFontStyleSet* onMatchFamily(const char familyName[]) const override { diff --git a/src/ports/SkRemotableFontMgr_win_dw.cpp b/src/ports/SkRemotableFontMgr_win_dw.cpp index c07c81fdae..fd38c4f73f 100644 --- a/src/ports/SkRemotableFontMgr_win_dw.cpp +++ b/src/ports/SkRemotableFontMgr_win_dw.cpp @@ -9,7 +9,6 @@ #include "SkDWrite.h" #include "SkDWriteFontFileStream.h" -#include "SkDataTable.h" #include "SkHRESULT.h" #include "SkMutex.h" #include "SkRemotableFontMgr.h" @@ -90,26 +89,6 @@ public: memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); } - sk_sp<SkDataTable> getFamilyNames() const override { - int count = fFontCollection->GetFontFamilyCount(); - - SkDataTableBuilder names(1024); - for (int index = 0; index < count; ++index) { - SkTScopedComPtr<IDWriteFontFamily> fontFamily; - HRNM(fFontCollection->GetFontFamily(index, &fontFamily), - "Could not get requested family."); - - SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; - HRNM(fontFamily->GetFamilyNames(&familyNames), "Could not get family names."); - - SkString familyName; - sk_get_locale_string(familyNames.get(), fLocaleName.get(), &familyName); - - names.appendString(familyName); - } - return names.detachDataTable(); - } - HRESULT FontToIdentity(IDWriteFont* font, SkFontIdentity* fontId) const { SkTScopedComPtr<IDWriteFontFace> fontFace; HRM(font->CreateFontFace(&fontFace), "Could not create font face."); |