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
13typedef (ArrayBuffer or ArrayBufferView) BinaryData;
14
15dictionary FontFaceDescriptors {
16  DOMString style = "normal";
17  DOMString weight = "normal";
18  DOMString stretch = "normal";
19  DOMString unicodeRange = "U+0-10FFFF";
20  DOMString variant = "normal";
21  DOMString featureSettings = "normal";
22  DOMString variationSettings = "normal";
23  DOMString display = "auto";
24};
25
26enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" };
27
28// Bug 1072107 is for exposing this in workers.
29// [Exposed=(Window,Worker)]
30[Constructor(DOMString family,
31             (DOMString or BinaryData) source,
32             optional FontFaceDescriptors descriptors),
33 Pref="layout.css.font-loading-api.enabled"]
34interface FontFace {
35  [SetterThrows] attribute DOMString family;
36  [SetterThrows] attribute DOMString style;
37  [SetterThrows] attribute DOMString weight;
38  [SetterThrows] attribute DOMString stretch;
39  [SetterThrows] attribute DOMString unicodeRange;
40  [SetterThrows] attribute DOMString variant;
41  [SetterThrows] attribute DOMString featureSettings;
42  [SetterThrows, Pref="layout.css.font-variations.enabled"] attribute DOMString variationSettings;
43  [SetterThrows, Pref="layout.css.font-display.enabled"] attribute DOMString display;
44
45  readonly attribute FontFaceLoadStatus status;
46
47  [Throws]
48  Promise<FontFace> load();
49
50  [Throws]
51  readonly attribute Promise<FontFace> loaded;
52};
53