Newer
Older
minerva / Userland / Libraries / LibWeb / CSS / FontFace.idl
@minerva minerva on 13 Jul 1 KB Initial commit
dictionary FontFaceDescriptors {
    CSSOMString style = "normal";
    CSSOMString weight = "normal";
    CSSOMString stretch = "normal";
    CSSOMString unicodeRange = "U+0-10FFFF";
    CSSOMString featureSettings = "normal";
    CSSOMString variationSettings = "normal";
    CSSOMString display = "auto";
    CSSOMString ascentOverride = "normal";
    CSSOMString descentOverride = "normal";
    CSSOMString lineGapOverride = "normal";
};

enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" };

// https://drafts.csswg.org/css-font-loading/#fontface-interface
[Exposed=(Window,Worker)]
interface FontFace {
    // FIXME: BufferSource usage needs https://github.com/w3c/csswg-drafts/pull/10309
    constructor(CSSOMString family, (CSSOMString or BufferSource) source, optional FontFaceDescriptors descriptors = {});
    attribute CSSOMString family;
    attribute CSSOMString style;
    attribute CSSOMString weight;
    attribute CSSOMString stretch;
    attribute CSSOMString unicodeRange;
    attribute CSSOMString featureSettings;
    attribute CSSOMString variationSettings;
    attribute CSSOMString display;
    attribute CSSOMString ascentOverride;
    attribute CSSOMString descentOverride;
    attribute CSSOMString lineGapOverride;

    readonly attribute FontFaceLoadStatus status;

    Promise<FontFace> load();
    readonly attribute Promise<FontFace> loaded;
};