| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 */ | 127 */ |
| 128 void serialize(SkWStream*) const; | 128 void serialize(SkWStream*) const; |
| 129 | 129 |
| 130 /** Given the data previously written by serialize(), return a new instance | 130 /** Given the data previously written by serialize(), return a new instance |
| 131 to a typeface referring to the same font. If that font is not available, | 131 to a typeface referring to the same font. If that font is not available, |
| 132 return null. If an instance is returned, the caller is responsible for | 132 return null. If an instance is returned, the caller is responsible for |
| 133 calling unref() when they are done with it. | 133 calling unref() when they are done with it. |
| 134 */ | 134 */ |
| 135 static SkTypeface* Deserialize(SkStream*); | 135 static SkTypeface* Deserialize(SkStream*); |
| 136 | 136 |
| 137 /** Retrieve detailed typeface metrics. Used by the PDF backend. | |
| 138 @param perGlyphInfo Indicate what glyph specific information (advances, | |
| 139 names, etc.) should be populated. | |
| 140 @param glyphIDs For per-glyph info, specify subset of the font by | |
| 141 giving glyph ids. Each integer represents a glyph | |
| 142 id. Passing NULL means all glyphs in the font. | |
| 143 @param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if | |
| 144 glyphIDs is NULL. | |
| 145 @return The returned object has already been referenced. | |
| 146 */ | |
| 147 SkAdvancedTypefaceMetrics* getAdvancedTypefaceMetrics( | |
| 148 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo, | |
| 149 const uint32_t* glyphIDs = NULL, | |
| 150 uint32_t glyphIDsCount = 0) const; | |
| 151 | |
| 152 enum Encoding { | 137 enum Encoding { |
| 153 kUTF8_Encoding, | 138 kUTF8_Encoding, |
| 154 kUTF16_Encoding, | 139 kUTF16_Encoding, |
| 155 kUTF32_Encoding | 140 kUTF32_Encoding |
| 156 }; | 141 }; |
| 157 | 142 |
| 158 /** | 143 /** |
| 159 * Given an array of character codes, of the specified encoding, | 144 * Given an array of character codes, of the specified encoding, |
| 160 * optionally return their corresponding glyph IDs (if glyphs is not NULL). | 145 * optionally return their corresponding glyph IDs (if glyphs is not NULL). |
| 161 * | 146 * |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 virtual bool onGetKerningPairAdjustments(const uint16_t glyphs[], int count, | 312 virtual bool onGetKerningPairAdjustments(const uint16_t glyphs[], int count, |
| 328 int32_t adjustments[]) const; | 313 int32_t adjustments[]) const; |
| 329 | 314 |
| 330 virtual LocalizedStrings* onCreateFamilyNameIterator() const = 0; | 315 virtual LocalizedStrings* onCreateFamilyNameIterator() const = 0; |
| 331 | 316 |
| 332 virtual int onGetTableTags(SkFontTableTag tags[]) const = 0; | 317 virtual int onGetTableTags(SkFontTableTag tags[]) const = 0; |
| 333 virtual size_t onGetTableData(SkFontTableTag, size_t offset, | 318 virtual size_t onGetTableData(SkFontTableTag, size_t offset, |
| 334 size_t length, void* data) const = 0; | 319 size_t length, void* data) const = 0; |
| 335 | 320 |
| 336 private: | 321 private: |
| 322 friend class SkGTypeface; |
| 323 friend class SkPDFFont; |
| 324 friend class SkPDFCIDFont; |
| 325 |
| 326 /** Retrieve detailed typeface metrics. Used by the PDF backend. |
| 327 @param perGlyphInfo Indicate what glyph specific information (advances, |
| 328 names, etc.) should be populated. |
| 329 @param glyphIDs For per-glyph info, specify subset of the font by |
| 330 giving glyph ids. Each integer represents a glyph |
| 331 id. Passing NULL means all glyphs in the font. |
| 332 @param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if |
| 333 glyphIDs is NULL. |
| 334 @return The returned object has already been referenced. |
| 335 */ |
| 336 SkAdvancedTypefaceMetrics* getAdvancedTypefaceMetrics( |
| 337 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo, |
| 338 const uint32_t* glyphIDs = NULL, |
| 339 uint32_t glyphIDsCount = 0) const; |
| 340 |
| 341 private: |
| 337 static void create_default_typeface(Style style); | 342 static void create_default_typeface(Style style); |
| 338 | 343 |
| 339 SkFontID fUniqueID; | 344 SkFontID fUniqueID; |
| 340 Style fStyle; | 345 Style fStyle; |
| 341 bool fIsFixedPitch; | 346 bool fIsFixedPitch; |
| 342 | 347 |
| 343 friend class SkPaint; | 348 friend class SkPaint; |
| 344 friend class SkGlyphCache; // GetDefaultTypeface | 349 friend class SkGlyphCache; // GetDefaultTypeface |
| 345 // just so deprecated fonthost can call protected methods | 350 // just so deprecated fonthost can call protected methods |
| 346 friend class SkFontHost; | 351 friend class SkFontHost; |
| 347 | 352 |
| 348 typedef SkWeakRefCnt INHERITED; | 353 typedef SkWeakRefCnt INHERITED; |
| 349 }; | 354 }; |
| 350 | 355 |
| 351 #endif | 356 #endif |
| OLD | NEW |