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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#![allow(dead_code)]

use std::marker::PhantomData;

use crate::dependencies::{Dependency, DependencyDefault};
use crate::views::text::Font;
use crate::views::ui::{accessibility, Inter};

mod scale;

#[allow(non_upper_case_globals)]
const InterVariable: &[u8] = include_bytes!("../InterVariable.ttf");

#[inline(never)]
fn font<Design>(weight: f32, scale: f32) -> Inter<'static, Design> {
    let accessibility = Dependency::<accessibility::Scale>::new();

    Inter {
        marker: PhantomData,
        font: Font::from(InterVariable)
            .unwrap()
            .weight(weight)
            .size(accessibility.scale(scale)),
    }
}

/// Title `Font` styles.
pub mod title {
    use super::*;

    /// Large variant
    pub struct L;
    /// Medium variant
    pub struct M;
    /// Small variant
    pub struct S;

    impl DependencyDefault for Inter<'static, L> {}
    impl DependencyDefault for Inter<'static, M> {}
    impl DependencyDefault for Inter<'static, S> {}

    impl Default for Inter<'static, L> {
        fn default() -> Self {
            font(650.0, 6.0)
        }
    }

    impl Default for Inter<'static, M> {
        fn default() -> Self {
            font(650.0, 4.0)
        }
    }

    impl Default for Inter<'static, S> {
        fn default() -> Self {
            font(650.0, 3.0)
        }
    }
}

/// Body `Font` styles.
pub mod body {
    use super::*;

    /// Large variant
    pub struct L;
    /// Medium variant
    pub struct M;
    /// Small variant
    pub struct S;

    impl DependencyDefault for Inter<'static, L> {}
    impl DependencyDefault for Inter<'static, M> {}
    impl DependencyDefault for Inter<'static, S> {}

    impl Default for Inter<'static, L> {
        fn default() -> Self {
            font(500.0, 4.0)
        }
    }

    impl Default for Inter<'static, M> {
        fn default() -> Self {
            font(500.0, 3.0)
        }
    }

    impl Default for Inter<'static, S> {
        fn default() -> Self {
            font(400.0, 2.0)
        }
    }
}

/// Label `Font` styles.
pub mod label {
    use super::*;

    /// Large variant
    pub struct L;
    /// Medium variant
    pub struct M;
    /// Small variant
    pub struct S;

    impl DependencyDefault for Inter<'static, L> {}
    impl DependencyDefault for Inter<'static, M> {}
    impl DependencyDefault for Inter<'static, S> {}

    impl Default for Inter<'static, L> {
        fn default() -> Self {
            font(600.0, 2.0)
        }
    }

    impl Default for Inter<'static, M> {
        fn default() -> Self {
            font(600.0, 1.0)
        }
    }

    impl Default for Inter<'static, S> {
        fn default() -> Self {
            font(400.0, 0.0)
        }
    }
}