| 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 |
| 11 #define SkTypeface_DEFINED | 11 #define SkTypeface_DEFINED |
| 12 | 12 |
| 13 #include "SkAdvancedTypefaceMetrics.h" | 13 #include "SkAdvancedTypefaceMetrics.h" |
| 14 #include "SkWeakRefCnt.h" | 14 #include "SkWeakRefCnt.h" |
| 15 | 15 |
| 16 class SkDescriptor; | 16 class SkDescriptor; |
| 17 class SkFontDescriptor; | 17 class SkFontDescriptor; |
| 18 class SkScalerContext; | 18 class SkScalerContext; |
| 19 struct SkScalerContextRec; | 19 struct SkScalerContextRec; |
| 20 class SkStream; | 20 class SkStream; |
| 21 class SkAdvancedTypefaceMetrics; | 21 class SkAdvancedTypefaceMetrics; |
| 22 class SkWStream; | 22 class SkWStream; |
| 23 | 23 |
| 24 typedef uint32_t SkFontID; | 24 typedef uint32_t SkFontID; |
| 25 /** Machine endian. */ |
| 25 typedef uint32_t SkFontTableTag; | 26 typedef uint32_t SkFontTableTag; |
| 26 | 27 |
| 27 /** \class SkTypeface | 28 /** \class SkTypeface |
| 28 | 29 |
| 29 The SkTypeface class specifies the typeface and intrinsic style of a font. | 30 The SkTypeface class specifies the typeface and intrinsic style of a font. |
| 30 This is used in the paint, along with optionally algorithmic settings like | 31 This is used in the paint, along with optionally algorithmic settings like |
| 31 textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify | 32 textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify |
| 32 how text appears when drawn (and measured). | 33 how text appears when drawn (and measured). |
| 33 | 34 |
| 34 Typeface objects are immutable, and so they can be shared between threads. | 35 Typeface objects are immutable, and so they can be shared between threads. |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 uint32_t glyphIDsCount) const = 0; | 288 uint32_t glyphIDsCount) const = 0; |
| 288 virtual SkStream* onOpenStream(int* ttcIndex) const = 0; | 289 virtual SkStream* onOpenStream(int* ttcIndex) const = 0; |
| 289 virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0
; | 290 virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0
; |
| 290 | 291 |
| 291 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[], | 292 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[], |
| 292 int glyphCount) const; | 293 int glyphCount) const; |
| 293 virtual int onCountGlyphs() const = 0; | 294 virtual int onCountGlyphs() const = 0; |
| 294 | 295 |
| 295 virtual int onGetUPEM() const = 0; | 296 virtual int onGetUPEM() const = 0; |
| 296 | 297 |
| 297 virtual int onGetTableTags(SkFontTableTag tags[]) const; | 298 virtual int onGetTableTags(SkFontTableTag tags[]) const = 0; |
| 298 virtual size_t onGetTableData(SkFontTableTag, size_t offset, | 299 virtual size_t onGetTableData(SkFontTableTag, size_t offset, |
| 299 size_t length, void* data) const; | 300 size_t length, void* data) const = 0; |
| 300 | 301 |
| 301 // TODO: make this pure-virtual when all ports have overridden it | 302 virtual SkTypeface* onRefMatchingStyle(Style styleBits) const = 0; |
| 302 virtual SkTypeface* onRefMatchingStyle(Style styleBits) const { | |
| 303 SkASSERT(0); | |
| 304 this->ref(); | |
| 305 return const_cast<SkTypeface*>(this); | |
| 306 } | |
| 307 | 303 |
| 308 private: | 304 private: |
| 309 SkFontID fUniqueID; | 305 SkFontID fUniqueID; |
| 310 Style fStyle; | 306 Style fStyle; |
| 311 bool fIsFixedPitch; | 307 bool fIsFixedPitch; |
| 312 | 308 |
| 313 friend class SkPaint; | 309 friend class SkPaint; |
| 314 friend class SkGlyphCache; // GetDefaultTypeface | 310 friend class SkGlyphCache; // GetDefaultTypeface |
| 315 // just so deprecated fonthost can call protected methods | 311 // just so deprecated fonthost can call protected methods |
| 316 friend class SkFontHost; | 312 friend class SkFontHost; |
| 317 | 313 |
| 318 typedef SkWeakRefCnt INHERITED; | 314 typedef SkWeakRefCnt INHERITED; |
| 319 }; | 315 }; |
| 320 | 316 |
| 321 #endif | 317 #endif |
| OLD | NEW |