aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-15 20:11:20 +0000
committerGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-15 20:11:20 +0000
commit6930b57221ea7010dcab516559fa6bc5a0fb3807 (patch)
tree80ff6298d08f05a1a305256b25d03beec9e7cb7b
parent9bf99c31a9b1d1400e8aff4e93cc8aae15ebd2e1 (diff)
Move the FontConfigTypeface class into private header.
R=reed@google.com Review URL: https://codereview.chromium.org/15111004 git-svn-id: http://skia.googlecode.com/svn/trunk@9154 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/ports/SkFontConfigTypeface.h63
-rw-r--r--src/ports/SkFontHost_fontconfig.cpp52
2 files changed, 64 insertions, 51 deletions
diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h
new file mode 100644
index 0000000000..71f80b7318
--- /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;
+};
+
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
index dcf4a9d25d..f42ab3fc99 100644
--- a/src/ports/SkFontHost_fontconfig.cpp
+++ b/src/ports/SkFontHost_fontconfig.cpp
@@ -6,6 +6,7 @@
*/
#include "SkFontConfigInterface.h"
+#include "SkFontConfigTypeface.h"
#include "SkFontDescriptor.h"
#include "SkFontHost.h"
#include "SkFontHost_FreeType_common.h"
@@ -55,57 +56,6 @@ SkFontConfigInterface* SkFontHost_fontconfig_ref_global() {
///////////////////////////////////////////////////////////////////////////////
-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;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
struct FindRec {
FindRec(const char* name, SkTypeface::Style style)
: fFamilyName(name) // don't need to make a deep copy