docx_reader/documents/elements/
run_fonts.rs

1use serde::{Deserialize, Serialize};
2
3/*
4  17.3.2.26 rFonts (Run Fonts)
5  This element specifies the fonts which shall be used to display the text contents of this run.
6  Within a single run, there can be up to four types of font slot which shall each be allowed to use a unique font:
7  - ASCII (i.e., the first 128 Unicode code points)
8  - High ANSI
9  - Complex Script
10*/
11#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
12#[serde(rename_all = "camelCase")]
13pub struct RunFonts {
14	#[serde(skip_serializing_if = "Option::is_none")]
15	ascii: Option<String>,
16	#[serde(skip_serializing_if = "Option::is_none")]
17	hi_ansi: Option<String>,
18	#[serde(skip_serializing_if = "Option::is_none")]
19	east_asia: Option<String>,
20	#[serde(skip_serializing_if = "Option::is_none")]
21	cs: Option<String>,
22	#[serde(skip_serializing_if = "Option::is_none")]
23	ascii_theme: Option<String>,
24	#[serde(skip_serializing_if = "Option::is_none")]
25	hi_ansi_theme: Option<String>,
26	#[serde(skip_serializing_if = "Option::is_none")]
27	east_asia_theme: Option<String>,
28	#[serde(skip_serializing_if = "Option::is_none")]
29	cs_theme: Option<String>,
30	#[serde(skip_serializing_if = "Option::is_none")]
31	hint: Option<String>,
32}
33
34impl RunFonts {
35	pub fn new() -> RunFonts {
36		Default::default()
37	}
38
39	pub fn ascii(mut self, f: impl Into<String>) -> Self {
40		self.ascii = Some(f.into());
41		self
42	}
43
44	pub fn hi_ansi(mut self, f: impl Into<String>) -> Self {
45		self.hi_ansi = Some(f.into());
46		self
47	}
48
49	pub fn east_asia(mut self, f: impl Into<String>) -> Self {
50		self.east_asia = Some(f.into());
51		self
52	}
53
54	pub fn cs(mut self, f: impl Into<String>) -> Self {
55		self.cs = Some(f.into());
56		self
57	}
58
59	pub fn ascii_theme(mut self, f: impl Into<String>) -> Self {
60		self.ascii_theme = Some(f.into());
61		self
62	}
63
64	pub fn hi_ansi_theme(mut self, f: impl Into<String>) -> Self {
65		self.hi_ansi_theme = Some(f.into());
66		self
67	}
68
69	pub fn east_asia_theme(mut self, f: impl Into<String>) -> Self {
70		self.east_asia_theme = Some(f.into());
71		self
72	}
73
74	pub fn cs_theme(mut self, f: impl Into<String>) -> Self {
75		self.cs_theme = Some(f.into());
76		self
77	}
78
79	pub fn hint(mut self, f: impl Into<String>) -> Self {
80		self.hint = Some(f.into());
81		self
82	}
83}