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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 void serialize(SkWStream*) const; | 138 void serialize(SkWStream*) const; |
139 | 139 |
140 /** Like serialize, but write the whole font (not just a signature) if possi
ble. | 140 /** Like serialize, but write the whole font (not just a signature) if possi
ble. |
141 */ | 141 */ |
142 void serializeForcingEmbedding(SkWStream*) const; | 142 void serializeForcingEmbedding(SkWStream*) const; |
143 | 143 |
144 /** Given the data previously written by serialize(), return a new instance | 144 /** Given the data previously written by serialize(), return a new instance |
145 to a typeface referring to the same font. If that font is not available, | 145 to a typeface referring to the same font. If that font is not available, |
146 return null. If an instance is returned, the caller is responsible for | 146 return null. If an instance is returned, the caller is responsible for |
147 calling unref() when they are done with it. | 147 calling unref() when they are done with it. |
| 148 Does not affect ownership of SkStream. |
148 */ | 149 */ |
149 static SkTypeface* Deserialize(SkStream*); | 150 static SkTypeface* Deserialize(SkStream*); |
150 | 151 |
151 enum Encoding { | 152 enum Encoding { |
152 kUTF8_Encoding, | 153 kUTF8_Encoding, |
153 kUTF16_Encoding, | 154 kUTF16_Encoding, |
154 kUTF32_Encoding | 155 kUTF32_Encoding |
155 }; | 156 }; |
156 | 157 |
157 /** | 158 /** |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 * encoded as UTF8, but the language of the name is whatever the host | 270 * encoded as UTF8, but the language of the name is whatever the host |
270 * platform chooses. | 271 * platform chooses. |
271 */ | 272 */ |
272 void getFamilyName(SkString* name) const; | 273 void getFamilyName(SkString* name) const; |
273 | 274 |
274 /** | 275 /** |
275 * 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. |
276 * 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 |
277 * 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 |
278 * collection. | 279 * collection. |
| 280 * The caller is responsible for deleting the stream. |
279 */ | 281 */ |
280 SkStream* openStream(int* ttcIndex) const; | 282 SkStream* openStream(int* ttcIndex) const; |
281 | 283 |
282 /** | 284 /** |
283 * Return a scalercontext for the given descriptor. If this fails, then | 285 * Return a scalercontext for the given descriptor. If this fails, then |
284 * if allowFailure is true, this returns NULL, else it returns a | 286 * if allowFailure is true, this returns NULL, else it returns a |
285 * dummy scalercontext that will not crash, but will draw nothing. | 287 * dummy scalercontext that will not crash, but will draw nothing. |
286 */ | 288 */ |
287 SkScalerContext* createScalerContext(const SkDescriptor*, | 289 SkScalerContext* createScalerContext(const SkDescriptor*, |
288 bool allowFailure = false) const; | 290 bool allowFailure = false) const; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 385 |
384 friend class SkPaint; | 386 friend class SkPaint; |
385 friend class SkGlyphCache; // GetDefaultTypeface | 387 friend class SkGlyphCache; // GetDefaultTypeface |
386 // just so deprecated fonthost can call protected methods | 388 // just so deprecated fonthost can call protected methods |
387 friend class SkFontHost; | 389 friend class SkFontHost; |
388 | 390 |
389 typedef SkWeakRefCnt INHERITED; | 391 typedef SkWeakRefCnt INHERITED; |
390 }; | 392 }; |
391 | 393 |
392 #endif | 394 #endif |
OLD | NEW |