From a4fdf3e4853af40542a6bb3a9cebc8b76dc760a8 Mon Sep 17 00:00:00 2001
From: "Tab Atkins Jr." FontFaceSet
Interface
[Exposed=Window,Worker,
Constructor(sequenceFontFaceSet
Interface
};
-
-
+
- size
attribute of the {{FontFaceSet}}'s {{[[ContainedFonts]]}} slot.
-
"loading"
.
Otherwise, it must have the value "loaded"
.
-
-
{{FontFaceSet}} objects also have internal
\[[LoadingFonts]],
\[[LoadedFonts]],
and \[[FailedFonts]] slots,
- all of which are initialized to the empty list,
- a \[[ReadyPromise]] slot,
- which is initialized to a fresh pending {{Promise}},
- and a \[[ContainedFonts]] slot,
- which is initialized by the FontFaceSet constructor to a {{Set}} object
- (though see [[#document-font-face-set]] for information on how the Set may be pre-filled
- for {{FontFaceSet}} objects created by the user agent).
+ all of which are initialized to empty lists,
+ and a \[[ReadyPromise]] slot,
+ which is initialized to a fresh pending {{Promise}}.
Because font families are loaded only when they are used,
content sometimes needs to understand when the loading of fonts occurs.
@@ -976,9 +945,6 @@ Interaction with CSS’s ''@font-face'' Rule
As specified in [[#font-face-css-connection]], though,
the {{FontFace}} is no longer CSS-connected at that point.
- All non-CSS-connected {{FontFace}} objects must be sorted after the CSS-connected ones,
- in insertion order.
-
Note: It is expected that a future version of this specification
will define ways of interacting with and querying local fonts as well.
diff --git a/css-font-loading/Overview.html b/css-font-loading/Overview.html
index 66891764345..64b66e0d56d 100644
--- a/css-font-loading/Overview.html
+++ b/css-font-loading/Overview.html
@@ -54,8 +54,8 @@
Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.
@@ -183,7 +183,7 @@typedef (ArrayBuffer or ArrayBufferView) BinaryData; +typedef (ArrayBuffer or ArrayBufferView) BinaryData; dictionary FontFaceDescriptors { DOMString style = "normal"; @@ -196,8 +196,8 @@@@ -475,57 +475,48 @@FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" }; -[Constructor(DOMString family, (DOMString or BinaryData) source, - optional FontFaceDescriptors descriptors), +[Constructor(DOMString family, (DOMString or BinaryData) source, + optional FontFaceDescriptors descriptors), Exposed=Window,Worker] interface FontFace { attribute DOMString family; @@ -208,10 +208,10 @@
variant; attribute DOMString featureSettings; - readonly attribute FontFaceLoadStatus status; + readonly attribute FontFaceLoadStatus status; - Promise<FontFace> load(); - readonly attribute Promise<FontFace> loaded; + Promise<FontFace> load(); + readonly attribute Promise<FontFace> loaded; };
3. The
FontFaceSet
Interface
dictionary FontFaceSetLoadEventInit : EventInit { - sequence<FontFace> fontfaces = []; +dictionary FontFaceSetLoadEventInit : EventInit { + sequence<FontFace> fontfaces = []; }; -[Constructor(DOMString type, optional FontFaceSetLoadEventInit eventInitDict), +[Constructor(DOMString type, optional FontFaceSetLoadEventInit eventInitDict), Exposed=Window,Worker] -interface FontFaceSetLoadEvent : Event { - readonly attribute sequence<FontFace> fontfaces; +interface FontFaceSetLoadEvent : Event { + readonly attribute sequence<FontFace> fontfaces; }; enum FontFaceSetLoadStatus { "loading", "loaded" }; -callback ForEachCallback = void (FontFace font, long index, FontFaceSet self); +callback ForEachCallback = void (FontFace font, long index, FontFaceSet self); [Exposed=Window,Worker, Constructor(sequence initialFaces)] -interface FontFaceSet : EventTarget { - // Emulate the Set interface, until we can extend Set correctly. - readonly attribute unsigned long size; - void add(FontFace font); - boolean has(FontFace font); - boolean delete(FontFace font); - void clear(); - Iterator entries(); - Iterator keys(); - Iterator values(); - void forEach(ForEachCallback cb, optional anythisArg); - FontFace iterator; - - // -- events for when loading state changes - attribute EventHandler onloading; - attribute EventHandler onloadingdone; - attribute EventHandler onloadingerror; +interface FontFaceSet : EventTarget { + // FontFaceSet is Set-like! + setlike<FontFace>; + + // events for when loading state changes + attribute EventHandler onloading; + attribute EventHandler onloadingdone; + attribute EventHandler onloadingerror; // check and start loads if appropriate // and fulfill promise when all loads complete - Promise<sequence<FontFace>> load(DOMString font, optional DOMString text = " "); + Promise<sequence<FontFace>> load(DOMString font, optional DOMString text = " "); // return whether all fonts in the fontlist are loaded // (does not initiate load if not available) boolean check(DOMString font, optional DOMString text = " "); // async notification that font loading and layout operations are done - readonly attribute Promise<FontFaceSet> ready; + readonly attribute Promise<FontFaceSet> ready; // loading state, "loading" while one or more fonts loading, "loaded" otherwise - readonly attribute FontFaceSetLoadStatus status; + readonly attribute FontFaceSetLoadStatus status; };-
FontFaceSet
's [[ReadyPromise]]
slot.
@@ -533,64 +524,42 @@ Promise
and its use.
- size
attribute of the FontFaceSet
's [[ContainedFonts]]
slot.
-
status
attribute must have the value "loading"
.
Otherwise, it must have the value "loaded"
.
- FontFace
> initialFaces)
FontFaceSet
constructor, when called,
- must construct a new Set
object
- by passing its initialFaces
argument
- to the Set
constructor,
- then assigning that Set
object to the FontFaceSet
's [[ContainedFonts]]
slot.
-
- FontFace
font)
- FontFace
font)
- FontFace
font)
- ForEachCallback
cb, optional any thisArg)
- add()
or delete()
are called
- with an argument that is a CSS-connected FontFace
object,
- they must throw an InvalidModificationError exception.
+ must iterate its initialFaces
argument
+ and add each value to its set entries.
-All of these methods call the corresponding method of the FontFaceSet
's [[ContainedFonts]]
slot
- with the same arguments as were passed to them,
- and return the value returned by the called method.
FontFace
objects
- from the FontFaceSet
's [[ContainedFonts]]
slot.
+ When iterated over,
+ all CSS-connected FontFace
objects must come first,
+ in document order of their connected @font-face rules,
+ followed by the non-CSS-connected FontFace
objects,
+ in insertion order.
- FontFaceSet
's [[ContainedFonts]]
slot.
+ If a FontFaceSet
is a font source,
+ its set entries are initialized as specified in §4.2
+Interaction with CSS’s @font-face Rule.
+
+Otherwise, its set entries are initially empty.
FontFaceSet
objects also have internal
[[LoadingFonts]],
[[LoadedFonts]],
and [[FailedFonts]] slots,
- all of which are initialized to the empty list,
- a [[ReadyPromise]] slot,
- which is initialized to a fresh pending Promise
,
- and a [[ContainedFonts]] slot,
- which is initialized by the FontFaceSet constructor to a Set
object
- (though see §4.2
-Interaction with CSS’s @font-face Rule for information on how the Set may be pre-filled
- for FontFaceSet
objects created by the user agent).
Promise
.
Because font families are loaded only when they are used, content sometimes needs to understand when the loading of fonts occurs. @@ -975,11 +944,11 @@
[NoInterfaceObject] interface FontFaceSource { - readonly attribute FontFaceSet fonts; + readonly attribute FontFaceSet fonts; }; -Document implements FontFaceSource; -WorkerGlobalScope implements FontFaceSource; +Document implements FontFaceSource; +WorkerGlobalScope implements FontFaceSource;
Any document, workers, or other context which can use fonts in some manner must implement the FontFaceSource
interface.
@@ -1019,9 +988,6 @@
FontFace
is no longer CSS-connected at that point.
-All non-CSS-connected FontFace
objects must be sorted after the CSS-connected ones,
- in insertion order.
Note: It is expected that a future version of this specification will define ways of interacting with and querying local fonts as well.
@@ -1258,7 +1224,7 @@typedef (ArrayBuffer or ArrayBufferView) BinaryData; +References
Normative References
typedef (ArrayBuffer or ArrayBufferView) BinaryData; dictionary FontFaceDescriptors { DOMString style = "normal"; @@ -1271,8 +1237,8 @@References< enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" }; -[Constructor(DOMString family, (DOMString or BinaryData) source, - optional FontFaceDescriptors descriptors), +[Constructor(DOMString family, (DOMString or BinaryData) source, + optional FontFaceDescriptors descriptors), Exposed=Window,Worker] interface FontFace { attribute DOMString family; @@ -1283,68 +1249,59 @@
References< attribute DOMString variant; attribute DOMString featureSettings; - readonly attribute FontFaceLoadStatus status; + readonly attribute FontFaceLoadStatus status; - Promise<FontFace> load(); - readonly attribute Promise<FontFace> loaded; + Promise<FontFace> load(); + readonly attribute Promise<FontFace> loaded; }; -dictionary FontFaceSetLoadEventInit : EventInit { - sequence<FontFace> fontfaces = []; +dictionary FontFaceSetLoadEventInit : EventInit { + sequence<FontFace> fontfaces = []; }; -[Constructor(DOMString type, optional FontFaceSetLoadEventInit eventInitDict), +[Constructor(DOMString type, optional FontFaceSetLoadEventInit eventInitDict), Exposed=Window,Worker] -interface FontFaceSetLoadEvent : Event { - readonly attribute sequence<FontFace> fontfaces; +interface FontFaceSetLoadEvent : Event { + readonly attribute sequence<FontFace> fontfaces; }; enum FontFaceSetLoadStatus { "loading", "loaded" }; -callback ForEachCallback = void (FontFace font, long index, FontFaceSet self); +callback ForEachCallback = void (FontFace font, long index, FontFaceSet self); [Exposed=Window,Worker, Constructor(sequence initialFaces)] -interface FontFaceSet : EventTarget { - // Emulate the Set interface, until we can extend Set correctly. - readonly attribute unsigned long size; - void add(FontFace font); - boolean has(FontFace font); - boolean delete(FontFace font); - void clear(); - Iterator entries(); - Iterator keys(); - Iterator values(); - void forEach(ForEachCallback cb, optional anythisArg); - FontFace iterator; - - // -- events for when loading state changes - attribute EventHandler onloading; - attribute EventHandler onloadingdone; - attribute EventHandler onloadingerror; +interface FontFaceSet : EventTarget { + // FontFaceSet is Set-like! + setlike<FontFace>; + + // events for when loading state changes + attribute EventHandler onloading; + attribute EventHandler onloadingdone; + attribute EventHandler onloadingerror; // check and start loads if appropriate // and fulfill promise when all loads complete - Promise<sequence<FontFace>> load(DOMString font, optional DOMString text = " "); + Promise<sequence<FontFace>> load(DOMString font, optional DOMString text = " "); // return whether all fonts in the fontlist are loaded // (does not initiate load if not available) boolean check(DOMString font, optional DOMString text = " "); // async notification that font loading and layout operations are done - readonly attribute Promise<FontFaceSet> ready; + readonly attribute Promise<FontFaceSet> ready; // loading state, "loading" while one or more fonts loading, "loaded" otherwise - readonly attribute FontFaceSetLoadStatus status; + readonly attribute FontFaceSetLoadStatus status; }; [NoInterfaceObject] interface FontFaceSource { - readonly attribute FontFaceSet fonts; + readonly attribute FontFaceSet fonts; }; -Document implements FontFaceSource; -WorkerGlobalScope implements FontFaceSource; +Document implements FontFaceSource; +WorkerGlobalScope implements FontFaceSource;