---
title: "FontFaceSet | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

# 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](https://developer.mozilla.org/docs/Web/API/FontFaceSet)

interface FontFaceSet {  
    ["\[toStringTag\]"](#tostringtag): string;  
    [onloading](#onloading): ((this: FontFaceSet, ev: [FontFaceSetLoadEvent](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetLoadEvent/)) \=> any) | null;  
    [onloadingdone](#onloadingdone):  
        | ((this: FontFaceSet, ev: [FontFaceSetLoadEvent](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetLoadEvent/)) \=> any)  
        | null;  
    [onloadingerror](#onloadingerror):  
        | ((this: FontFaceSet, ev: [FontFaceSetLoadEvent](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetLoadEvent/)) \=> any)  
        | null;  
    [ready](#ready): Promise<FontFaceSet\>;  
    [size](#size): number;  
    [status](#status): [FontFaceSetLoadStatus](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.FontFaceSetLoadStatus/);  
    ["\[iterator\]"](#iterator-1)(): [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>;  
    [add](#add-1)(value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)): this;  
    [addEventListener](#addeventlistener-1)<[K](#addeventlistenerk) extends keyof [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\>(  
        type: [K](#addeventlistenerk),  
        listener: (this: FontFaceSet, ev: [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\[[K](#addeventlistenerk)\]) \=> any,  
        options?: boolean | AddEventListenerOptions,  
    ): void;  
    [addEventListener](#addeventlistener-2)(  
        type: string,  
        listener: [EventListenerOrEventListenerObject](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.EventListenerOrEventListenerObject/),  
        options?: boolean | AddEventListenerOptions,  
    ): void;  
    [check](#check-1)(font: string, text?: string): boolean;  
    [clear](#clear-1)(): void;  
    [delete](#delete-1)(value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)): boolean;  
    [dispatchEvent](#dispatchevent-1)(event: Event): boolean;  
    [entries](#entries-1)(): [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<\[[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/), [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\]\>;  
    [forEach](#foreach-1)(  
        callbackfn: (  
            value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/),  
            key: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/),  
            parent: FontFaceSet,  
        ) \=> void,  
        thisArg?: any,  
    ): void;  
    [has](#has-1)(value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)): boolean;  
    [keys](#keys-1)(): [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>;  
    [load](#load-1)(font: string, text?: string): Promise<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\[\]\>;  
    [removeEventListener](#removeeventlistener-1)<[K](#removeeventlistenerk) extends keyof [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\>(  
        type: [K](#removeeventlistenerk),  
        listener: (this: FontFaceSet, ev: [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\[[K](#removeeventlistenerk)\]) \=> any,  
        options?: boolean | EventListenerOptions,  
    ): void;  
    [removeEventListener](#removeeventlistener-2)(  
        type: string,  
        listener: [EventListenerOrEventListenerObject](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.EventListenerOrEventListenerObject/),  
        options?: boolean | EventListenerOptions,  
    ): void;  
    [values](#values-1)(): [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>;  
}

#### Hierarchy

-   EventTarget
-   Set<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>
    -   FontFaceSet

##### Index

### Properties[](#properties)

[\[toStringTag\]](#tostringtag) [onloading](#onloading) [onloadingdone](#onloadingdone) [onloadingerror](#onloadingerror) [ready](#ready) [size](#size) [status](#status)

### Methods[](#methods)

[\[iterator\]](#iterator) [add](#add) [addEventListener](#addeventlistener) [check](#check) [clear](#clear) [delete](#delete) [dispatchEvent](#dispatchevent) [entries](#entries) [forEach](#foreach) [has](#has) [keys](#keys) [load](#load) [removeEventListener](#removeeventlistener) [values](#values)

## Properties[](#properties-1)

### `Readonly`\[toStringTag\][](#tostringtag)

"\[toStringTag\]": string

### onloading[](#onloading)

onloading: ((this: FontFaceSet, ev: [FontFaceSetLoadEvent](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetLoadEvent/)) \=> any) | null

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loading_event)

### onloadingdone[](#onloadingdone)

onloadingdone: ((this: FontFaceSet, ev: [FontFaceSetLoadEvent](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetLoadEvent/)) \=> any) | null

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingdone_event)

### onloadingerror[](#onloadingerror)

onloadingerror: ((this: FontFaceSet, ev: [FontFaceSetLoadEvent](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetLoadEvent/)) \=> any) | null

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingerror_event)

### `Readonly`ready[](#ready)

ready: Promise<FontFaceSet\>

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

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready)

### `Readonly`size[](#size)

size: number

#### Returns[](#returns)

the number of (unique) elements in Set.

### `Readonly`status[](#status)

status: [FontFaceSetLoadStatus](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.FontFaceSetLoadStatus/)

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

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/status)

## Methods[](#methods-1)

### \[iterator\][](#iterator)

-   "\[iterator\]"(): [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>[](#iterator-1)
    
    Iterates over values in the set.
    
    #### Returns [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>
    

### add[](#add)

-   add(value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)): this[](#add-1)
    
    Appends a new element with a specified value to the end of the Set.
    
    #### Parameters
    
    -   value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)
    
    #### Returns this
    

### addEventListener[](#addeventlistener)

-   addEventListener<[K](#addeventlistenerk) extends keyof [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\>(  
        type: [K](#addeventlistenerk),  
        listener: (this: FontFaceSet, ev: [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\[[K](#addeventlistenerk)\]) \=> any,  
        options?: boolean | AddEventListenerOptions,  
    ): void[](#addeventlistener-1)
    
    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](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
    
    #### Type Parameters
    
    -   K extends keyof [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)
    
    #### Parameters
    
    -   type: [K](#addeventlistenerk)
    -   listener: (this: FontFaceSet, ev: [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\[[K](#addeventlistenerk)\]) \=> any
    -   `Optional`options: boolean | AddEventListenerOptions
    
    #### Returns void
    
    Overrides EventTarget.addEventListener
    
-   addEventListener(  
        type: string,  
        listener: [EventListenerOrEventListenerObject](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.EventListenerOrEventListenerObject/),  
        options?: boolean | AddEventListenerOptions,  
    ): void[](#addeventlistener-2)
    
    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](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
    
    #### Parameters
    
    -   type: string
    -   listener: [EventListenerOrEventListenerObject](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.EventListenerOrEventListenerObject/)
    -   `Optional`options: boolean | AddEventListenerOptions
    
    #### Returns void
    
    Overrides EventTarget.addEventListener
    

### check[](#check)

-   check(font: string, text?: string): boolean[](#check-1)
    
    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](https://developer.mozilla.org/docs/Web/API/FontFaceSet/check)
    
    #### Parameters
    
    -   font: string
    -   `Optional`text: string
    
    #### Returns boolean
    

### clear[](#clear)

-   clear(): void[](#clear-1)
    
    Removes all elements from the Set.
    
    #### Returns void
    

### delete[](#delete)

-   delete(value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)): boolean[](#delete-1)
    
    Removes a specified value from the Set.
    
    #### Parameters
    
    -   value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)
    
    #### Returns boolean
    
    Returns true if an element in the Set existed and has been removed, or false if the element does not exist.
    

### dispatchEvent[](#dispatchevent)

-   dispatchEvent(event: Event): boolean[](#dispatchevent-1)
    
    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](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
    
    #### Parameters
    
    -   event: Event
    
    #### Returns boolean
    
    Inherited from EventTarget.dispatchEvent
    

### entries[](#entries)

-   entries(): [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<\[[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/), [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\]\>[](#entries-1)
    
    Returns an iterable of \[v,v\] pairs for every value `v` in the set.
    
    #### Returns [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<\[[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/), [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\]\>
    

### forEach[](#foreach)

-   forEach(  
        callbackfn: (  
            value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/),  
            key: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/),  
            parent: FontFaceSet,  
        ) \=> void,  
        thisArg?: any,  
    ): void[](#foreach-1)
    
    #### Parameters
    
    -   callbackfn: (value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/), key: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/), parent: FontFaceSet) \=> void
    -   `Optional`thisArg: any
    
    #### Returns void
    

### has[](#has)

-   has(value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)): boolean[](#has-1)
    
    #### Parameters
    
    -   value: [FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)
    
    #### Returns boolean
    
    a boolean indicating whether an element with the specified value exists in the Set or not.
    

### keys[](#keys)

-   keys(): [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>[](#keys-1)
    
    Despite its name, returns an iterable of the values in the set.
    
    #### Returns [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>
    

### load[](#load)

-   load(font: string, text?: string): Promise<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\[\]\>[](#load-1)
    
    The **`load()`** method of the FontFaceSet forces all the fonts given in parameters to be loaded.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/load)
    
    #### Parameters
    
    -   font: string
    -   `Optional`text: string
    
    #### Returns Promise<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\[\]\>
    

### removeEventListener[](#removeeventlistener)

-   removeEventListener<[K](#removeeventlistenerk) extends keyof [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\>(  
        type: [K](#removeeventlistenerk),  
        listener: (this: FontFaceSet, ev: [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\[[K](#removeeventlistenerk)\]) \=> any,  
        options?: boolean | EventListenerOptions,  
    ): void[](#removeeventlistener-1)
    
    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](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
    
    #### Type Parameters
    
    -   K extends keyof [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)
    
    #### Parameters
    
    -   type: [K](#removeeventlistenerk)
    -   listener: (this: FontFaceSet, ev: [FontFaceSetEventMap](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFaceSetEventMap/)\[[K](#removeeventlistenerk)\]) \=> any
    -   `Optional`options: boolean | EventListenerOptions
    
    #### Returns void
    
    Overrides EventTarget.removeEventListener
    
-   removeEventListener(  
        type: string,  
        listener: [EventListenerOrEventListenerObject](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.EventListenerOrEventListenerObject/),  
        options?: boolean | EventListenerOptions,  
    ): void[](#removeeventlistener-2)
    
    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](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
    
    #### Parameters
    
    -   type: string
    -   listener: [EventListenerOrEventListenerObject](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.EventListenerOrEventListenerObject/)
    -   `Optional`options: boolean | EventListenerOptions
    
    #### Returns void
    
    Overrides EventTarget.removeEventListener
    

### values[](#values)

-   values(): [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>[](#values-1)
    
    Returns an iterable of values in the set.
    
    #### Returns [SetIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SetIterator/)<[FontFace](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.FontFace/)\>
