/
FontFace.cljs
319 lines (226 loc) · 9.4 KB
/
FontFace.cljs
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
(ns web.fonts.FontFace
"The FontFace interface represents a single usable font face.
allows control of the source of the font face, being a URL to
external resource, or a buffer; it also allows control of when
font face is loaded and its current status."
(:refer-clojure :exclude [load]))
(def constructor
"Constructor.
The FontFace() constructor creates a new `web.fonts.FontFace` object.
family
Specifies a name that will be used as the font face value for font properties. Takes the same type of values as the `font-family` descriptor of `@font-face` .
source
The font source. This can be either:
A URL
Binary font data
descriptors Optional
A set of optional descriptors passed as an object. It can have the following keys:
family: Family
style: Style
weight: Weight
stretch: Stretch
unicodeRange: Unicode range
variant: variant
featureSettings: Feature settings
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/FontFace`"
js/FontFace)
(defn load
"Method.
The load() method of the `web.fonts.FontFace` interface loads
font based on current object's constructor-passed requirements,
a location or source buffer, and returns a `js.Promise` that
with the current FontFace object.
`var promise = FontFace.load();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/load`"
[this ]
(-> this (.load)))
(defn display
"Property.
The display property of the `web.fonts.FontFace` interface determines
a font face is displayed based on whether and when it is downloaded
ready to use. This property is equivalent to the CSS font-display
`var display = FontFace.display
FontFace.display = display`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/display`"
[this]
(-> this (.display)))
(defn set-display!
"Property.
The display property of the `web.fonts.FontFace` interface determines
a font face is displayed based on whether and when it is downloaded
ready to use. This property is equivalent to the CSS font-display
`var display = FontFace.display
FontFace.display = display`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/display`"
[this val]
(aset this "display" val))
(defn family
"Property.
The FontFace.family property allows the author to get or set
font family of a `web.fonts.FontFace` object. This is equivalent
the `font-family` descriptor of `@font-face`.
`instanceOfFontFace.family = 'font family name';
var fontFace = instanceOfFontFace.family; // \\\"font family name\\\"`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/family`"
[this]
(-> this (.family)))
(defn set-family!
"Property.
The FontFace.family property allows the author to get or set
font family of a `web.fonts.FontFace` object. This is equivalent
the `font-family` descriptor of `@font-face`.
`instanceOfFontFace.family = 'font family name';
var fontFace = instanceOfFontFace.family; // \\\"font family name\\\"`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/family`"
[this val]
(aset this "family" val))
(defn feature-settings
"Property.
The featureSettings property of the `web.fonts.FontFace` interface
or sets infrequently used font features that are not available
a font's variant properties. It is equivalent to the `font-feature-settings`
`var featureSettingDescriptor = FontFace.featureSettings;
FontFace.featureSettings = featureSettingDescriptor;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/featureSettings`"
[this]
(-> this (.featureSettings)))
(defn set-feature-settings!
"Property.
The featureSettings property of the `web.fonts.FontFace` interface
or sets infrequently used font features that are not available
a font's variant properties. It is equivalent to the `font-feature-settings`
`var featureSettingDescriptor = FontFace.featureSettings;
FontFace.featureSettings = featureSettingDescriptor;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/featureSettings`"
[this val]
(aset this "featureSettings" val))
(defn loaded
"Property.
The loaded read-only property of the `web.fonts.FontFace` interface
a `js.Promise` that resolves with the current FontFace object
the font specified in the object's constructor is done loading
rejects with a SyntaxError.
`var aPromise = FontFace.loaded;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/loaded`"
[this]
(-> this (.loaded)))
(defn set-loaded!
"Property.
The loaded read-only property of the `web.fonts.FontFace` interface
a `js.Promise` that resolves with the current FontFace object
the font specified in the object's constructor is done loading
rejects with a SyntaxError.
`var aPromise = FontFace.loaded;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/loaded`"
[this val]
(aset this "loaded" val))
(defn status
"Property.
The status read-only property of the `web.fonts.FontFace` interface
an enumerated value indicating the status of the font, one of
\\\"loading\\\", \\\"loaded\\\", or \\\"error\\\".
`var status = FontFace.status;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/status`"
[this]
(-> this (.status)))
(defn set-status!
"Property.
The status read-only property of the `web.fonts.FontFace` interface
an enumerated value indicating the status of the font, one of
\\\"loading\\\", \\\"loaded\\\", or \\\"error\\\".
`var status = FontFace.status;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/status`"
[this val]
(aset this "status" val))
(defn stretch
"Property.
The stretch property of the `web.fonts.FontFace` interface retrieves
sets how the font stretches. It is equivalent to the `font-stretch`
`var stretchDescriptor = FontFace.stretch;
FontFace.stretch = stretchDescriptor;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/stretch`"
[this]
(-> this (.stretch)))
(defn set-stretch!
"Property.
The stretch property of the `web.fonts.FontFace` interface retrieves
sets how the font stretches. It is equivalent to the `font-stretch`
`var stretchDescriptor = FontFace.stretch;
FontFace.stretch = stretchDescriptor;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/stretch`"
[this val]
(aset this "stretch" val))
(defn style
"Property.
The style property of the `web.fonts.FontFace` interface retrieves
sets the font's style. It is equivalent to the `font-style` descriptor.
`var style = FontFace.style;
FontFace.style = value;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/style`"
[this]
(-> this (.style)))
(defn set-style!
"Property.
The style property of the `web.fonts.FontFace` interface retrieves
sets the font's style. It is equivalent to the `font-style` descriptor.
`var style = FontFace.style;
FontFace.style = value;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/style`"
[this val]
(aset this "style" val))
(defn unicode-range
"Property.
The unicodeRange property of the `web.fonts.FontFace` interface
or sets the range of unicode codepoints encompassing the font.
is equivalent to the `unicode-range` descriptor.
`var unicodeRangeDescriptor = FontFace.unicodeRange;
FontFace.unicodeRange = unicodeRangeDescriptor;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/unicodeRange`"
[this]
(-> this (.unicodeRange)))
(defn set-unicode-range!
"Property.
The unicodeRange property of the `web.fonts.FontFace` interface
or sets the range of unicode codepoints encompassing the font.
is equivalent to the `unicode-range` descriptor.
`var unicodeRangeDescriptor = FontFace.unicodeRange;
FontFace.unicodeRange = unicodeRangeDescriptor;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/unicodeRange`"
[this val]
(aset this "unicodeRange" val))
(defn variant
"Property.
The variant property of the `web.fonts.FontFace` interface programatically
or sets font variant values. It is equivalent to the `font-variant`
`var variantSubProperty = FontFace.variant;
FontFace.variant = variantSubProperty;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/variant`"
[this]
(-> this (.variant)))
(defn set-variant!
"Property.
The variant property of the `web.fonts.FontFace` interface programatically
or sets font variant values. It is equivalent to the `font-variant`
`var variantSubProperty = FontFace.variant;
FontFace.variant = variantSubProperty;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/variant`"
[this val]
(aset this "variant" val))
(defn weight
"Property.
The weight property of the `web.fonts.FontFace` interface retrieves
sets the weight of the font. It is equivalent to the `font-weight`
`var weightDescriptor = FontFace.weight;
FontFace.weight = weightDescriptor;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/weight`"
[this]
(-> this (.weight)))
(defn set-weight!
"Property.
The weight property of the `web.fonts.FontFace` interface retrieves
sets the weight of the font. It is equivalent to the `font-weight`
`var weightDescriptor = FontFace.weight;
FontFace.weight = weightDescriptor;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/FontFace/weight`"
[this val]
(aset this "weight" val))