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 SkFontMgr_DEFINED | 8 #ifndef SkFontMgr_DEFINED |
9 #define SkFontMgr_DEFINED | 9 #define SkFontMgr_DEFINED |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 private: | 143 private: |
144 int fCollectionIndex; | 144 int fCollectionIndex; |
145 int fAxisCount; | 145 int fAxisCount; |
146 const Axis* fAxes; | 146 const Axis* fAxes; |
147 }; | 147 }; |
148 /* Experimental, API subject to change. */ | 148 /* Experimental, API subject to change. */ |
149 SkTypeface* createFromStream(SkStreamAsset*, const FontParameters&) const; | 149 SkTypeface* createFromStream(SkStreamAsset*, const FontParameters&) const; |
150 | 150 |
151 /** | 151 /** |
152 * Create a typeface from the specified font data. | 152 * Create a typeface from the specified font data. |
153 * Takes ownership of the font data, so the caller should not reference it
again. | |
154 * Will return NULL if the typeface could not be created. | 153 * Will return NULL if the typeface could not be created. |
155 * The caller must call unref() on the returned object if it is not null. | 154 * The caller must call unref() on the returned object if it is not null. |
156 */ | 155 */ |
157 SkTypeface* createFromFontData(SkFontData*) const; | 156 SkTypeface* createFromFontData(std::unique_ptr<SkFontData>) const; |
158 | 157 |
159 /** | 158 /** |
160 * Create a typeface for the specified fileName and TTC index | 159 * Create a typeface for the specified fileName and TTC index |
161 * (pass 0 for none) or NULL if the file is not found, or its contents are | 160 * (pass 0 for none) or NULL if the file is not found, or its contents are |
162 * not recognized. The caller must call unref() on the returned object | 161 * not recognized. The caller must call unref() on the returned object |
163 * if it is not null. | 162 * if it is not null. |
164 */ | 163 */ |
165 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; | 164 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; |
166 | 165 |
167 SkTypeface* legacyCreateTypeface(const char familyName[], SkFontStyle style)
const; | 166 SkTypeface* legacyCreateTypeface(const char familyName[], SkFontStyle style)
const; |
(...skipping 17 matching lines...) Expand all Loading... |
185 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, | 184 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con
st SkFontStyle&, |
186 const char* bcp47[], int bcp
47Count, | 185 const char* bcp47[], int bcp
47Count, |
187 SkUnichar character) const =
0; | 186 SkUnichar character) const =
0; |
188 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, | 187 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, |
189 const SkFontStyle&) const = 0; | 188 const SkFontStyle&) const = 0; |
190 | 189 |
191 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; | 190 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; |
192 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const =
0; | 191 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const =
0; |
193 // TODO: make pure virtual. | 192 // TODO: make pure virtual. |
194 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const FontParameters&
) const; | 193 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const FontParameters&
) const; |
195 virtual SkTypeface* onCreateFromFontData(SkFontData*) const; | 194 virtual SkTypeface* onCreateFromFontData(std::unique_ptr<SkFontData>) const; |
| 195 #ifdef SK_DECLARE_LEGACY_CREATE_FROM_FONTDATA |
| 196 virtual SkTypeface* onCreateFromFontData(SkFontData*) const { return nullptr
; }; |
| 197 #endif |
196 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; | 198 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; |
197 | 199 |
198 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontSt
yle) const = 0; | 200 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontSt
yle) const = 0; |
199 | 201 |
200 private: | 202 private: |
201 static SkFontMgr* Factory(); // implemented by porting layer | 203 static SkFontMgr* Factory(); // implemented by porting layer |
202 | 204 |
203 typedef SkRefCnt INHERITED; | 205 typedef SkRefCnt INHERITED; |
204 }; | 206 }; |
205 | 207 |
206 #endif | 208 #endif |
OLD | NEW |