aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-25 20:38:07 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-25 20:38:07 +0000
commitd71fe99fe4d54230572223915166bea8efd67d85 (patch)
tree6409fc28b731e8562b9388223c3422d59e4f119d /include
parent789c6f291ecfff925086015360da525d6de1c835 (diff)
check-point: skiafy SkFontHost_fontconfig from chrome
git-svn-id: http://skia.googlecode.com/svn/trunk@7852 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/ports/SkFontConfigInterface.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h
new file mode 100644
index 0000000000..14f3a5d202
--- /dev/null
+++ b/include/ports/SkFontConfigInterface.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkFontConfigInterface_DEFINED
+#define SkFontConfigInterface_DEFINED
+
+#include "SkRefCnt.h"
+
+/**
+ * \class SkFontConfigInterface
+ *
+ * Provides SkFontHost clients with access to fontconfig services. They will
+ * access the global instance found in RefGlobal().
+ */
+class SkFontConfigInterface : public SkRefCnt {
+public:
+ /**
+ * Returns the global SkFontConfigInterface instance, and if it is not
+ * NULL, calls ref() on it. The caller must balance this with a call to
+ * unref().
+ */
+ static SkFontConfigInterface* RefGlobal();
+
+ /**
+ * Replace the current global instance with the specified one, safely
+ * ref'ing the new instance, and unref'ing the previous. Returns its
+ * parameter (the new global instance).
+ */
+ static SkFontConfigInterface* SetGlobal(SkFontConfigInterface*);
+
+ /**
+ * Given a familyName and style, find the best matching font and return
+ * its fileFaceID and actual style (if outStyle is not null) and return
+ * true. If no matching font can be found, ignore fileFaceID and outStyle
+ * and return false.
+ */
+ virtual bool match(const char familyName[], SkTypeface::Style requested,
+ unsigned* fileFaceID, SkTypeface::Style* outStyle) = 0;
+
+ /**
+ * Given a fileFaceID (returned by match), return the associated familyName
+ * and return true. If the associated name cannot be returned, ignore the
+ * name parameter, and return false.
+ */
+ virtual bool getFamilyName(unsigned fileFaceID, SkString* name) = 0;
+
+ /**
+ * Given a fileFaceID (returned by match), open a stream to access its
+ * data, which the caller while take ownership of (and will call unref()
+ * when they're through). On failure, return NULL.
+ */
+ virtual SkStream* openStream(unsigned fileFaceID) = 0;
+};
+
+#endif