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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 SkTypeface* createFromFontData(SkFontData*) const; | 157 SkTypeface* createFromFontData(SkFontData*) const; |
158 | 158 |
159 /** | 159 /** |
160 * Create a typeface for the specified fileName and TTC index | 160 * 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 | 161 * (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 | 162 * not recognized. The caller must call unref() on the returned object |
163 * if it is not null. | 163 * if it is not null. |
164 */ | 164 */ |
165 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; | 165 SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const; |
166 | 166 |
167 SkTypeface* legacyCreateTypeface(const char familyName[], | 167 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE |
168 unsigned typefaceStyleBits) const; | 168 SkTypeface* legacyCreateTypeface(const char familyName[], unsigned typefaceS
tyleBits) const; |
| 169 #else |
| 170 SkTypeface* legacyCreateTypeface(const char familyName[], SkFontStyle style)
const; |
| 171 #endif |
169 | 172 |
170 /** | 173 /** |
171 * Return a ref to the default fontmgr. The caller must call unref() on | 174 * Return a ref to the default fontmgr. The caller must call unref() on |
172 * the returned object. | 175 * the returned object. |
173 */ | 176 */ |
174 static SkFontMgr* RefDefault(); | 177 static SkFontMgr* RefDefault(); |
175 | 178 |
176 protected: | 179 protected: |
177 virtual int onCountFamilies() const = 0; | 180 virtual int onCountFamilies() const = 0; |
178 virtual void onGetFamilyName(int index, SkString* familyName) const = 0; | 181 virtual void onGetFamilyName(int index, SkString* familyName) const = 0; |
(...skipping 10 matching lines...) Expand all Loading... |
189 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, | 192 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, |
190 const SkFontStyle&) const = 0; | 193 const SkFontStyle&) const = 0; |
191 | 194 |
192 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; | 195 virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0; |
193 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const =
0; | 196 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const =
0; |
194 // TODO: make pure virtual. | 197 // TODO: make pure virtual. |
195 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const FontParameters&
) const; | 198 virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const FontParameters&
) const; |
196 virtual SkTypeface* onCreateFromFontData(SkFontData*) const; | 199 virtual SkTypeface* onCreateFromFontData(SkFontData*) const; |
197 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; | 200 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
= 0; |
198 | 201 |
| 202 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE |
199 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 203 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
200 unsigned styleBits) const = 0; | 204 unsigned styleBits) const = 0; |
| 205 #else |
| 206 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontSt
yle) const = 0; |
| 207 #endif |
| 208 |
201 private: | 209 private: |
202 static SkFontMgr* Factory(); // implemented by porting layer | 210 static SkFontMgr* Factory(); // implemented by porting layer |
203 friend SkFontMgr* sk_fontmgr_create_default(); | 211 friend SkFontMgr* sk_fontmgr_create_default(); |
204 | 212 |
205 typedef SkRefCnt INHERITED; | 213 typedef SkRefCnt INHERITED; |
206 }; | 214 }; |
207 | 215 |
208 #endif | 216 #endif |
OLD | NEW |