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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 int getUnitsPerEm() const; | 226 int getUnitsPerEm() const; |
227 | 227 |
228 struct LocalizedString { | 228 struct LocalizedString { |
229 SkString fString; | 229 SkString fString; |
230 SkString fLanguage; | 230 SkString fLanguage; |
231 }; | 231 }; |
232 class LocalizedStrings : ::SkNoncopyable { | 232 class LocalizedStrings : ::SkNoncopyable { |
233 public: | 233 public: |
234 virtual ~LocalizedStrings() { } | 234 virtual ~LocalizedStrings() { } |
235 virtual bool next(LocalizedString* localizedString) = 0; | 235 virtual bool next(LocalizedString* localizedString) = 0; |
| 236 void unref() { SkDELETE(this); } |
236 }; | 237 }; |
237 /** | 238 /** |
238 * Returns an iterator which will attempt to enumerate all of the | 239 * Returns an iterator which will attempt to enumerate all of the |
239 * family names specified by the font. | 240 * family names specified by the font. |
240 * It is the caller's responsibility to SK_DELETE the returned pointer. | 241 * It is the caller's responsibility to unref() the returned pointer. |
241 */ | 242 */ |
242 LocalizedStrings* getFamilyNames() const; | 243 LocalizedStrings* createFamilyNameIterator() const; |
243 | 244 |
244 /** | 245 /** |
245 * Return the family name for this typeface. It will always be returned | 246 * Return the family name for this typeface. It will always be returned |
246 * encoded as UTF8, but the language of the name is whatever the host | 247 * encoded as UTF8, but the language of the name is whatever the host |
247 * platform chooses. | 248 * platform chooses. |
248 */ | 249 */ |
249 void getFamilyName(SkString* name) const; | 250 void getFamilyName(SkString* name) const; |
250 | 251 |
251 /** | 252 /** |
252 * Return a stream for the contents of the font data, or NULL on failure. | 253 * Return a stream for the contents of the font data, or NULL on failure. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 uint32_t glyphIDsCount) const = 0; | 305 uint32_t glyphIDsCount) const = 0; |
305 virtual SkStream* onOpenStream(int* ttcIndex) const = 0; | 306 virtual SkStream* onOpenStream(int* ttcIndex) const = 0; |
306 virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0
; | 307 virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0
; |
307 | 308 |
308 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[], | 309 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[], |
309 int glyphCount) const; | 310 int glyphCount) const; |
310 virtual int onCountGlyphs() const = 0; | 311 virtual int onCountGlyphs() const = 0; |
311 | 312 |
312 virtual int onGetUPEM() const = 0; | 313 virtual int onGetUPEM() const = 0; |
313 | 314 |
314 virtual LocalizedStrings* onGetFamilyNames() const = 0; | 315 virtual LocalizedStrings* onCreateFamilyNameIterator() const = 0; |
315 | 316 |
316 virtual int onGetTableTags(SkFontTableTag tags[]) const = 0; | 317 virtual int onGetTableTags(SkFontTableTag tags[]) const = 0; |
317 virtual size_t onGetTableData(SkFontTableTag, size_t offset, | 318 virtual size_t onGetTableData(SkFontTableTag, size_t offset, |
318 size_t length, void* data) const = 0; | 319 size_t length, void* data) const = 0; |
319 | 320 |
320 virtual SkTypeface* onRefMatchingStyle(Style styleBits) const = 0; | 321 virtual SkTypeface* onRefMatchingStyle(Style styleBits) const = 0; |
321 | 322 |
322 private: | 323 private: |
323 SkFontID fUniqueID; | 324 SkFontID fUniqueID; |
324 Style fStyle; | 325 Style fStyle; |
325 bool fIsFixedPitch; | 326 bool fIsFixedPitch; |
326 | 327 |
327 friend class SkPaint; | 328 friend class SkPaint; |
328 friend class SkGlyphCache; // GetDefaultTypeface | 329 friend class SkGlyphCache; // GetDefaultTypeface |
329 // just so deprecated fonthost can call protected methods | 330 // just so deprecated fonthost can call protected methods |
330 friend class SkFontHost; | 331 friend class SkFontHost; |
331 | 332 |
332 typedef SkWeakRefCnt INHERITED; | 333 typedef SkWeakRefCnt INHERITED; |
333 }; | 334 }; |
334 | 335 |
335 #endif | 336 #endif |
OLD | NEW |