OLD | NEW |
| 1 |
1 /* | 2 /* |
2 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
3 * | 4 * |
4 * 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 |
5 * found in the LICENSE file. | 6 * found in the LICENSE file. |
6 */ | 7 */ |
7 | 8 |
| 9 |
8 #ifndef SkTypeface_DEFINED | 10 #ifndef SkTypeface_DEFINED |
9 #define SkTypeface_DEFINED | 11 #define SkTypeface_DEFINED |
10 | 12 |
11 #include "../private/SkOncePtr.h" | 13 #include "../private/SkOncePtr.h" |
12 #include "../private/SkWeakRefCnt.h" | 14 #include "../private/SkWeakRefCnt.h" |
13 #include "SkFontStyle.h" | 15 #include "SkFontStyle.h" |
14 #include "SkRect.h" | 16 #include "SkRect.h" |
15 #include "SkString.h" | 17 #include "SkString.h" |
16 | 18 |
17 class SkDescriptor; | 19 class SkDescriptor; |
18 class SkFontData; | 20 class SkFontData; |
19 class SkFontDescriptor; | 21 class SkFontDescriptor; |
20 class SkScalerContext; | 22 class SkScalerContext; |
21 struct SkScalerContextRec; | 23 struct SkScalerContextRec; |
22 struct SkScalerContextEffects; | |
23 class SkStream; | 24 class SkStream; |
24 class SkStreamAsset; | 25 class SkStreamAsset; |
25 class SkAdvancedTypefaceMetrics; | 26 class SkAdvancedTypefaceMetrics; |
26 class SkWStream; | 27 class SkWStream; |
27 | 28 |
28 typedef uint32_t SkFontID; | 29 typedef uint32_t SkFontID; |
29 /** Machine endian. */ | 30 /** Machine endian. */ |
30 typedef uint32_t SkFontTableTag; | 31 typedef uint32_t SkFontTableTag; |
31 | 32 |
32 /** \class SkTypeface | 33 /** \class SkTypeface |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 * Return the font data, or NULL on failure. | 288 * Return the font data, or NULL on failure. |
288 * The caller is responsible for deleting the font data. | 289 * The caller is responsible for deleting the font data. |
289 */ | 290 */ |
290 SkFontData* createFontData() const; | 291 SkFontData* createFontData() const; |
291 | 292 |
292 /** | 293 /** |
293 * Return a scalercontext for the given descriptor. If this fails, then | 294 * Return a scalercontext for the given descriptor. If this fails, then |
294 * if allowFailure is true, this returns NULL, else it returns a | 295 * if allowFailure is true, this returns NULL, else it returns a |
295 * dummy scalercontext that will not crash, but will draw nothing. | 296 * dummy scalercontext that will not crash, but will draw nothing. |
296 */ | 297 */ |
297 SkScalerContext* createScalerContext(const SkScalerContextEffects&, const Sk
Descriptor*, | 298 SkScalerContext* createScalerContext(const SkDescriptor*, |
298 bool allowFailure = false) const; | 299 bool allowFailure = false) const; |
299 | 300 |
300 /** | 301 /** |
301 * Return a rectangle (scaled to 1-pt) that represents the union of the bou
nds of all | 302 * Return a rectangle (scaled to 1-pt) that represents the union of the bou
nds of all |
302 * of the glyphs, but each one positioned at (0,). This may be conservative
ly large, and | 303 * of the glyphs, but each one positioned at (0,). This may be conservative
ly large, and |
303 * will not take into account any hinting or other size-specific adjustment
s. | 304 * will not take into account any hinting or other size-specific adjustment
s. |
304 */ | 305 */ |
305 SkRect getBounds() const; | 306 SkRect getBounds() const; |
306 | 307 |
307 // PRIVATE / EXPERIMENTAL -- do not call | 308 // PRIVATE / EXPERIMENTAL -- do not call |
(...skipping 20 matching lines...) Expand all Loading... |
328 */ | 329 */ |
329 SkTypeface(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch =
false); | 330 SkTypeface(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch =
false); |
330 virtual ~SkTypeface(); | 331 virtual ~SkTypeface(); |
331 | 332 |
332 /** Sets the fixedPitch bit. If used, must be called in the constructor. */ | 333 /** Sets the fixedPitch bit. If used, must be called in the constructor. */ |
333 void setIsFixedPitch(bool isFixedPitch) { fIsFixedPitch = isFixedPitch; } | 334 void setIsFixedPitch(bool isFixedPitch) { fIsFixedPitch = isFixedPitch; } |
334 | 335 |
335 friend class SkScalerContext; | 336 friend class SkScalerContext; |
336 static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal); | 337 static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal); |
337 | 338 |
338 virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&
, | 339 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const =
0; |
339 const SkDescriptor*) const =
0; | |
340 virtual void onFilterRec(SkScalerContextRec*) const = 0; | 340 virtual void onFilterRec(SkScalerContextRec*) const = 0; |
341 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( | 341 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( |
342 PerGlyphInfo, | 342 PerGlyphInfo, |
343 const uint32_t* glyphIDs, | 343 const uint32_t* glyphIDs, |
344 uint32_t glyphIDsCount) const = 0; | 344 uint32_t glyphIDsCount) const = 0; |
345 | 345 |
346 virtual SkStreamAsset* onOpenStream(int* ttcIndex) const = 0; | 346 virtual SkStreamAsset* onOpenStream(int* ttcIndex) const = 0; |
347 // TODO: make pure virtual. | 347 // TODO: make pure virtual. |
348 virtual SkFontData* onCreateFontData() const; | 348 virtual SkFontData* onCreateFontData() const; |
349 | 349 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 SkFontStyle fStyle; | 403 SkFontStyle fStyle; |
404 bool fIsFixedPitch; | 404 bool fIsFixedPitch; |
405 | 405 |
406 friend class SkPaint; | 406 friend class SkPaint; |
407 friend class SkGlyphCache; // GetDefaultTypeface | 407 friend class SkGlyphCache; // GetDefaultTypeface |
408 | 408 |
409 typedef SkWeakRefCnt INHERITED; | 409 typedef SkWeakRefCnt INHERITED; |
410 }; | 410 }; |
411 | 411 |
412 #endif | 412 #endif |
OLD | NEW |