OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkTypeface_DEFINED | 10 #ifndef SkTypeface_DEFINED |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 /** | 234 /** |
235 * Return a stream for the contents of the font data, or NULL on failure. | 235 * Return a stream for the contents of the font data, or NULL on failure. |
236 * If ttcIndex is not null, it is set to the TrueTypeCollection index | 236 * If ttcIndex is not null, it is set to the TrueTypeCollection index |
237 * of this typeface within the stream, or 0 if the stream is not a | 237 * of this typeface within the stream, or 0 if the stream is not a |
238 * collection. | 238 * collection. |
239 */ | 239 */ |
240 SkStream* openStream(int* ttcIndex) const; | 240 SkStream* openStream(int* ttcIndex) const; |
241 | 241 |
242 /** | 242 /** |
| 243 * Search within this typeface's family for a best match to the |
| 244 * specified style, and return a ref to that typeface. Note: the |
| 245 * returned object could be this, if it is the best match, or it |
| 246 * could be a different typeface. Either way, the caller must balance |
| 247 * this call with unref() on the returned object. |
| 248 * |
| 249 * Will never return NULL. |
| 250 */ |
| 251 SkTypeface* refMatchingStyle(Style) const; |
| 252 |
| 253 /** |
243 * Return a scalercontext for the given descriptor. If this fails, then | 254 * Return a scalercontext for the given descriptor. If this fails, then |
244 * if allowFailure is true, this returns NULL, else it returns a | 255 * if allowFailure is true, this returns NULL, else it returns a |
245 * dummy scalercontext that will not crash, but will draw nothing. | 256 * dummy scalercontext that will not crash, but will draw nothing. |
246 */ | 257 */ |
247 SkScalerContext* createScalerContext(const SkDescriptor*, | 258 SkScalerContext* createScalerContext(const SkDescriptor*, |
248 bool allowFailure = false) const; | 259 bool allowFailure = false) const; |
249 | 260 |
250 // PRIVATE / EXPERIMENTAL -- do not call | 261 // PRIVATE / EXPERIMENTAL -- do not call |
251 void filterRec(SkScalerContextRec* rec) const { | 262 void filterRec(SkScalerContextRec* rec) const { |
252 this->onFilterRec(rec); | 263 this->onFilterRec(rec); |
(...skipping 27 matching lines...) Expand all Loading... |
280 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[], | 291 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[], |
281 int glyphCount) const; | 292 int glyphCount) const; |
282 virtual int onCountGlyphs() const = 0; | 293 virtual int onCountGlyphs() const = 0; |
283 | 294 |
284 virtual int onGetUPEM() const = 0; | 295 virtual int onGetUPEM() const = 0; |
285 | 296 |
286 virtual int onGetTableTags(SkFontTableTag tags[]) const; | 297 virtual int onGetTableTags(SkFontTableTag tags[]) const; |
287 virtual size_t onGetTableData(SkFontTableTag, size_t offset, | 298 virtual size_t onGetTableData(SkFontTableTag, size_t offset, |
288 size_t length, void* data) const; | 299 size_t length, void* data) const; |
289 | 300 |
| 301 // TODO: make this pure-virtual when all ports have overridden it |
| 302 virtual SkTypeface* onRefMatchingStyle(Style styleBits) const { |
| 303 SkASSERT(!"unimplemented"); |
| 304 this->ref(); |
| 305 return const_cast<SkTypeface*>(this); |
| 306 } |
| 307 |
290 private: | 308 private: |
291 SkFontID fUniqueID; | 309 SkFontID fUniqueID; |
292 Style fStyle; | 310 Style fStyle; |
293 bool fIsFixedPitch; | 311 bool fIsFixedPitch; |
294 | 312 |
295 friend class SkPaint; | 313 friend class SkPaint; |
296 friend class SkGlyphCache; // GetDefaultTypeface | 314 friend class SkGlyphCache; // GetDefaultTypeface |
297 // just so deprecated fonthost can call protected methods | 315 // just so deprecated fonthost can call protected methods |
298 friend class SkFontHost; | 316 friend class SkFontHost; |
299 | 317 |
300 typedef SkWeakRefCnt INHERITED; | 318 typedef SkWeakRefCnt INHERITED; |
301 }; | 319 }; |
302 | 320 |
303 #endif | 321 #endif |
OLD | NEW |