Skip to content

Commit

Permalink
[css-font-loading-3][editorial] Reference WebIDL BufferSource
Browse files Browse the repository at this point in the history
Rather than defining a custom BinaryData typedef, the FontSource
interface should just use the BufferSource definition from WebIDL.

https://webidl.spec.whatwg.org/#BufferSource
  • Loading branch information
ADKaster committed May 11, 2024
1 parent f62c438 commit a16cf74
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions css-font-loading-3/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ The <code>FontFace</code> Interface</h2>

The {{FontFace}} interface represents a single usable font face.
CSS ''@font-face'' rules implicitly define FontFace objects,
or they can be constructed manually from a url or binary data.
or they can be constructed manually from a url or a buffer source.

<xmp class="idl">
typedef (ArrayBuffer or ArrayBufferView) BinaryData;

dictionary FontFaceDescriptors {
CSSOMString style = "normal";
CSSOMString weight = "normal";
Expand All @@ -99,7 +97,7 @@ The <code>FontFace</code> Interface</h2>

[Exposed=(Window,Worker)]
interface FontFace {
constructor(CSSOMString family, (CSSOMString or BinaryData) source,
constructor(CSSOMString family, (CSSOMString or BufferSource) source,
optional FontFaceDescriptors descriptors = {});
attribute CSSOMString family;
attribute CSSOMString style;
Expand Down Expand Up @@ -210,7 +208,7 @@ The Constructor</h3>

A {{FontFace}} can be constructed either
from a URL pointing to a font face file,
or from an {{ArrayBuffer}} (or {{ArrayBufferView}}) containing the binary representation of a font face.
or from a {{BufferSource}} containing the binary representation of a font face.

When the <dfn constructor for=FontFace>FontFace(family, source, descriptors)</dfn> method is called,
execute these steps:
Expand Down Expand Up @@ -255,7 +253,7 @@ The Constructor</h3>
2. If the {{source!!argument}} argument was a {{CSSOMString}},
set <var>font face's</var> internal {{[[Urls]]}} slot to the string.

If the {{source}} argument was a {{BinaryData}},
If the {{source}} argument was a {{BufferSource}},
set <var>font face's</var> internal {{[[Data]]}} slot to the passed argument.

3. If <var>font face's</var> {{[[Data]]}} slot is not <code>null</code>,
Expand Down Expand Up @@ -317,7 +315,7 @@ The <code>load()</code> method</h3>

The {{FontFace/load()}} method of {{FontFace}}
forces a url-based font face to request its font data and load.
For fonts constructed from binary data,
For fonts constructed from a buffer source,
or fonts that are already loading or loaded,
it does nothing.

Expand Down

0 comments on commit a16cf74

Please sign in to comment.