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 25 matching lines...) Expand all Loading... | |
36 kUltaExpanded_Width = 9 | 36 kUltaExpanded_Width = 9 |
37 }; | 37 }; |
38 | 38 |
39 enum Slant { | 39 enum Slant { |
40 kUpright_Slant, | 40 kUpright_Slant, |
41 kItalic_Slant, | 41 kItalic_Slant, |
42 }; | 42 }; |
43 | 43 |
44 SkFontStyle(); | 44 SkFontStyle(); |
45 SkFontStyle(int weight, int width, Slant); | 45 SkFontStyle(int weight, int width, Slant); |
46 explicit SkFontStyle(unsigned oldStyle); | |
reed1
2014/10/20 18:39:56
// oldStyle means the style-bits in typeface: bold
bungeman-skia
2014/10/20 19:15:39
Done.
| |
46 | 47 |
47 bool operator==(const SkFontStyle& rhs) const { | 48 bool operator==(const SkFontStyle& rhs) const { |
48 return fUnion.fU32 == rhs.fUnion.fU32; | 49 return fUnion.fU32 == rhs.fUnion.fU32; |
49 } | 50 } |
50 | 51 |
51 int weight() const { return fUnion.fR.fWeight; } | 52 int weight() const { return fUnion.fR.fWeight; } |
52 int width() const { return fUnion.fR.fWidth; } | 53 int width() const { return fUnion.fR.fWidth; } |
53 Slant slant() const { return (Slant)fUnion.fR.fSlant; } | 54 Slant slant() const { return (Slant)fUnion.fR.fSlant; } |
54 | 55 |
55 bool isItalic() const { | 56 bool isItalic() const { |
56 return kItalic_Slant == fUnion.fR.fSlant; | 57 return kItalic_Slant == fUnion.fR.fSlant; |
57 } | 58 } |
58 | 59 |
59 private: | 60 private: |
60 union { | 61 union { |
61 struct { | 62 struct { |
62 uint16_t fWeight; // 100 .. 900 | 63 uint16_t fWeight; // 100 .. 900 |
63 uint8_t fWidth; // 1 .. 9 | 64 uint8_t fWidth; // 1 .. 9 |
64 uint8_t fSlant; // 0 .. 2 | 65 uint8_t fSlant; // 0 .. 2 |
65 } fR; | 66 } fR; |
66 uint32_t fU32; | 67 uint32_t fU32; |
67 } fUnion; | 68 } fUnion; |
68 }; | 69 }; |
69 | 70 |
70 #endif | 71 #endif |
OLD | NEW |