Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: include/core/SkFontStyle.h

Issue 667023002: Revert of Replace SkTypeface::Style with SkFontStyle. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gyp/ports.gyp ('k') | include/core/SkTypeface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkFontStyle_DEFINED
9 #define SkFontStyle_DEFINED
10
11 #include "SkTypes.h"
12
13 class SK_API SkFontStyle {
14 public:
15 enum Weight {
16 kThin_Weight = 100,
17 kExtraLight_Weight = 200,
18 kLight_Weight = 300,
19 kNormal_Weight = 400,
20 kMedium_Weight = 500,
21 kSemiBold_Weight = 600,
22 kBold_Weight = 700,
23 kExtraBold_Weight = 800,
24 kBlack_Weight = 900
25 };
26
27 enum Width {
28 kUltraCondensed_Width = 1,
29 kExtraCondensed_Width = 2,
30 kCondensed_Width = 3,
31 kSemiCondensed_Width = 4,
32 kNormal_Width = 5,
33 kSemiExpanded_Width = 6,
34 kExpanded_Width = 7,
35 kExtraExpanded_Width = 8,
36 kUltaExpanded_Width = 9
37 };
38
39 enum Slant {
40 kUpright_Slant,
41 kItalic_Slant,
42 };
43
44 SkFontStyle();
45 SkFontStyle(int weight, int width, Slant);
46 /** oldStyle means the style-bits in SkTypeface::Style: bold=1, italic=2 */
47 explicit SkFontStyle(unsigned oldStyle);
48
49 bool operator==(const SkFontStyle& rhs) const {
50 return fUnion.fU32 == rhs.fUnion.fU32;
51 }
52
53 int weight() const { return fUnion.fR.fWeight; }
54 int width() const { return fUnion.fR.fWidth; }
55 Slant slant() const { return (Slant)fUnion.fR.fSlant; }
56
57 bool isItalic() const {
58 return kItalic_Slant == fUnion.fR.fSlant;
59 }
60
61 private:
62 union {
63 struct {
64 uint16_t fWeight; // 100 .. 900
65 uint8_t fWidth; // 1 .. 9
66 uint8_t fSlant; // 0 .. 2
67 } fR;
68 uint32_t fU32;
69 } fUnion;
70 };
71
72 #endif
OLDNEW
« no previous file with comments | « gyp/ports.gyp ('k') | include/core/SkTypeface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698