aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2017-01-20 16:07:52 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-23 17:09:37 +0000
commit9adfef8680c22ce8980031b4bcb9f1fadd066a80 (patch)
tree39cbe845eebfe3e1ce063910207b03d63443a29e
parent5b92e4ab8e1d238f3acbd775accae8c5436c1b71 (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>
-rw-r--r--include/ports/SkFontConfigInterface.h3
-rw-r--r--include/ports/SkFontMgr_indirect.h5
-rw-r--r--include/ports/SkRemotableFontMgr.h9
-rw-r--r--src/fonts/SkFontMgr_indirect.cpp22
-rw-r--r--src/ports/SkFontConfigInterface_direct.cpp49
-rw-r--r--src/ports/SkFontConfigInterface_direct.h3
-rw-r--r--src/ports/SkFontMgr_FontConfigInterface.cpp9
-rw-r--r--src/ports/SkRemotableFontMgr_win_dw.cpp21
8 files changed, 8 insertions, 113 deletions
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h
index 74f766f52e..ff80e5fb38 100644
--- a/include/ports/SkFontConfigInterface.h
+++ b/include/ports/SkFontConfigInterface.h
@@ -109,9 +109,6 @@ public:
*/
static SkFontConfigInterface* GetSingletonDirectInterface();
- // New APIS, which have default impls for now (which do nothing)
-
- virtual sk_sp<SkDataTable> getFamilyNames() { return SkDataTable::MakeEmpty(); }
typedef SkRefCnt INHERITED;
};
diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h
index 6c258c851d..b9ab3ba913 100644
--- a/include/ports/SkFontMgr_indirect.h
+++ b/include/ports/SkFontMgr_indirect.h
@@ -11,7 +11,6 @@
#include "../private/SkMutex.h"
#include "../private/SkOnce.h"
#include "../private/SkTArray.h"
-#include "SkDataTable.h"
#include "SkFontMgr.h"
#include "SkRefCnt.h"
#include "SkRemotableFontMgr.h"
@@ -95,10 +94,6 @@ private:
mutable SkTArray<DataEntry> fDataCache;
mutable SkMutex fDataCacheMutex;
- mutable sk_sp<SkDataTable> fFamilyNames;
- mutable SkOnce fFamilyNamesInitOnce;
- static void set_up_family_names(const SkFontMgr_Indirect* self);
-
friend class SkStyleSet_Indirect;
};
diff --git a/include/ports/SkRemotableFontMgr.h b/include/ports/SkRemotableFontMgr.h
index 2e028cee26..12050c7e07 100644
--- a/include/ports/SkRemotableFontMgr.h
+++ b/include/ports/SkRemotableFontMgr.h
@@ -56,15 +56,6 @@ private:
class SK_API SkRemotableFontMgr : public SkRefCnt {
public:
/**
- * Returns the names of the known fonts on the system.
- * Will not return NULL, will return an empty table if no families exist.
- *
- * The indexes may be used with getIndex(int) and
- * matchIndexStyle(int, SkFontStyle).
- */
- virtual sk_sp<SkDataTable> getFamilyNames() const = 0;
-
- /**
* Returns all of the fonts with the given familyIndex.
* Returns NULL if the index is out of bounds.
* Returns empty if there are no fonts at the given index.
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.");