| 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 12 matching lines...) Expand all Loading... |
| 23 struct SkScalerContextRec; | 23 struct SkScalerContextRec; |
| 24 class SkStream; | 24 class SkStream; |
| 25 class SkStreamAsset; | 25 class SkStreamAsset; |
| 26 class SkAdvancedTypefaceMetrics; | 26 class SkAdvancedTypefaceMetrics; |
| 27 class SkWStream; | 27 class SkWStream; |
| 28 | 28 |
| 29 typedef uint32_t SkFontID; | 29 typedef uint32_t SkFontID; |
| 30 /** Machine endian. */ | 30 /** Machine endian. */ |
| 31 typedef uint32_t SkFontTableTag; | 31 typedef uint32_t SkFontTableTag; |
| 32 | 32 |
| 33 #ifdef SK_INTERNAL |
| 34 #ifndef SK_DONT_USE_LEGACY_TYPEFACE_CREATE_FROM_NAME |
| 35 #define SK_DONT_USE_LEGACY_TYPEFACE_CREATE_FROM_NAME |
| 36 #endif |
| 37 #endif |
| 38 |
| 33 /** \class SkTypeface | 39 /** \class SkTypeface |
| 34 | 40 |
| 35 The SkTypeface class specifies the typeface and intrinsic style of a font. | 41 The SkTypeface class specifies the typeface and intrinsic style of a font. |
| 36 This is used in the paint, along with optionally algorithmic settings like | 42 This is used in the paint, along with optionally algorithmic settings like |
| 37 textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify | 43 textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify |
| 38 how text appears when drawn (and measured). | 44 how text appears when drawn (and measured). |
| 39 | 45 |
| 40 Typeface objects are immutable, and so they can be shared between threads. | 46 Typeface objects are immutable, and so they can be shared between threads. |
| 41 */ | 47 */ |
| 42 class SK_API SkTypeface : public SkWeakRefCnt { | 48 class SK_API SkTypeface : public SkWeakRefCnt { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 handling either being null (treating null as the default font) | 98 handling either being null (treating null as the default font) |
| 93 */ | 99 */ |
| 94 static bool Equal(const SkTypeface* facea, const SkTypeface* faceb); | 100 static bool Equal(const SkTypeface* facea, const SkTypeface* faceb); |
| 95 | 101 |
| 96 /** | 102 /** |
| 97 * Returns a ref() to the default typeface. The caller must call unref() | 103 * Returns a ref() to the default typeface. The caller must call unref() |
| 98 * when they are done referencing the object. Never returns NULL. | 104 * when they are done referencing the object. Never returns NULL. |
| 99 */ | 105 */ |
| 100 static SkTypeface* RefDefault(Style style = SkTypeface::kNormal); | 106 static SkTypeface* RefDefault(Style style = SkTypeface::kNormal); |
| 101 | 107 |
| 102 /** Return a new reference to the typeface that most closely matches the | 108 #ifndef SK_DONT_USE_LEGACY_TYPEFACE_CREATE_FROM_NAME |
| 103 requested familyName and style. Pass null as the familyName to return | 109 static SkTypeface* CreateFromName(const char familyName[], Style style); |
| 104 the default font for the requested style. Will never return null | 110 #endif |
| 111 |
| 112 /** Creates a new reference to the typeface that most closely matches the |
| 113 requested familyName and fontStyle. This method allows extended font |
| 114 face specifiers as in the SkFontStyle type. Will never return null. |
| 105 | 115 |
| 106 @param familyName May be NULL. The name of the font family. | 116 @param familyName May be NULL. The name of the font family. |
| 107 @param style The style (normal, bold, italic) of the typeface. | 117 @param fontStyle The style of the typeface. |
| 108 @return reference to the closest-matching typeface. Call must call | 118 @return reference to the closest-matching typeface. Call must call |
| 109 unref() when they are done. | 119 unref() when they are done. |
| 110 */ | 120 */ |
| 111 static SkTypeface* CreateFromName(const char familyName[], Style style); | 121 static SkTypeface* CreateFromName(const char familyName[], |
| 122 SkFontStyle fontStyle); |
| 112 | 123 |
| 113 /** Return a new reference to the typeface that most closely matches the | 124 /** Return a new reference to the typeface that most closely matches the |
| 114 requested typeface and specified Style. Use this call if you want to | 125 requested typeface and specified Style. Use this call if you want to |
| 115 pick a new style from the same family of the existing typeface. | 126 pick a new style from the same family of the existing typeface. |
| 116 If family is NULL, this selects from the default font's family. | 127 If family is NULL, this selects from the default font's family. |
| 117 | 128 |
| 118 @param family May be NULL. The name of the existing type face. | 129 @param family May be NULL. The name of the existing type face. |
| 119 @param s The style (normal, bold, italic) of the type face. | 130 @param s The style (normal, bold, italic) of the type face. |
| 120 @return reference to the closest-matching typeface. Call must call | 131 @return reference to the closest-matching typeface. Call must call |
| 121 unref() when they are done. | 132 unref() when they are done. |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 SkFontStyle fStyle; | 414 SkFontStyle fStyle; |
| 404 bool fIsFixedPitch; | 415 bool fIsFixedPitch; |
| 405 | 416 |
| 406 friend class SkPaint; | 417 friend class SkPaint; |
| 407 friend class SkGlyphCache; // GetDefaultTypeface | 418 friend class SkGlyphCache; // GetDefaultTypeface |
| 408 | 419 |
| 409 typedef SkWeakRefCnt INHERITED; | 420 typedef SkWeakRefCnt INHERITED; |
| 410 }; | 421 }; |
| 411 | 422 |
| 412 #endif | 423 #endif |
| OLD | NEW |