| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 */ | 100 */ |
| 101 virtual sk_sp<SkTypeface> makeTypeface(const FontIdentity& identity) { | 101 virtual sk_sp<SkTypeface> makeTypeface(const FontIdentity& identity) { |
| 102 return SkTypeface::MakeFromStream(this->openStream(identity), identity.f
TTCIndex); | 102 return SkTypeface::MakeFromStream(this->openStream(identity), identity.f
TTCIndex); |
| 103 } | 103 } |
| 104 #ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR | |
| 105 virtual SkTypeface* createTypeface(const FontIdentity& identity) { | |
| 106 return this->makeTypeface(identity).release(); | |
| 107 } | |
| 108 #endif | |
| 109 | 104 |
| 110 /** | 105 /** |
| 111 * Return a singleton instance of a direct subclass that calls into | 106 * Return a singleton instance of a direct subclass that calls into |
| 112 * libfontconfig. This does not affect the refcnt of the returned instance. | 107 * 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. | 108 * The mutex may be used to guarantee the singleton is only constructed onc
e. |
| 114 */ | 109 */ |
| 115 static SkFontConfigInterface* GetSingletonDirectInterface(); | 110 static SkFontConfigInterface* GetSingletonDirectInterface(); |
| 116 | 111 |
| 117 // New APIS, which have default impls for now (which do nothing) | 112 // New APIS, which have default impls for now (which do nothing) |
| 118 | 113 |
| 119 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } | 114 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } |
| 120 typedef SkRefCnt INHERITED; | 115 typedef SkRefCnt INHERITED; |
| 121 }; | 116 }; |
| 122 | 117 |
| 123 /** Creates a SkFontMgr which wraps a SkFontConfigInterface. */ | 118 /** Creates a SkFontMgr which wraps a SkFontConfigInterface. */ |
| 124 SK_API SkFontMgr* SkFontMgr_New_FCI(SkFontConfigInterface* fci); | 119 SK_API SkFontMgr* SkFontMgr_New_FCI(SkFontConfigInterface* fci); |
| 125 | 120 |
| 126 #endif | 121 #endif |
| OLD | NEW |