@@ -199,75 +199,67 @@ The Constructor</h3>
199199 When the <dfn method title='FontFace()' for=FontFace>FontFace</dfn> (DOMString <dfn argument for="FontFace/FontFace()">family</dfn> , (DOMString or {{BinaryData}} ) <dfn argument for="FontFace/FontFace()">source</dfn> , {{FontFaceDescriptors}} <dfn argument for="FontFace/FontFace()">descriptors</dfn> ) method is called,
200200 execute these steps:
201201
202- <ol link-type=idl>
203- <li>
204- Let <var> font face</var> be a fresh {{FontFace}} object.
205- Set <var> font face's</var> {{FontFace/status}} attribute to <code> "unloaded"</code> ,
206- Set its internal {{[[FontStatusPromise]]}} slot to a fresh pending {{Promise}} object.
207-
208- Parse the {{family!argument}} argument,
209- and the members of the {{descriptors!argument}} argument,
210- according to the grammars of the corresponding descriptors of the CSS ''@font-face'' rule.
211- If any of them fail to parse correctly,
212- reject <var> font face's</var> {{[[FontStatusPromise]]}} with a DOMException named "SyntaxError",
213- and set <var> font face’s</var> {{FontFace/status}} attribute to "error".
214- Otherwise, set <var> font face's</var> corresponding attributes to the serialization of the parsed values.
215-
216- Return <var> font face</var> .
217- If <var> font face’s</a> {{FontFace/status}} is "error",
218- terminate this algorithm;
219- otherwise,
220- complete the rest of these steps asynchronously.
221-
222- <li>
223- If the {{source!argument}} argument was a {{DOMString}} ,
224- parse it according to the grammar of the 'src' descriptor of the CSS ''@font-face'' rule.
225- If it fails to parse correctly,
226- reject <var> font face's</var> {{[[FontStatusPromise]]}} with a DOMException named "SyntaxError" exception,
227- queue a task to set <var> font face’s</var> {{FontFace/status}} attribute to "error",
228- and abort these steps;
229- otherwise, set <var> font face's</var> internal {{[[Urls]]}} slot to the string.
230-
231- Note: Note that this means that passing a naked url as the source argument,
232- like <code> "http://example.com/myFont.woff"</code> ,
233- won't work - it needs to be at least wrapped in a ''url()'' function,
234- like <code> "url(http://example.com/myFont.woff)"</code> .
235- In return for this inconvenience,
236- you get to specify multiple fallbacks,
237- specify the type of font each fallback is,
238- and refer to local fonts easily.
239-
240- Issue: Need to define the base url,
241- so relative urls can resolve.
242- Should it be the url of the document?
243- Is that correct for workers too,
244- or should they use their worker url?
245- Is that always defined?
246-
247- If the {{source}} argument was a {{BinaryData}} ,
248- set <var> font face's</var> internal {{[[Data]]}} slot to the passed argument.
249-
250- <li>
251- If <var> font face's</var> {{[[Data]]}} slot is not <code> null</code> ,
252- queue a task to set <var> font face's</var> {{FontFace/status}} attribute to "loading".
253- Attempt to parse the data in it as a font.
254- When this is completed,
255- successfully or not,
256- queue a task to run the following steps synchronously:
257-
258- <ol>
259- <li>
260- If the load was successful,
261- <var> font face</var> now represents the parsed font;
262- fulfill <var> font face's</var> {{[[FontStatusPromise]]}} with <var> font face</var> ,
263- and set its {{FontFace/status}} attribute to "loaded".
264-
265- <li>
266- Otherwise,
267- reject <var> font face's</var> {{[[FontStatusPromise]]}} with a DOMException named "SyntaxError"
268- and set <var> font face's</var> {{FontFace/status}} attribute to "error".
269- </ol>
270- </ol>
202+ 1. Let <var> font face</var> be a fresh {{FontFace}} object.
203+ Set <var> font face's</var> {{FontFace/status}} attribute to <code> "unloaded"</code> ,
204+ Set its internal {{[[FontStatusPromise]]}} slot to a fresh pending {{Promise}} object.
205+
206+ Parse the {{family!argument}} argument,
207+ and the members of the {{descriptors!argument}} argument,
208+ according to the grammars of the corresponding descriptors of the CSS ''@font-face'' rule.
209+ If any of them fail to parse correctly,
210+ reject <var> font face's</var> {{[[FontStatusPromise]]}} with a DOMException named "SyntaxError",
211+ set <var> font face’s</var> corresponding attributes to the empty string,
212+ and set <var> font face’s</var> {{FontFace/status}} attribute to "error".
213+ Otherwise, set <var> font face's</var> corresponding attributes to the serialization of the parsed values.
214+
215+ Return <var> font face</var> .
216+ If <var> font face’s</a> {{FontFace/status}} is "error",
217+ terminate this algorithm;
218+ otherwise,
219+ complete the rest of these steps asynchronously.
220+
221+ 2. If the {{source!argument}} argument was a {{DOMString}} ,
222+ parse it according to the grammar of the 'src' descriptor of the CSS ''@font-face'' rule.
223+ If it fails to parse correctly,
224+ reject <var> font face's</var> {{[[FontStatusPromise]]}} with a DOMException named "SyntaxError" exception,
225+ queue a task to set <var> font face’s</var> {{FontFace/status}} attribute to "error",
226+ and abort these steps;
227+ otherwise, set <var> font face's</var> internal {{[[Urls]]}} slot to the string.
228+
229+ Note: Note that this means that passing a naked url as the source argument,
230+ like <code> "http://example.com/myFont.woff"</code> ,
231+ won't work - it needs to be at least wrapped in a ''url()'' function,
232+ like <code> "url(http://example.com/myFont.woff)"</code> .
233+ In return for this inconvenience,
234+ you get to specify multiple fallbacks,
235+ specify the type of font each fallback is,
236+ and refer to local fonts easily.
237+
238+ Issue: Need to define the base url,
239+ so relative urls can resolve.
240+ Should it be the url of the document?
241+ Is that correct for workers too,
242+ or should they use their worker url?
243+ Is that always defined?
244+
245+ If the {{source}} argument was a {{BinaryData}} ,
246+ set <var> font face's</var> internal {{[[Data]]}} slot to the passed argument.
247+
248+ 3. If <var> font face's</var> {{[[Data]]}} slot is not <code> null</code> ,
249+ queue a task to set <var> font face's</var> {{FontFace/status}} attribute to "loading".
250+ Attempt to parse the data in it as a font.
251+ When this is completed,
252+ successfully or not,
253+ queue a task to run the following steps synchronously:
254+
255+ 1. If the load was successful,
256+ <var> font face</var> now represents the parsed font;
257+ fulfill <var> font face's</var> {{[[FontStatusPromise]]}} with <var> font face</var> ,
258+ and set its {{FontFace/status}} attribute to "loaded".
259+
260+ 2. Otherwise,
261+ reject <var> font face's</var> {{[[FontStatusPromise]]}} with a DOMException named "SyntaxError"
262+ and set <var> font face's</var> {{FontFace/status}} attribute to "error".
271263
272264 Note: Newly constructed FontFace objects are not automatically added
273265 to the FontFaceSet associated with a document
0 commit comments