OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkFontConfigInterface_DEFINED | 8 #ifndef SkFontConfigInterface_DEFINED |
9 #define SkFontConfigInterface_DEFINED | 9 #define SkFontConfigInterface_DEFINED |
10 | 10 |
11 #include "SkDataTable.h" | 11 #include "SkDataTable.h" |
12 #include "SkFontStyle.h" | 12 #include "SkFontStyle.h" |
13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
14 #include "SkTArray.h" | 14 #include "SkTArray.h" |
15 #include "SkTypeface.h" | 15 #include "SkTypeface.h" |
16 | 16 |
| 17 struct SkBaseMutex; |
| 18 |
17 /** | 19 /** |
18 * \class SkFontConfigInterface | 20 * \class SkFontConfigInterface |
19 * | 21 * |
20 * Provides SkFontHost clients with access to fontconfig services. They will | 22 * Provides SkFontHost clients with access to fontconfig services. They will |
21 * access the global instance found in RefGlobal(). | 23 * access the global instance found in RefGlobal(). |
22 */ | 24 */ |
23 class SK_API SkFontConfigInterface : public SkRefCnt { | 25 class SK_API SkFontConfigInterface : public SkRefCnt { |
24 public: | 26 public: |
25 SK_DECLARE_INST_COUNT(SkFontConfigInterface) | 27 SK_DECLARE_INST_COUNT(SkFontConfigInterface) |
26 | 28 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 /** | 90 /** |
89 * Given a FontRef, open a stream to access its data, or return null | 91 * Given a FontRef, open a stream to access its data, or return null |
90 * if the FontRef's data is not available. The caller is responsible for | 92 * if the FontRef's data is not available. The caller is responsible for |
91 * calling stream->unref() when it is done accessing the data. | 93 * calling stream->unref() when it is done accessing the data. |
92 */ | 94 */ |
93 virtual SkStream* openStream(const FontIdentity&) = 0; | 95 virtual SkStream* openStream(const FontIdentity&) = 0; |
94 | 96 |
95 /** | 97 /** |
96 * Return a singleton instance of a direct subclass that calls into | 98 * Return a singleton instance of a direct subclass that calls into |
97 * libfontconfig. This does not affect the refcnt of the returned instance. | 99 * libfontconfig. This does not affect the refcnt of the returned instance. |
| 100 * The mutex may be used to guarantee the singleton is only constructed onc
e. |
98 */ | 101 */ |
99 static SkFontConfigInterface* GetSingletonDirectInterface(); | 102 static SkFontConfigInterface* GetSingletonDirectInterface |
| 103 (SkBaseMutex* mutex = NULL); |
100 | 104 |
101 // New APIS, which have default impls for now (which do nothing) | 105 // New APIS, which have default impls for now (which do nothing) |
102 | 106 |
103 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } | 107 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } |
104 virtual bool matchFamilySet(const char inFamilyName[], | 108 virtual bool matchFamilySet(const char inFamilyName[], |
105 SkString* outFamilyName, | 109 SkString* outFamilyName, |
106 SkTArray<FontIdentity>*) { | 110 SkTArray<FontIdentity>*) { |
107 return false; | 111 return false; |
108 } | 112 } |
109 typedef SkRefCnt INHERITED; | 113 typedef SkRefCnt INHERITED; |
110 }; | 114 }; |
111 | 115 |
112 #endif | 116 #endif |
OLD | NEW |