primitives/foundation/text.rs
1/// The font-weight property sets how thick or thin characters in text should be displayed
2///
3#[derive(Clone, Debug, Copy, PartialEq, Eq)]
4pub enum FontWeight {
5 /// Thin text weight
6 Thin = 100,
7 /// Ultra light text weight
8 UltraLight = 200,
9 /// Light text weight
10 Light = 300,
11 /// Semi light text weight
12 SemiLight = 350,
13 /// Book text weight
14 Book = 380,
15 /// Normal text weight
16 Normal = 400,
17 /// Medium text weight
18 Medium = 500,
19 /// Semi bold text weight
20 SemiBold = 600,
21 /// Bold text weight
22 Bold = 700,
23 /// Ultra bold text weight
24 UltraBold = 800,
25 /// Heavy text weight
26 Heavy = 900,
27 /// Ultra heavy text weight
28 UltraHeavy = 1000,
29}
30
31impl Default for FontWeight {
32 fn default() -> Self {
33 FontWeight::Normal
34 }
35}
36
37/// Whether to slant the glyphs in the font.
38///
39#[derive(Clone, Debug, Copy)]
40pub enum FontStyle {
41 /// Normal font
42 Normal = 0,
43 /// Oblique font
44 Oblique = 1,
45 /// Italic font
46 Italic = 2,
47}
48
49impl Default for FontStyle {
50 fn default() -> Self {
51 FontStyle::Normal
52 }
53}
54
55/// Indicates the current baseline when drawing text.
56///
57/// see <https://developer.mozilla.org/ru/docs/Web/API/Canvas_API/Tutorial/Drawing_text>
58#[derive(Clone, Debug, Copy)]
59pub enum BaseLine {
60 /// Top baseline
61 Top,
62 /// Hanging baseline
63 Hanging,
64 /// Middle baseline
65 Middle,
66 /// Alphabetic baseline
67 Alphabetic,
68 /// Ideographic baseline
69 Ideographic,
70 /// Bottom baseline
71 Bottom,
72}
73
74impl Default for BaseLine {
75 fn default() -> Self {
76 BaseLine::Middle
77 }
78}