Index: src/ports/SkFontConfigTypeface.h |
diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..71f80b7318834693145e29fe919b21b76546eb6e |
--- /dev/null |
+++ b/src/ports/SkFontConfigTypeface.h |
@@ -0,0 +1,63 @@ |
+/* |
+ * Copyright 2013 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "SkFontConfigInterface.h" |
+#include "SkFontHost_FreeType_common.h" |
+#include "SkTypefaceCache.h" |
+ |
+class SkFontDescriptor; |
+class SkStream; |
+ |
+class FontConfigTypeface : public SkTypeface_FreeType { |
+ SkFontConfigInterface::FontIdentity fIdentity; |
+ SkString fFamilyName; |
+ SkStream* fLocalStream; |
+ |
+public: |
+ FontConfigTypeface(Style style, |
+ const SkFontConfigInterface::FontIdentity& fi, |
+ const SkString& familyName) |
+ : INHERITED(style, SkTypefaceCache::NewFontID(), false) |
+ , fIdentity(fi) |
+ , fFamilyName(familyName) |
+ , fLocalStream(NULL) {} |
+ |
+ FontConfigTypeface(Style style, SkStream* localStream) |
+ : INHERITED(style, SkTypefaceCache::NewFontID(), false) { |
+ // we default to empty fFamilyName and fIdentity |
+ fLocalStream = localStream; |
+ SkSafeRef(localStream); |
+ } |
+ |
+ virtual ~FontConfigTypeface() { |
+ SkSafeUnref(fLocalStream); |
+ } |
+ |
+ const SkFontConfigInterface::FontIdentity& getIdentity() const { |
+ return fIdentity; |
+ } |
+ |
+ const char* getFamilyName() const { return fFamilyName.c_str(); } |
+ SkStream* getLocalStream() const { return fLocalStream; } |
+ |
+ bool isFamilyName(const char* name) const { |
+ return fFamilyName.equals(name); |
+ } |
+ |
+protected: |
+ friend class SkFontHost; // hack until we can make public versions |
+ |
+ virtual int onGetTableTags(SkFontTableTag tags[]) const SK_OVERRIDE; |
+ virtual size_t onGetTableData(SkFontTableTag, size_t offset, |
+ size_t length, void* data) const SK_OVERRIDE; |
+ virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE; |
+ virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE; |
+ |
+private: |
+ typedef SkTypeface_FreeType INHERITED; |
+}; |
+ |