summaryrefslogtreecommitdiffstats
path: root/core/src/text.rs
blob: 3110030cc5c1a0420510e7efa80e0ab50c993fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use super::types::Float;

#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[non_exhaustive]
pub enum FontStyle {
    Normal,
    Oblique,
    Italic,
}

impl Default for FontStyle {
    fn default() -> Self {
        Self::Normal
    }
}

#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[non_exhaustive]
pub enum FontVariant {
    Normal,
    SmallCaps,
}

impl Default for FontVariant {
    fn default() -> Self {
        Self::Normal
    }
}

#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[non_exhaustive]
pub enum FontWeight {
    Thin,
    Ultralight,
    Light,
    Semilight,
    Book,
    Normal,
    Medium,
    Semibold,
    Bold,
    Ultrabold,
    Heavy,
    Ultraheavy,
}

impl Default for FontWeight {
    fn default() -> Self {
        Self::Normal
    }
}

#[derive(Clone, Debug)]
pub struct FontDescription {
    pub family: String,
    pub style: FontStyle,
    pub weight: FontWeight,
    // TODO: handles weirdly with bounds that specifies both top and bottom
    pub size: Float,
}

// TODO: automate creation of Defined* structs
#[derive(Clone, Debug)]
pub struct DefinedFontDescription {
    pub family: String,
    pub style: FontStyle,
    pub weight: FontWeight,
    pub size: f64,
}

#[derive(Clone, Debug)]
pub struct Text {
    pub content: String,
    pub font: FontDescription,
}

#[derive(Clone, Debug)]
pub struct DefinedText {
    pub content: String,
    pub font: DefinedFontDescription,
}