For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface FontFaceSet

The FontFaceSet interface of the CSS Font Loading API manages the loading of font-faces and querying of their download status.

MDN Reference

interface FontFaceSet {
    "[toStringTag]": string;
    onloading: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
    onloadingdone:
        | ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any)
        | null;
    onloadingerror:
        | ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any)
        | null;
    ready: Promise<FontFaceSet>;
    size: number;
    status: FontFaceSetLoadStatus;
    "[iterator]"(): SetIterator<FontFace>;
    add(value: FontFace): this;
    addEventListener<K extends keyof FontFaceSetEventMap>(
        type: K,
        listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any,
        options?: boolean | AddEventListenerOptions,
    ): void;
    addEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | AddEventListenerOptions,
    ): void;
    check(font: string, text?: string): boolean;
    clear(): void;
    delete(value: FontFace): boolean;
    dispatchEvent(event: Event): boolean;
    entries(): SetIterator<[FontFace, FontFace]>;
    forEach(
        callbackfn: (
            value: FontFace,
            key: FontFace,
            parent: FontFaceSet,
        ) => void,
        thisArg?: any,
    ): void;
    has(value: FontFace): boolean;
    keys(): SetIterator<FontFace>;
    load(font: string, text?: string): Promise<FontFace[]>;
    removeEventListener<K extends keyof FontFaceSetEventMap>(
        type: K,
        listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any,
        options?: boolean | EventListenerOptions,
    ): void;
    removeEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | EventListenerOptions,
    ): void;
    values(): SetIterator<FontFace>;
}

Hierarchy

Index
"[toStringTag]": string
onloading: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null
onloadingdone: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null
onloadingerror: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null
ready: Promise<FontFaceSet>

The ready read-only property of the FontFaceSet interface returns a Promise that resolves to the given FontFaceSet.

MDN Reference

size: number

the number of (unique) elements in Set.

The status read-only property of the FontFaceSet interface returns the loading state of the fonts in the set.

MDN Reference

  • Appends a new element with a specified value to the end of the Set.

    Parameters

    Returns this

  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Type Parameters

    Parameters

    Returns void

  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Parameters

    Returns void

  • The check() method of the FontFaceSet returns true if you can render some text using the given font specification without attempting to use any fonts in this FontFaceSet that are not yet fully loaded. This means you can use the font specification without causing a font swap.

    MDN Reference

    Parameters

    • font: string
    • Optionaltext: string

    Returns boolean

  • Removes all elements from the Set.

    Returns void

  • Removes a specified value from the Set.

    Parameters

    Returns boolean

    Returns true if an element in the Set existed and has been removed, or false if the element does not exist.

  • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

    MDN Reference

    Parameters

    • event: Event

    Returns boolean

  • Parameters

    Returns void

  • Parameters

    Returns boolean

    a boolean indicating whether an element with the specified value exists in the Set or not.

  • The load() method of the FontFaceSet forces all the fonts given in parameters to be loaded.

    MDN Reference

    Parameters

    • font: string
    • Optionaltext: string

    Returns Promise<FontFace[]>

  • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

    MDN Reference

    Type Parameters

    Parameters

    Returns void

  • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

    MDN Reference

    Parameters

    Returns void

Was this helpful?