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 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 * if the FontRef's data is not available. The caller is responsible for | 90 * if the FontRef's data is not available. The caller is responsible for |
91 * deleting the stream when it is done accessing the data. | 91 * deleting the stream when it is done accessing the data. |
92 */ | 92 */ |
93 virtual SkStreamAsset* openStream(const FontIdentity&) = 0; | 93 virtual SkStreamAsset* openStream(const FontIdentity&) = 0; |
94 | 94 |
95 /** | 95 /** |
96 * Return an SkTypeface for the given FontIdentity. | 96 * Return an SkTypeface for the given FontIdentity. |
97 * | 97 * |
98 * The default implementation simply returns a new typeface built using dat
a obtained from | 98 * The default implementation simply returns a new typeface built using dat
a obtained from |
99 * openStream(), but derived classes may implement more complex caching sch
emes. | 99 * openStream(), but derived classes may implement more complex caching sch
emes. |
| 100 * |
| 101 * Callers are responsible for unref-ing the result. |
100 */ | 102 */ |
101 virtual sk_sp<SkTypeface> makeTypeface(const FontIdentity& identity) { | 103 virtual SkTypeface* createTypeface(const FontIdentity& identity) { |
102 return SkTypeface::MakeFromStream(this->openStream(identity), identity.f
TTCIndex); | 104 return SkTypeface::CreateFromStream(this->openStream(identity), identity
.fTTCIndex); |
103 } | 105 } |
104 #ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR | |
105 virtual SkTypeface* createTypeface(const FontIdentity& identity) { | |
106 return this->makeTypeface(identity).release(); | |
107 } | |
108 #endif | |
109 | 106 |
110 /** | 107 /** |
111 * Return a singleton instance of a direct subclass that calls into | 108 * Return a singleton instance of a direct subclass that calls into |
112 * libfontconfig. This does not affect the refcnt of the returned instance. | 109 * libfontconfig. This does not affect the refcnt of the returned instance. |
113 * The mutex may be used to guarantee the singleton is only constructed onc
e. | 110 * The mutex may be used to guarantee the singleton is only constructed onc
e. |
114 */ | 111 */ |
115 static SkFontConfigInterface* GetSingletonDirectInterface(); | 112 static SkFontConfigInterface* GetSingletonDirectInterface(); |
116 | 113 |
117 // New APIS, which have default impls for now (which do nothing) | 114 // New APIS, which have default impls for now (which do nothing) |
118 | 115 |
119 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } | 116 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } |
120 typedef SkRefCnt INHERITED; | 117 typedef SkRefCnt INHERITED; |
121 }; | 118 }; |
122 | 119 |
123 /** Creates a SkFontMgr which wraps a SkFontConfigInterface. */ | 120 /** Creates a SkFontMgr which wraps a SkFontConfigInterface. */ |
124 SK_API SkFontMgr* SkFontMgr_New_FCI(SkFontConfigInterface* fci); | 121 SK_API SkFontMgr* SkFontMgr_New_FCI(SkFontConfigInterface* fci); |
125 | 122 |
126 #endif | 123 #endif |
OLD | NEW |