Victor Porof | 6e09692 | 2022-06-10 13:01:05 +0000 | [diff] [blame] | 1 | // 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 | |
| 6 | typedef (ArrayBuffer or ArrayBufferView) BinaryData; |
| 7 | |
| 8 | dictionary 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 | |
| 22 | enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" }; |
| 23 | |
| 24 | [Exposed=(Window,Worker)] |
| 25 | interface 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)] |
| 48 | interface FontFaceFeatures { |
| 49 | /* The CSSWG is still discussing what goes in here */ |
| 50 | }; |
| 51 | |
| 52 | [Exposed=(Window,Worker)] |
| 53 | interface 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)] |
| 62 | interface FontFaceVariations { |
| 63 | readonly setlike<FontFaceVariationAxis>; |
| 64 | }; |
| 65 | |
| 66 | [Exposed=(Window,Worker)] |
| 67 | interface 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)] |
| 76 | interface FontFacePalettes { |
| 77 | iterable<FontFacePalette>; |
| 78 | readonly attribute unsigned long length; |
| 79 | getter FontFacePalette (unsigned long index); |
| 80 | }; |
| 81 | |
| 82 | partial interface FontFace { |
| 83 | readonly attribute FontFaceFeatures features; |
| 84 | readonly attribute FontFaceVariations variations; |
| 85 | readonly attribute FontFacePalettes palettes; |
| 86 | }; |
| 87 | |
| 88 | dictionary FontFaceSetLoadEventInit : EventInit { |
| 89 | sequence<FontFace> fontfaces = []; |
| 90 | }; |
| 91 | |
| 92 | [Exposed=(Window,Worker)] |
| 93 | interface FontFaceSetLoadEvent : Event { |
| 94 | constructor(CSSOMString type, optional FontFaceSetLoadEventInit eventInitDict = {}); |
| 95 | [SameObject] readonly attribute FrozenArray<FontFace> fontfaces; |
| 96 | }; |
| 97 | |
| 98 | enum FontFaceSetLoadStatus { "loading", "loaded" }; |
| 99 | |
| 100 | [Exposed=(Window,Worker)] |
| 101 | interface 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 | |
| 129 | interface mixin FontFaceSource { |
| 130 | readonly attribute FontFaceSet fonts; |
| 131 | }; |
| 132 | |
| 133 | Document includes FontFaceSource; |
| 134 | WorkerGlobalScope includes FontFaceSource; |