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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
use super::*;
/// The FontFace class.
/// [`FontFace`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct FontFace {
inner: Any,
}
impl FromVal for FontFace {
fn from_val(v: &Any) -> Self {
FontFace {
inner: Any::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for FontFace {
type Target = Any;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for FontFace {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for FontFace {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for FontFace {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<FontFace> for Any {
fn from(s: FontFace) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&FontFace> for Any {
fn from(s: &FontFace) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(FontFace);
impl FontFace {
/// Getter of the `family` attribute.
/// [`FontFace.family`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/family)
pub fn family(&self) -> JsString {
self.inner.get("family").as_::<JsString>()
}
/// Setter of the `family` attribute.
/// [`FontFace.family`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/family)
pub fn set_family(&mut self, value: &JsString) {
self.inner.set("family", value);
}
}
impl FontFace {
/// Getter of the `style` attribute.
/// [`FontFace.style`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/style)
pub fn style(&self) -> JsString {
self.inner.get("style").as_::<JsString>()
}
/// Setter of the `style` attribute.
/// [`FontFace.style`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/style)
pub fn set_style(&mut self, value: &JsString) {
self.inner.set("style", value);
}
}
impl FontFace {
/// Getter of the `weight` attribute.
/// [`FontFace.weight`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/weight)
pub fn weight(&self) -> JsString {
self.inner.get("weight").as_::<JsString>()
}
/// Setter of the `weight` attribute.
/// [`FontFace.weight`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/weight)
pub fn set_weight(&mut self, value: &JsString) {
self.inner.set("weight", value);
}
}
impl FontFace {
/// Getter of the `stretch` attribute.
/// [`FontFace.stretch`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/stretch)
pub fn stretch(&self) -> JsString {
self.inner.get("stretch").as_::<JsString>()
}
/// Setter of the `stretch` attribute.
/// [`FontFace.stretch`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/stretch)
pub fn set_stretch(&mut self, value: &JsString) {
self.inner.set("stretch", value);
}
}
impl FontFace {
/// Getter of the `unicodeRange` attribute.
/// [`FontFace.unicodeRange`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/unicodeRange)
pub fn unicode_range(&self) -> JsString {
self.inner.get("unicodeRange").as_::<JsString>()
}
/// Setter of the `unicodeRange` attribute.
/// [`FontFace.unicodeRange`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/unicodeRange)
pub fn set_unicode_range(&mut self, value: &JsString) {
self.inner.set("unicodeRange", value);
}
}
impl FontFace {
/// Getter of the `featureSettings` attribute.
/// [`FontFace.featureSettings`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/featureSettings)
pub fn feature_settings(&self) -> JsString {
self.inner.get("featureSettings").as_::<JsString>()
}
/// Setter of the `featureSettings` attribute.
/// [`FontFace.featureSettings`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/featureSettings)
pub fn set_feature_settings(&mut self, value: &JsString) {
self.inner.set("featureSettings", value);
}
}
impl FontFace {
/// Getter of the `variationSettings` attribute.
/// [`FontFace.variationSettings`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/variationSettings)
pub fn variation_settings(&self) -> JsString {
self.inner.get("variationSettings").as_::<JsString>()
}
/// Setter of the `variationSettings` attribute.
/// [`FontFace.variationSettings`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/variationSettings)
pub fn set_variation_settings(&mut self, value: &JsString) {
self.inner.set("variationSettings", value);
}
}
impl FontFace {
/// Getter of the `display` attribute.
/// [`FontFace.display`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/display)
pub fn display(&self) -> JsString {
self.inner.get("display").as_::<JsString>()
}
/// Setter of the `display` attribute.
/// [`FontFace.display`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/display)
pub fn set_display(&mut self, value: &JsString) {
self.inner.set("display", value);
}
}
impl FontFace {
/// Getter of the `ascentOverride` attribute.
/// [`FontFace.ascentOverride`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/ascentOverride)
pub fn ascent_override(&self) -> JsString {
self.inner.get("ascentOverride").as_::<JsString>()
}
/// Setter of the `ascentOverride` attribute.
/// [`FontFace.ascentOverride`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/ascentOverride)
pub fn set_ascent_override(&mut self, value: &JsString) {
self.inner.set("ascentOverride", value);
}
}
impl FontFace {
/// Getter of the `descentOverride` attribute.
/// [`FontFace.descentOverride`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/descentOverride)
pub fn descent_override(&self) -> JsString {
self.inner.get("descentOverride").as_::<JsString>()
}
/// Setter of the `descentOverride` attribute.
/// [`FontFace.descentOverride`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/descentOverride)
pub fn set_descent_override(&mut self, value: &JsString) {
self.inner.set("descentOverride", value);
}
}
impl FontFace {
/// Getter of the `lineGapOverride` attribute.
/// [`FontFace.lineGapOverride`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/lineGapOverride)
pub fn line_gap_override(&self) -> JsString {
self.inner.get("lineGapOverride").as_::<JsString>()
}
/// Setter of the `lineGapOverride` attribute.
/// [`FontFace.lineGapOverride`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/lineGapOverride)
pub fn set_line_gap_override(&mut self, value: &JsString) {
self.inner.set("lineGapOverride", value);
}
}
impl FontFace {
/// Getter of the `status` attribute.
/// [`FontFace.status`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/status)
pub fn status(&self) -> FontFaceLoadStatus {
self.inner.get("status").as_::<FontFaceLoadStatus>()
}
}
impl FontFace {
/// Getter of the `loaded` attribute.
/// [`FontFace.loaded`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/loaded)
pub fn loaded(&self) -> Promise<FontFace> {
self.inner.get("loaded").as_::<Promise<FontFace>>()
}
}
impl FontFace {
/// Getter of the `features` attribute.
/// [`FontFace.features`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/features)
pub fn features(&self) -> FontFaceFeatures {
self.inner.get("features").as_::<FontFaceFeatures>()
}
}
impl FontFace {
/// Getter of the `variations` attribute.
/// [`FontFace.variations`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/variations)
pub fn variations(&self) -> FontFaceVariations {
self.inner.get("variations").as_::<FontFaceVariations>()
}
}
impl FontFace {
/// Getter of the `palettes` attribute.
/// [`FontFace.palettes`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/palettes)
pub fn palettes(&self) -> FontFacePalettes {
self.inner.get("palettes").as_::<FontFacePalettes>()
}
}
impl FontFace {
/// The `new FontFace(..)` constructor, creating a new FontFace instance
pub fn new(family: &JsString, source: &Any) -> FontFace {
Self {
inner: Any::global("FontFace")
.new(&[family.into(), source.into()])
.as_::<Any>(),
}
}
}
impl FontFace {
/// The `new FontFace(..)` constructor, creating a new FontFace instance
pub fn new_with_descriptors(
family: &JsString,
source: &Any,
descriptors: &FontFaceDescriptors,
) -> FontFace {
Self {
inner: Any::global("FontFace")
.new(&[family.into(), source.into(), descriptors.into()])
.as_::<Any>(),
}
}
}
impl FontFace {
/// The load method.
/// [`FontFace.load`](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/load)
pub fn load(&self) -> Promise<FontFace> {
self.inner.call("load", &[]).as_::<Promise<FontFace>>()
}
}