Remove public APIs that use SkDataTable.
authorHerb Derby <herb@google.com>
Fri, 20 Jan 2017 21:07:52 +0000 (16:07 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 23 Jan 2017 17:09:37 +0000 (17:09 +0000)
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>

include/ports/SkFontConfigInterface.h
include/ports/SkFontMgr_indirect.h
include/ports/SkRemotableFontMgr.h
src/fonts/SkFontMgr_indirect.cpp
src/ports/SkFontConfigInterface_direct.cpp
src/ports/SkFontConfigInterface_direct.h
src/ports/SkFontMgr_FontConfigInterface.cpp
src/ports/SkRemotableFontMgr_win_dw.cpp

index 74f766f..ff80e5f 100644 (file)
@@ -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;
 };
 
index 6c258c8..b9ab3ba 100644 (file)
@@ -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;
 };
 
index 2e028ce..12050c7 100644 (file)
@@ -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.
index f594e2d..f3ba9d1 100644 (file)
@@ -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 {
index c1a73e6..d552bef 100644 (file)
@@ -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());
-}
index 6cd0a8f..829f870 100644 (file)
@@ -24,9 +24,6 @@ public:
 
     SkStreamAsset* openStream(const FontIdentity&) override;
 
-    // new APIs
-    sk_sp<SkDataTable> getFamilyNames() override;
-
 protected:
     virtual bool isAccessible(const char* filename);
 
index f5e3ef0..4795ba5 100644 (file)
@@ -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 {
index c07c81f..fd38c4f 100644 (file)
@@ -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.");