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 "SkTypeface.h" | 14 #include "SkTypeface.h" |
15 | 15 |
16 struct SkBaseMutex; | 16 struct SkBaseMutex; |
| 17 class SkFontMgr; |
17 | 18 |
18 /** | 19 /** |
19 * \class SkFontConfigInterface | 20 * \class SkFontConfigInterface |
20 * | 21 * |
21 * A simple interface for remotable font management. | 22 * A simple interface for remotable font management. |
22 * The global instance can be found with RefGlobal(). | 23 * The global instance can be found with RefGlobal(). |
23 */ | 24 */ |
24 class SK_API SkFontConfigInterface : public SkRefCnt { | 25 class SK_API SkFontConfigInterface : public SkRefCnt { |
25 public: | 26 public: |
26 | |
27 | 27 |
28 /** | 28 /** |
29 * Returns the global SkFontConfigInterface instance, and if it is not | 29 * Returns the global SkFontConfigInterface instance, and if it is not |
30 * NULL, calls ref() on it. The caller must balance this with a call to | 30 * NULL, calls ref() on it. The caller must balance this with a call to |
31 * unref(). | 31 * unref(). |
32 */ | 32 */ |
33 static SkFontConfigInterface* RefGlobal(); | 33 static SkFontConfigInterface* RefGlobal(); |
34 | 34 |
35 /** | 35 /** |
36 * Replace the current global instance with the specified one, safely | 36 * Replace the current global instance with the specified one, safely |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 */ | 103 */ |
104 virtual SkTypeface* createTypeface(const FontIdentity& identity) { | 104 virtual SkTypeface* createTypeface(const FontIdentity& identity) { |
105 return SkTypeface::CreateFromStream(this->openStream(identity), identity
.fTTCIndex); | 105 return SkTypeface::CreateFromStream(this->openStream(identity), identity
.fTTCIndex); |
106 } | 106 } |
107 | 107 |
108 /** | 108 /** |
109 * Return a singleton instance of a direct subclass that calls into | 109 * Return a singleton instance of a direct subclass that calls into |
110 * libfontconfig. This does not affect the refcnt of the returned instance. | 110 * libfontconfig. This does not affect the refcnt of the returned instance. |
111 * The mutex may be used to guarantee the singleton is only constructed onc
e. | 111 * The mutex may be used to guarantee the singleton is only constructed onc
e. |
112 */ | 112 */ |
113 static SkFontConfigInterface* GetSingletonDirectInterface(SkBaseMutex* mutex
= NULL); | 113 static SkFontConfigInterface* GetSingletonDirectInterface(); |
114 | 114 |
115 // New APIS, which have default impls for now (which do nothing) | 115 // New APIS, which have default impls for now (which do nothing) |
116 | 116 |
117 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } | 117 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } |
118 typedef SkRefCnt INHERITED; | 118 typedef SkRefCnt INHERITED; |
119 }; | 119 }; |
120 | 120 |
| 121 /** Creates a SkFontMgr which wraps a SkFontConfigInterface. */ |
| 122 SK_API SkFontMgr* SkFontMgr_New_FCI(SkFontConfigInterface* fci); |
| 123 |
121 #endif | 124 #endif |
OLD | NEW |