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
use hard_xml::{XmlRead, XmlWrite};

use crate::{__define_enum, __define_struct, __xml_test_suites};

// __define_struct!{
//     (Fontss, "w:rFonts", 'a) {
//         hint, FontHint, "w:hint",
//         ascii, Cow<'a, str>, "w:ascii",
//         east_asia, Cow<'a, str>, "w:eastAsia",
//     }
// }

__define_struct! {
    ("w:rFonts", Fonts) {
        "w:hint", hint, FontHint
        "w:ascii", ascii, String
        "w:eastAsia", east_asia, String
        "w:hAnsi", h_ansi, String
        "w:cs", custom, String
        "w:asciiTheme", ascii_theme, ThemeFont
        "w:eastAsiaTheme", east_asia_theme, ThemeFont
        "w:hAnsiTheme", h_ansi_theme, ThemeFont
        "w:cstheme", custom_theme, String
    }
}

// #[derive(Debug, Clone)]
// #[cfg_attr(test, derive(PartialEq))]
// pub enum FontHint {
//     Default,       //	High ANSI Font
//     EastAsia,      //	East Asian Font
//     ComplexScript, //	Complex Script Font
// }

__define_enum! {
    FontHint {
        Default= "default",  //	High ANSI Font
        EastAsia = "eastAsia", //	East Asian Font
        ComplexScript = "cs",//	Complex Script Font
    }
}

__define_enum! {
    ThemeFont {
        MajorEastAsia = "majorEastAsia", // Major East Asian Theme Font
        MajorBidi = "majorBidi", // Major Complex Script Theme Font
        MajorAscii = "majorAscii", // Major ASCII Theme Font
        MajorHansi = "majorHAnsi", // Major High ANSI Theme Font
        MinorEastAsia = "minorEastAsia", // Minor East Asian Theme Font
        MinorBidi = "minorBidi", // Minor Complex Script Theme Font
        MinorAscii = "minorAscii", // Minor ASCII Theme Font
        MinorHansi = "minorHAnsi", // Minor High ANSI Theme Font
    }
}

__xml_test_suites!(
    Fonts,
    Fonts::default().east_asia("宋体"),
    r#"<w:rFonts w:eastAsia="宋体"/>"#,
    Fonts::default()
        .east_asia("宋体")
        .ascii("Batang")
        .h_ansi("Batang"),
    r#"<w:rFonts w:ascii="Batang" w:eastAsia="宋体" w:hAnsi="Batang"/>"#,
);