FontFace.webidl (2227B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * http://dev.w3.org/csswg/css-font-loading/#fontface-interface 8 * 9 * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C 10 * liability, trademark and document use rules apply. 11 */ 12 13 typedef (ArrayBuffer or ArrayBufferView) BinaryData; 14 15 dictionary FontFaceDescriptors { 16 UTF8String style = "normal"; 17 UTF8String weight = "normal"; 18 UTF8String stretch = "normal"; 19 UTF8String unicodeRange = "U+0-10FFFF"; 20 UTF8String variant = "normal"; 21 UTF8String featureSettings = "normal"; 22 [Pref="layout.css.font-variations.enabled"] UTF8String variationSettings = "normal"; 23 UTF8String display = "auto"; 24 UTF8String ascentOverride = "normal"; 25 UTF8String descentOverride = "normal"; 26 UTF8String lineGapOverride = "normal"; 27 UTF8String sizeAdjust = "100%"; 28 }; 29 30 enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" }; 31 32 [Exposed=(Window,Worker)] 33 interface FontFace { 34 [Throws] 35 constructor(UTF8String family, 36 (UTF8String or BinaryData) source, 37 optional FontFaceDescriptors descriptors = {}); 38 39 [SetterThrows] attribute UTF8String family; 40 [SetterThrows] attribute UTF8String style; 41 [SetterThrows] attribute UTF8String weight; 42 [SetterThrows] attribute UTF8String stretch; 43 [SetterThrows] attribute UTF8String unicodeRange; 44 [SetterThrows] attribute UTF8String variant; 45 [SetterThrows] attribute UTF8String featureSettings; 46 [SetterThrows, Pref="layout.css.font-variations.enabled"] attribute UTF8String variationSettings; 47 [SetterThrows] attribute UTF8String display; 48 [SetterThrows] attribute UTF8String ascentOverride; 49 [SetterThrows] attribute UTF8String descentOverride; 50 [SetterThrows] attribute UTF8String lineGapOverride; 51 [SetterThrows] attribute UTF8String sizeAdjust; 52 53 readonly attribute FontFaceLoadStatus status; 54 55 [Throws] 56 Promise<FontFace> load(); 57 58 [Throws] 59 readonly attribute Promise<FontFace> loaded; 60 };