OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkFontStyle_DEFINED | 8 #ifndef SkFontStyle_DEFINED |
9 #define SkFontStyle_DEFINED | 9 #define SkFontStyle_DEFINED |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 SkFontStyle(); | 44 SkFontStyle(); |
45 SkFontStyle(int weight, int width, Slant); | 45 SkFontStyle(int weight, int width, Slant); |
46 | 46 |
47 bool operator==(const SkFontStyle& rhs) const { | 47 bool operator==(const SkFontStyle& rhs) const { |
48 return fUnion.fU32 == rhs.fUnion.fU32; | 48 return fUnion.fU32 == rhs.fUnion.fU32; |
49 } | 49 } |
50 | 50 |
51 int weight() const { return fUnion.fR.fWeight; } | 51 int weight() const { return fUnion.fR.fWeight; } |
52 int width() const { return fUnion.fR.fWidth; } | 52 int width() const { return fUnion.fR.fWidth; } |
| 53 Slant slant() const { return (Slant)fUnion.fR.fSlant; } |
53 | 54 |
54 bool isItalic() const { | 55 bool isItalic() const { |
55 return kItalic_Slant == fUnion.fR.fSlant; | 56 return kItalic_Slant == fUnion.fR.fSlant; |
56 } | 57 } |
57 | 58 |
58 private: | 59 private: |
59 union { | 60 union { |
60 struct { | 61 struct { |
61 uint16_t fWeight; // 100 .. 900 | 62 uint16_t fWeight; // 100 .. 900 |
62 uint8_t fWidth; // 1 .. 9 | 63 uint8_t fWidth; // 1 .. 9 |
63 uint8_t fSlant; // 0 .. 2 | 64 uint8_t fSlant; // 0 .. 2 |
64 } fR; | 65 } fR; |
65 uint32_t fU32; | 66 uint32_t fU32; |
66 } fUnion; | 67 } fUnion; |
67 }; | 68 }; |
68 | 69 |
69 #endif | 70 #endif |
OLD | NEW |