mrml/prelude/render/
options.rs

1use std::borrow::Cow;
2use std::collections::HashMap;
3
4pub fn default_fonts() -> HashMap<String, Cow<'static, str>> {
5    HashMap::from([
6        (
7            "Open Sans".into(),
8            "https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700".into(),
9        ),
10        (
11            "Droid Sans".into(),
12            "https://fonts.googleapis.com/css?family=Droid+Sans:300,400,500,700".into(),
13        ),
14        (
15            "Lato".into(),
16            "https://fonts.googleapis.com/css?family=Lato:300,400,500,700".into(),
17        ),
18        (
19            "Roboto".into(),
20            "https://fonts.googleapis.com/css?family=Roboto:300,400,500,700".into(),
21        ),
22        (
23            "Ubuntu".into(),
24            "https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700".into(),
25        ),
26    ])
27}
28
29#[derive(Debug)]
30pub struct RenderOptions {
31    pub disable_comments: bool,
32    pub social_icon_origin: Option<Cow<'static, str>>,
33    pub fonts: HashMap<String, Cow<'static, str>>,
34}
35
36impl Default for RenderOptions {
37    fn default() -> Self {
38        Self {
39            disable_comments: false,
40            social_icon_origin: None,
41            fonts: default_fonts(),
42        }
43    }
44}