blob: 89de61d73df695195e8b003ea0b10b4a950234c1 [file] [log] [blame]
Victor Porof6e096922022-06-10 13:01:05 +00001// GENERATED CONTENT - DO NOT EDIT
2// Content was automatically extracted by Reffy into webref
3// (https://github.com/w3c/webref)
4// Source: CSS Font Loading Module Level 3 (https://drafts.csswg.org/css-font-loading/)
5
6typedef (ArrayBuffer or ArrayBufferView) BinaryData;
7
8dictionary FontFaceDescriptors {
9 CSSOMString style = "normal";
10 CSSOMString weight = "normal";
11 CSSOMString stretch = "normal";
12 CSSOMString unicodeRange = "U+0-10FFFF";
13 CSSOMString variant = "normal";
14 CSSOMString featureSettings = "normal";
15 CSSOMString variationSettings = "normal";
16 CSSOMString display = "auto";
17 CSSOMString ascentOverride = "normal";
18 CSSOMString descentOverride = "normal";
19 CSSOMString lineGapOverride = "normal";
20};
21
22enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" };
23
24[Exposed=(Window,Worker)]
25interface FontFace {
26 constructor(CSSOMString family, (CSSOMString or BinaryData) source,
27 optional FontFaceDescriptors descriptors = {});
28 attribute CSSOMString family;
29 attribute CSSOMString style;
30 attribute CSSOMString weight;
31 attribute CSSOMString stretch;
32 attribute CSSOMString unicodeRange;
33 attribute CSSOMString variant;
34 attribute CSSOMString featureSettings;
35 attribute CSSOMString variationSettings;
36 attribute CSSOMString display;
37 attribute CSSOMString ascentOverride;
38 attribute CSSOMString descentOverride;
39 attribute CSSOMString lineGapOverride;
40
41 readonly attribute FontFaceLoadStatus status;
42
43 Promise<FontFace> load();
44 readonly attribute Promise<FontFace> loaded;
45};
46
47[Exposed=(Window,Worker)]
48interface FontFaceFeatures {
49 /* The CSSWG is still discussing what goes in here */
50};
51
52[Exposed=(Window,Worker)]
53interface FontFaceVariationAxis {
54 readonly attribute DOMString name;
55 readonly attribute DOMString axisTag;
56 readonly attribute double minimumValue;
57 readonly attribute double maximumValue;
58 readonly attribute double defaultValue;
59};
60
61[Exposed=(Window,Worker)]
62interface FontFaceVariations {
63 readonly setlike<FontFaceVariationAxis>;
64};
65
66[Exposed=(Window,Worker)]
67interface FontFacePalette {
68 iterable<DOMString>;
69 readonly attribute unsigned long length;
70 getter DOMString (unsigned long index);
71 readonly attribute boolean usableWithLightBackground;
72 readonly attribute boolean usableWithDarkBackground;
73};
74
75[Exposed=(Window,Worker)]
76interface FontFacePalettes {
77 iterable<FontFacePalette>;
78 readonly attribute unsigned long length;
79 getter FontFacePalette (unsigned long index);
80};
81
82partial interface FontFace {
83 readonly attribute FontFaceFeatures features;
84 readonly attribute FontFaceVariations variations;
85 readonly attribute FontFacePalettes palettes;
86};
87
88dictionary FontFaceSetLoadEventInit : EventInit {
89 sequence<FontFace> fontfaces = [];
90};
91
92[Exposed=(Window,Worker)]
93interface FontFaceSetLoadEvent : Event {
94 constructor(CSSOMString type, optional FontFaceSetLoadEventInit eventInitDict = {});
95 [SameObject] readonly attribute FrozenArray<FontFace> fontfaces;
96};
97
98enum FontFaceSetLoadStatus { "loading", "loaded" };
99
100[Exposed=(Window,Worker)]
101interface FontFaceSet : EventTarget {
102 constructor(sequence<FontFace> initialFaces);
103
104 setlike<FontFace>;
105 FontFaceSet add(FontFace font);
106 boolean delete(FontFace font);
107 undefined clear();
108
109 // events for when loading state changes
110 attribute EventHandler onloading;
111 attribute EventHandler onloadingdone;
112 attribute EventHandler onloadingerror;
113
114 // check and start loads if appropriate
115 // and fulfill promise when all loads complete
116 Promise<sequence<FontFace>> load(CSSOMString font, optional CSSOMString text = " ");
117
118 // return whether all fonts in the fontlist are loaded
119 // (does not initiate load if not available)
120 boolean check(CSSOMString font, optional CSSOMString text = " ");
121
122 // async notification that font loading and layout operations are done
123 readonly attribute Promise<FontFaceSet> ready;
124
125 // loading state, "loading" while one or more fonts loading, "loaded" otherwise
126 readonly attribute FontFaceSetLoadStatus status;
127};
128
129interface mixin FontFaceSource {
130 readonly attribute FontFaceSet fonts;
131};
132
133Document includes FontFaceSource;
134WorkerGlobalScope includes FontFaceSource;