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  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  [Pref="layout.css.font-display.enabled"] UTF8String display = "auto";
24  [Pref="layout.css.font-metrics-overrides.enabled"] UTF8String ascentOverride = "normal";
25  [Pref="layout.css.font-metrics-overrides.enabled"] UTF8String descentOverride = "normal";
26  [Pref="layout.css.font-metrics-overrides.enabled"] UTF8String lineGapOverride = "normal";
27  [Pref="layout.css.size-adjust.enabled"] UTF8String sizeAdjust = "100%";
28};
29
30enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" };
31
32// Bug 1072107 is for exposing this in workers.
33// [Exposed=(Window,Worker)]
34[Pref="layout.css.font-loading-api.enabled",
35 Exposed=Window]
36interface FontFace {
37  [Throws]
38  constructor(UTF8String family,
39              (UTF8String or BinaryData) source,
40              optional FontFaceDescriptors descriptors = {});
41
42  [SetterThrows] attribute UTF8String family;
43  [SetterThrows] attribute UTF8String style;
44  [SetterThrows] attribute UTF8String weight;
45  [SetterThrows] attribute UTF8String stretch;
46  [SetterThrows] attribute UTF8String unicodeRange;
47  [SetterThrows] attribute UTF8String variant;
48  [SetterThrows] attribute UTF8String featureSettings;
49  [SetterThrows, Pref="layout.css.font-variations.enabled"] attribute UTF8String variationSettings;
50  [SetterThrows, Pref="layout.css.font-display.enabled"] attribute UTF8String display;
51  [SetterThrows, Pref="layout.css.font-metrics-overrides.enabled"] attribute UTF8String ascentOverride;
52  [SetterThrows, Pref="layout.css.font-metrics-overrides.enabled"] attribute UTF8String descentOverride;
53  [SetterThrows, Pref="layout.css.font-metrics-overrides.enabled"] attribute UTF8String lineGapOverride;
54  [SetterThrows, Pref="layout.css.size-adjust.enabled"] attribute UTF8String sizeAdjust;
55
56  readonly attribute FontFaceLoadStatus status;
57
58  [Throws]
59  Promise<FontFace> load();
60
61  [Throws]
62  readonly attribute Promise<FontFace> loaded;
63};
64