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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 SkTypeface::Style* outStyle) = 0; | 88 SkTypeface::Style* outStyle) = 0; |
89 | 89 |
90 /** | 90 /** |
91 * 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 |
92 * 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 |
93 * deleting the stream when it is done accessing the data. | 93 * deleting the stream when it is done accessing the data. |
94 */ | 94 */ |
95 virtual SkStreamAsset* openStream(const FontIdentity&) = 0; | 95 virtual SkStreamAsset* openStream(const FontIdentity&) = 0; |
96 | 96 |
97 /** | 97 /** |
98 * Return an SkTypeface for the given FontIdentity. | |
99 * | |
100 * The default implementation simply returns a new typeface built using dat a obtained from | |
101 * openStream(), but derived classes may implement more complex caching sch emes. | |
102 */ | |
103 virtual SkTypeface* getTypeface(const FontIdentity& identity) { | |
reed1
2015/11/20 15:30:14
We usually use get... to return a non-ownership-tr
f(malita)
2015/11/20 15:43:00
Done.
(renamed to createTypeface)
| |
104 return SkTypeface::CreateFromStream(this->openStream(identity), identity .fTTCIndex); | |
105 } | |
106 | |
107 /** | |
98 * Return a singleton instance of a direct subclass that calls into | 108 * Return a singleton instance of a direct subclass that calls into |
99 * libfontconfig. This does not affect the refcnt of the returned instance. | 109 * 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. | 110 * The mutex may be used to guarantee the singleton is only constructed onc e. |
101 */ | 111 */ |
102 static SkFontConfigInterface* GetSingletonDirectInterface(SkBaseMutex* mutex = NULL); | 112 static SkFontConfigInterface* GetSingletonDirectInterface(SkBaseMutex* mutex = NULL); |
103 | 113 |
104 // New APIS, which have default impls for now (which do nothing) | 114 // New APIS, which have default impls for now (which do nothing) |
105 | 115 |
106 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } | 116 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } |
107 virtual bool matchFamilySet(const char[] /*inFamilyName*/, | 117 virtual bool matchFamilySet(const char[] /*inFamilyName*/, |
108 SkString* /*outFamilyName*/, | 118 SkString* /*outFamilyName*/, |
109 SkTArray<FontIdentity>*) { | 119 SkTArray<FontIdentity>*) { |
110 return false; | 120 return false; |
111 } | 121 } |
112 typedef SkRefCnt INHERITED; | 122 typedef SkRefCnt INHERITED; |
113 }; | 123 }; |
114 | 124 |
115 #endif | 125 #endif |
OLD | NEW |