Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
include
core
SkFontStyle.h
Go to the documentation of this file.
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 "
include/core/SkTypes.h
"
12
#include "
include/private/base/SkTPin.h
"
13
14
#include <cstdint>
15
16
class
SK_API
SkFontStyle
{
17
public
:
18
enum
Weight
{
19
kInvisible_Weight = 0,
20
kThin_Weight = 100,
21
kExtraLight_Weight = 200,
22
kLight_Weight = 300,
23
kNormal_Weight = 400,
24
kMedium_Weight = 500,
25
kSemiBold_Weight = 600,
26
kBold_Weight = 700,
27
kExtraBold_Weight = 800,
28
kBlack_Weight = 900,
29
kExtraBlack_Weight = 1000,
30
};
31
32
enum
Width
{
33
kUltraCondensed_Width = 1,
34
kExtraCondensed_Width = 2,
35
kCondensed_Width = 3,
36
kSemiCondensed_Width = 4,
37
kNormal_Width = 5,
38
kSemiExpanded_Width = 6,
39
kExpanded_Width = 7,
40
kExtraExpanded_Width = 8,
41
kUltraExpanded_Width = 9,
42
};
43
44
enum
Slant
{
45
kUpright_Slant
,
46
kItalic_Slant
,
47
kOblique_Slant
,
48
};
49
50
constexpr
SkFontStyle
(
int
weight,
int
width
,
Slant
slant) : fValue(
51
(
SkTPin
<
int
>(weight, kInvisible_Weight, kExtraBlack_Weight)) +
52
(
SkTPin
<
int
>(
width
, kUltraCondensed_Width, kUltraExpanded_Width) << 16) +
53
(
SkTPin
<
int
>(slant, kUpright_Slant, kOblique_Slant) << 24)
54
) { }
55
56
constexpr
SkFontStyle
() :
SkFontStyle
{kNormal_Weight, kNormal_Width, kUpright_Slant} { }
57
58
bool
operator==
(
const
SkFontStyle
& rhs)
const
{
59
return
fValue == rhs.fValue;
60
}
61
62
int
weight
()
const
{
return
fValue & 0xFFFF; }
63
int
width
()
const
{
return
(fValue >> 16) & 0xFF; }
64
Slant
slant
()
const
{
return
(
Slant
)((fValue >> 24) & 0xFF); }
65
66
static
constexpr
SkFontStyle
Normal
() {
67
return
SkFontStyle
(kNormal_Weight, kNormal_Width, kUpright_Slant);
68
}
69
static
constexpr
SkFontStyle
Bold
() {
70
return
SkFontStyle
(kBold_Weight, kNormal_Width, kUpright_Slant);
71
}
72
static
constexpr
SkFontStyle
Italic
() {
73
return
SkFontStyle
(kNormal_Weight, kNormal_Width, kItalic_Slant );
74
}
75
static
constexpr
SkFontStyle
BoldItalic
() {
76
return
SkFontStyle
(kBold_Weight, kNormal_Width, kItalic_Slant );
77
}
78
79
private
:
80
friend
class
SkTypefaceProxyPrototype
;
// To serialize fValue
81
int32_t fValue;
82
};
83
84
#endif
SK_API
#define SK_API
Definition
SkAPI.h:35
SkTPin.h
SkTPin
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
Definition
SkTPin.h:19
SkTypes.h
int
Type::kYUV Type::kRGBA() int(0.7 *637)
SkFontStyle
Definition
SkFontStyle.h:16
SkFontStyle::SkFontStyle
constexpr SkFontStyle(int weight, int width, Slant slant)
Definition
SkFontStyle.h:50
SkFontStyle::Weight
Weight
Definition
SkFontStyle.h:18
SkFontStyle::SkFontStyle
constexpr SkFontStyle()
Definition
SkFontStyle.h:56
SkFontStyle::slant
Slant slant() const
Definition
SkFontStyle.h:64
SkFontStyle::Italic
static constexpr SkFontStyle Italic()
Definition
SkFontStyle.h:72
SkFontStyle::width
int width() const
Definition
SkFontStyle.h:63
SkFontStyle::weight
int weight() const
Definition
SkFontStyle.h:62
SkFontStyle::Width
Width
Definition
SkFontStyle.h:32
SkFontStyle::BoldItalic
static constexpr SkFontStyle BoldItalic()
Definition
SkFontStyle.h:75
SkFontStyle::Slant
Slant
Definition
SkFontStyle.h:44
SkFontStyle::kOblique_Slant
@ kOblique_Slant
Definition
SkFontStyle.h:47
SkFontStyle::kItalic_Slant
@ kItalic_Slant
Definition
SkFontStyle.h:46
SkFontStyle::kUpright_Slant
@ kUpright_Slant
Definition
SkFontStyle.h:45
SkFontStyle::operator==
bool operator==(const SkFontStyle &rhs) const
Definition
SkFontStyle.h:58
SkFontStyle::Bold
static constexpr SkFontStyle Bold()
Definition
SkFontStyle.h:69
SkFontStyle::Normal
static constexpr SkFontStyle Normal()
Definition
SkFontStyle.h:66
SkTypefaceProxyPrototype
Definition
SkTypeface_remote.h:60
width
int32_t width
Definition
serialization_callbacks.cc:0
Generated on Fri Apr 26 2024 06:16:10 for Flutter Engine by
1.9.8