ass_editor/core/builders/
style_setters.rs1use super::StyleBuilder;
4
5#[cfg(not(feature = "std"))]
6use alloc::string::ToString;
7
8impl StyleBuilder {
9 pub fn name(mut self, name: &str) -> Self {
11 self.name = Some(name.to_string());
12 self
13 }
14
15 pub fn font(mut self, font: &str) -> Self {
17 self.fontname = Some(font.to_string());
18 self
19 }
20
21 pub fn size(mut self, size: u32) -> Self {
23 self.fontsize = Some(size);
24 self
25 }
26
27 pub fn color(mut self, color: &str) -> Self {
29 self.primary_colour = Some(color.to_string());
30 self
31 }
32
33 pub fn bold(mut self, bold: bool) -> Self {
35 self.bold = Some(bold);
36 self
37 }
38
39 pub fn italic(mut self, italic: bool) -> Self {
41 self.italic = Some(italic);
42 self
43 }
44
45 pub fn align(mut self, alignment: u32) -> Self {
47 self.alignment = Some(alignment);
48 self
49 }
50
51 pub fn secondary_color(mut self, color: &str) -> Self {
53 self.secondary_colour = Some(color.to_string());
54 self
55 }
56
57 pub fn outline_color(mut self, color: &str) -> Self {
59 self.outline_colour = Some(color.to_string());
60 self
61 }
62
63 pub fn back_color(mut self, color: &str) -> Self {
65 self.back_colour = Some(color.to_string());
66 self
67 }
68
69 pub fn underline(mut self, underline: bool) -> Self {
71 self.underline = Some(underline);
72 self
73 }
74
75 pub fn strikeout(mut self, strikeout: bool) -> Self {
77 self.strikeout = Some(strikeout);
78 self
79 }
80
81 pub fn scale_x(mut self, scale: f32) -> Self {
83 self.scale_x = Some(scale);
84 self
85 }
86
87 pub fn scale_y(mut self, scale: f32) -> Self {
89 self.scale_y = Some(scale);
90 self
91 }
92
93 pub fn spacing(mut self, spacing: f32) -> Self {
95 self.spacing = Some(spacing);
96 self
97 }
98
99 pub fn angle(mut self, angle: f32) -> Self {
101 self.angle = Some(angle);
102 self
103 }
104
105 pub fn border_style(mut self, style: u32) -> Self {
107 self.border_style = Some(style);
108 self
109 }
110
111 pub fn outline(mut self, width: f32) -> Self {
113 self.outline = Some(width);
114 self
115 }
116
117 pub fn shadow(mut self, depth: f32) -> Self {
119 self.shadow = Some(depth);
120 self
121 }
122
123 pub fn margin_left(mut self, margin: u32) -> Self {
125 self.margin_l = Some(margin);
126 self
127 }
128
129 pub fn margin_right(mut self, margin: u32) -> Self {
131 self.margin_r = Some(margin);
132 self
133 }
134
135 pub fn margin_vertical(mut self, margin: u32) -> Self {
137 self.margin_v = Some(margin);
138 self
139 }
140
141 pub fn margin_top(mut self, margin: u32) -> Self {
143 self.margin_t = Some(margin);
144 self
145 }
146
147 pub fn margin_bottom(mut self, margin: u32) -> Self {
149 self.margin_b = Some(margin);
150 self
151 }
152
153 pub fn encoding(mut self, encoding: u32) -> Self {
155 self.encoding = Some(encoding);
156 self
157 }
158
159 pub fn alpha_level(mut self, alpha: u32) -> Self {
161 self.alpha_level = Some(alpha);
162 self
163 }
164
165 pub fn relative_to(mut self, relative: &str) -> Self {
167 self.relative_to = Some(relative.to_string());
168 self
169 }
170}