OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 SkFont_DEFINED |
| 9 #define SkFont_DEFINED |
| 10 |
8 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
9 #include "SkScalar.h" | 12 #include "SkScalar.h" |
10 | 13 |
11 class SkPaint; | 14 class SkPaint; |
12 class SkTypeface; | 15 class SkTypeface; |
13 | 16 |
14 enum SkTextEncoding { | 17 enum SkTextEncoding { |
15 kUTF8_SkTextEncoding, | 18 kUTF8_SkTextEncoding, |
16 kUTF16_SkTextEncoding, | 19 kUTF16_SkTextEncoding, |
17 kUTF32_SkTextEncoding, | 20 kUTF32_SkTextEncoding, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 */ | 121 */ |
119 SkFont* cloneWithSize(SkScalar size) const; | 122 SkFont* cloneWithSize(SkScalar size) const; |
120 | 123 |
121 SkTypeface* getTypeface() const { return fTypeface; } | 124 SkTypeface* getTypeface() const { return fTypeface; } |
122 SkScalar getSize() const { return fSize; } | 125 SkScalar getSize() const { return fSize; } |
123 SkScalar getScaleX() const { return fScaleX; } | 126 SkScalar getScaleX() const { return fScaleX; } |
124 SkScalar getSkewX() const { return fSkewX; } | 127 SkScalar getSkewX() const { return fSkewX; } |
125 uint32_t getFlags() const { return fFlags; } | 128 uint32_t getFlags() const { return fFlags; } |
126 MaskType getMaskType() const { return (MaskType)fMaskType; } | 129 MaskType getMaskType() const { return (MaskType)fMaskType; } |
127 | 130 |
| 131 bool isVertical() const { return SkToBool(fFlags & kVertical_Flag); } |
| 132 bool isEmbolden() const { return SkToBool(fFlags & kEmbolden_Flag); } |
| 133 bool isEnableAutoHints() const { return SkToBool(fFlags & kEnableAutoHints_F
lag); } |
| 134 bool isEnableByteCodeHints() const { return SkToBool(fFlags & kEnableByteCod
eHints_Flag); } |
| 135 bool isUseNonLinearMetrics() const { return SkToBool(fFlags & kUseNonlinearM
etrics_Flag); } |
| 136 |
128 int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding, | 137 int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding, |
129 uint16_t glyphs[], int maxGlyphCount) const; | 138 uint16_t glyphs[], int maxGlyphCount) const; |
130 | 139 |
131 SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding) co
nst; | 140 SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding) co
nst; |
132 | 141 |
133 static SkFont* Testing_CreateFromPaint(const SkPaint&); | 142 static SkFont* Testing_CreateFromPaint(const SkPaint&); |
134 | 143 |
135 private: | 144 private: |
136 enum { | 145 enum { |
137 kAllFlags = 0xFF, | 146 kAllFlags = 0xFF, |
138 }; | 147 }; |
139 | 148 |
140 SkFont(SkTypeface*, SkScalar size, SkScalar scaleX, SkScalar skewX, MaskType
, uint32_t flags); | 149 SkFont(SkTypeface*, SkScalar size, SkScalar scaleX, SkScalar skewX, MaskType
, uint32_t flags); |
141 virtual ~SkFont(); | 150 virtual ~SkFont(); |
142 | 151 |
143 SkTypeface* fTypeface; | 152 SkTypeface* fTypeface; |
144 SkScalar fSize; | 153 SkScalar fSize; |
145 SkScalar fScaleX; | 154 SkScalar fScaleX; |
146 SkScalar fSkewX; | 155 SkScalar fSkewX; |
147 uint16_t fFlags; | 156 uint16_t fFlags; |
148 uint8_t fMaskType; | 157 uint8_t fMaskType; |
149 // uint8_t fPad; | 158 // uint8_t fPad; |
150 }; | 159 }; |
| 160 |
| 161 #endif |
OLD | NEW |