OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkTypeface_DEFINED | 8 #ifndef SkTypeface_DEFINED |
9 #define SkTypeface_DEFINED | 9 #define SkTypeface_DEFINED |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 /** Returns true if the two typefaces reference the same underlying font, | 90 /** Returns true if the two typefaces reference the same underlying font, |
91 handling either being null (treating null as the default font) | 91 handling either being null (treating null as the default font) |
92 */ | 92 */ |
93 static bool Equal(const SkTypeface* facea, const SkTypeface* faceb); | 93 static bool Equal(const SkTypeface* facea, const SkTypeface* faceb); |
94 | 94 |
95 /** | 95 /** |
96 * Returns a ref() to the default typeface. The caller must call unref() | 96 * Returns a ref() to the default typeface. The caller must call unref() |
97 * when they are done referencing the object. Never returns NULL. | 97 * when they are done referencing the object. Never returns NULL. |
98 */ | 98 */ |
99 static SkTypeface* RefDefault(Style style = SkTypeface::kNormal); | 99 static SkTypeface* RefDefault(Style style = SkTypeface::kNormal); |
| 100 static SkTypeface* RefDefault(SkFontStyle style); |
100 | 101 |
101 /** Return a new reference to the typeface that most closely matches the | 102 /** Return a new reference to the typeface that most closely matches the |
102 requested familyName and style. Pass null as the familyName to return | 103 requested familyName and style. Pass null as the familyName to return |
103 the default font for the requested style. Will never return null | 104 the default font for the requested style. Will never return null |
104 | 105 |
105 @param familyName May be NULL. The name of the font family. | 106 @param familyName May be NULL. The name of the font family. |
106 @param style The style (normal, bold, italic) of the typeface. | 107 @param style The style (normal, bold, italic) of the typeface. |
107 @return reference to the closest-matching typeface. Call must call | 108 @return reference to the closest-matching typeface. Call must call |
108 unref() when they are done. | 109 unref() when they are done. |
109 */ | 110 */ |
110 static SkTypeface* CreateFromName(const char familyName[], Style style); | 111 static SkTypeface* CreateFromName(const char familyName[], Style style); |
| 112 static SkTypeface* CreateFromName(const char familyName[], |
| 113 SkFontStyle style); |
111 | 114 |
112 /** Return a new reference to the typeface that most closely matches the | 115 /** Return a new reference to the typeface that most closely matches the |
113 requested typeface and specified Style. Use this call if you want to | 116 requested typeface and specified Style. Use this call if you want to |
114 pick a new style from the same family of the existing typeface. | 117 pick a new style from the same family of the existing typeface. |
115 If family is NULL, this selects from the default font's family. | 118 If family is NULL, this selects from the default font's family. |
116 | 119 |
117 @param family May be NULL. The name of the existing type face. | 120 @param family May be NULL. The name of the existing type face. |
118 @param s The style (normal, bold, italic) of the type face. | 121 @param s The style (normal, bold, italic) of the type face. |
119 @return reference to the closest-matching typeface. Call must call | 122 @return reference to the closest-matching typeface. Call must call |
120 unref() when they are done. | 123 unref() when they are done. |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 /** uniqueID must be unique and non-zero | 330 /** uniqueID must be unique and non-zero |
328 */ | 331 */ |
329 SkTypeface(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch =
false); | 332 SkTypeface(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch =
false); |
330 virtual ~SkTypeface(); | 333 virtual ~SkTypeface(); |
331 | 334 |
332 /** Sets the fixedPitch bit. If used, must be called in the constructor. */ | 335 /** Sets the fixedPitch bit. If used, must be called in the constructor. */ |
333 void setIsFixedPitch(bool isFixedPitch) { fIsFixedPitch = isFixedPitch; } | 336 void setIsFixedPitch(bool isFixedPitch) { fIsFixedPitch = isFixedPitch; } |
334 | 337 |
335 friend class SkScalerContext; | 338 friend class SkScalerContext; |
336 static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal); | 339 static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal); |
| 340 static SkTypeface* GetDefaultTypeface(SkFontStyle style); |
337 | 341 |
338 virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&
, | 342 virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&
, |
339 const SkDescriptor*) const =
0; | 343 const SkDescriptor*) const =
0; |
340 virtual void onFilterRec(SkScalerContextRec*) const = 0; | 344 virtual void onFilterRec(SkScalerContextRec*) const = 0; |
341 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( | 345 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( |
342 PerGlyphInfo, | 346 PerGlyphInfo, |
343 const uint32_t* glyphIDs, | 347 const uint32_t* glyphIDs, |
344 uint32_t glyphIDsCount) const = 0; | 348 uint32_t glyphIDsCount) const = 0; |
345 | 349 |
346 virtual SkStreamAsset* onOpenStream(int* ttcIndex) const = 0; | 350 virtual SkStreamAsset* onOpenStream(int* ttcIndex) const = 0; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 SkFontStyle fStyle; | 407 SkFontStyle fStyle; |
404 bool fIsFixedPitch; | 408 bool fIsFixedPitch; |
405 | 409 |
406 friend class SkPaint; | 410 friend class SkPaint; |
407 friend class SkGlyphCache; // GetDefaultTypeface | 411 friend class SkGlyphCache; // GetDefaultTypeface |
408 | 412 |
409 typedef SkWeakRefCnt INHERITED; | 413 typedef SkWeakRefCnt INHERITED; |
410 }; | 414 }; |
411 | 415 |
412 #endif | 416 #endif |
OLD | NEW |