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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 /** | 275 /** |
276 * Return a stream for the contents of the font data, or NULL on failure. | 276 * Return a stream for the contents of the font data, or NULL on failure. |
277 * If ttcIndex is not null, it is set to the TrueTypeCollection index | 277 * If ttcIndex is not null, it is set to the TrueTypeCollection index |
278 * of this typeface within the stream, or 0 if the stream is not a | 278 * of this typeface within the stream, or 0 if the stream is not a |
279 * collection. | 279 * collection. |
280 */ | 280 */ |
281 SkStream* openStream(int* ttcIndex) const; | 281 SkStream* openStream(int* ttcIndex) const; |
282 | 282 |
283 /** | 283 /** |
284 * Search within this typeface's family for a best match to the | |
285 * specified style, and return a ref to that typeface. Note: the | |
286 * returned object could be this, if it is the best match, or it | |
287 * could be a different typeface. Either way, the caller must balance | |
288 * this call with unref() on the returned object. | |
289 * | |
290 * Will never return NULL. | |
291 */ | |
292 SkTypeface* refMatchingStyle(Style) const; | |
293 | |
294 /** | |
295 * Return a scalercontext for the given descriptor. If this fails, then | 284 * Return a scalercontext for the given descriptor. If this fails, then |
296 * if allowFailure is true, this returns NULL, else it returns a | 285 * if allowFailure is true, this returns NULL, else it returns a |
297 * dummy scalercontext that will not crash, but will draw nothing. | 286 * dummy scalercontext that will not crash, but will draw nothing. |
298 */ | 287 */ |
299 SkScalerContext* createScalerContext(const SkDescriptor*, | 288 SkScalerContext* createScalerContext(const SkDescriptor*, |
300 bool allowFailure = false) const; | 289 bool allowFailure = false) const; |
301 | 290 |
302 // PRIVATE / EXPERIMENTAL -- do not call | 291 // PRIVATE / EXPERIMENTAL -- do not call |
303 void filterRec(SkScalerContextRec* rec) const { | 292 void filterRec(SkScalerContextRec* rec) const { |
304 this->onFilterRec(rec); | 293 this->onFilterRec(rec); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 virtual int onGetUPEM() const = 0; | 326 virtual int onGetUPEM() const = 0; |
338 virtual bool onGetKerningPairAdjustments(const uint16_t glyphs[], int count, | 327 virtual bool onGetKerningPairAdjustments(const uint16_t glyphs[], int count, |
339 int32_t adjustments[]) const; | 328 int32_t adjustments[]) const; |
340 | 329 |
341 virtual LocalizedStrings* onCreateFamilyNameIterator() const = 0; | 330 virtual LocalizedStrings* onCreateFamilyNameIterator() const = 0; |
342 | 331 |
343 virtual int onGetTableTags(SkFontTableTag tags[]) const = 0; | 332 virtual int onGetTableTags(SkFontTableTag tags[]) const = 0; |
344 virtual size_t onGetTableData(SkFontTableTag, size_t offset, | 333 virtual size_t onGetTableData(SkFontTableTag, size_t offset, |
345 size_t length, void* data) const = 0; | 334 size_t length, void* data) const = 0; |
346 | 335 |
347 virtual SkTypeface* onRefMatchingStyle(Style styleBits) const = 0; | |
348 | |
349 private: | 336 private: |
350 SkFontID fUniqueID; | 337 SkFontID fUniqueID; |
351 Style fStyle; | 338 Style fStyle; |
352 bool fIsFixedPitch; | 339 bool fIsFixedPitch; |
353 | 340 |
354 friend class SkPaint; | 341 friend class SkPaint; |
355 friend class SkGlyphCache; // GetDefaultTypeface | 342 friend class SkGlyphCache; // GetDefaultTypeface |
356 // just so deprecated fonthost can call protected methods | 343 // just so deprecated fonthost can call protected methods |
357 friend class SkFontHost; | 344 friend class SkFontHost; |
358 | 345 |
359 typedef SkWeakRefCnt INHERITED; | 346 typedef SkWeakRefCnt INHERITED; |
360 }; | 347 }; |
361 | 348 |
362 #endif | 349 #endif |
OLD | NEW |