| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 */ | 186 */ |
| 187 size_t getTableData(SkFontTableTag tag, size_t offset, size_t length, | 187 size_t getTableData(SkFontTableTag tag, size_t offset, size_t length, |
| 188 void* data) const; | 188 void* data) const; |
| 189 | 189 |
| 190 /** | 190 /** |
| 191 * Return the units-per-em value for this typeface, or zero if there is an | 191 * Return the units-per-em value for this typeface, or zero if there is an |
| 192 * error. | 192 * error. |
| 193 */ | 193 */ |
| 194 int getUnitsPerEm() const; | 194 int getUnitsPerEm() const; |
| 195 | 195 |
| 196 /** |
| 197 * Return a stream for the contents of the font data, or NULL on failure. |
| 198 * If ttcIndex is not null, it is set to the TrueTypeCollection index |
| 199 * of this typeface within the stream, or 0 if the stream is not a |
| 200 * collection. |
| 201 */ |
| 196 SkStream* openStream(int* ttcIndex) const; | 202 SkStream* openStream(int* ttcIndex) const; |
| 197 SkScalerContext* createScalerContext(const SkDescriptor*) const; | 203 SkScalerContext* createScalerContext(const SkDescriptor*) const; |
| 198 | 204 |
| 199 protected: | 205 protected: |
| 200 /** uniqueID must be unique and non-zero | 206 /** uniqueID must be unique and non-zero |
| 201 */ | 207 */ |
| 202 SkTypeface(Style style, SkFontID uniqueID, bool isFixedWidth = false); | 208 SkTypeface(Style style, SkFontID uniqueID, bool isFixedWidth = false); |
| 203 virtual ~SkTypeface(); | 209 virtual ~SkTypeface(); |
| 204 | 210 |
| 205 friend class SkScalerContext; | 211 friend class SkScalerContext; |
| 206 static SkTypeface* GetDefaultTypeface(); | 212 static SkTypeface* GetDefaultTypeface(); |
| 207 | 213 |
| 208 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const =
0; | 214 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const =
0; |
| 209 virtual void onFilterRec(SkScalerContextRec*) const = 0; | 215 virtual void onFilterRec(SkScalerContextRec*) const = 0; |
| 210 | 216 |
| 211 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( | 217 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( |
| 212 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo, | 218 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo, |
| 213 const uint32_t* glyphIDs, | 219 const uint32_t* glyphIDs, |
| 214 uint32_t glyphIDsCount) const = 0; | 220 uint32_t glyphIDsCount) const = 0; |
| 221 // TODO: remove SkFontHost::OpenStream and make this guy pure-virtual |
| 222 virtual SkStream* onOpenStream(int* ttcIndex) const; |
| 215 | 223 |
| 216 virtual int onGetUPEM() const; | 224 virtual int onGetUPEM() const; |
| 225 |
| 217 virtual int onGetTableTags(SkFontTableTag tags[]) const; | 226 virtual int onGetTableTags(SkFontTableTag tags[]) const; |
| 218 virtual size_t onGetTableData(SkFontTableTag, size_t offset, | 227 virtual size_t onGetTableData(SkFontTableTag, size_t offset, |
| 219 size_t length, void* data) const; | 228 size_t length, void* data) const; |
| 220 virtual void onGetFontDescriptor(SkFontDescriptor*) const; | 229 virtual void onGetFontDescriptor(SkFontDescriptor*) const; |
| 221 | 230 |
| 222 private: | 231 private: |
| 223 SkFontID fUniqueID; | 232 SkFontID fUniqueID; |
| 224 Style fStyle; | 233 Style fStyle; |
| 225 bool fIsFixedWidth; | 234 bool fIsFixedWidth; |
| 226 | 235 |
| 227 friend class SkPaint; | 236 friend class SkPaint; |
| 228 friend class SkGlyphCache; // GetDefaultTypeface | 237 friend class SkGlyphCache; // GetDefaultTypeface |
| 229 // just so deprecated fonthost can call protected methods | 238 // just so deprecated fonthost can call protected methods |
| 230 friend class SkFontHost; | 239 friend class SkFontHost; |
| 231 | 240 |
| 232 typedef SkWeakRefCnt INHERITED; | 241 typedef SkWeakRefCnt INHERITED; |
| 233 }; | 242 }; |
| 234 | 243 |
| 235 #endif | 244 #endif |
| OLD | NEW |