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