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
- EventTarget
- Set<FontFace>
- FontFaceSet
Index
Properties
Readonly[toStringTag]
onloading
onloadingdone
onloadingerror
Readonlyready
The ready read-only property of the FontFaceSet interface returns a Promise that resolves to the given FontFaceSet.
Readonlysize
Readonlystatus
The status read-only property of the FontFaceSet interface returns the loading state of the fonts in the set.
Methods
[iterator]
-
Iterates over values in the set.
Returns SetIterator<FontFace>
add
-
Appends a new element with a specified value to the end of the Set.
Parameters
- value: FontFace
Returns this
addEventListener
-
addEventListener<K extends keyof FontFaceSetEventMap>(
type: K,
listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends keyof FontFaceSetEventMap
Parameters
- type: K
- listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
-
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
check
-
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.Parameters
- font: string
Optionaltext: string
Returns boolean
clear
-
Removes all elements from the Set.
Returns void
delete
-
Removes a specified value from the Set.
Parameters
- value: 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
-
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().Parameters
- event: Event
Returns boolean
entries
-
Returns an iterable of [v,v] pairs for every value
vin the set.Returns SetIterator<[FontFace, FontFace]>
forEach
-
forEach(
callbackfn: (
value: FontFace,
key: FontFace,
parent: FontFaceSet,
) => void,
thisArg?: any,
): voidParameters
- callbackfn: (value: FontFace, key: FontFace, parent: FontFaceSet) => void
OptionalthisArg: any
Returns void
has
-
Parameters
- value: FontFace
Returns boolean
a boolean indicating whether an element with the specified value exists in the Set or not.
keys
-
Despite its name, returns an iterable of the values in the set.
Returns SetIterator<FontFace>
load
-
The
load()method of the FontFaceSet forces all the fonts given in parameters to be loaded.Parameters
- font: string
Optionaltext: string
Returns Promise<FontFace[]>
removeEventListener
-
removeEventListener<K extends keyof FontFaceSetEventMap>(
type: K,
listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
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.Type Parameters
- K extends keyof FontFaceSetEventMap
Parameters
- type: K
- listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
-
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
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.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
values
-
Returns an iterable of values in the set.
Returns SetIterator<FontFace>
The
FontFaceSetinterface of the CSS Font Loading API manages the loading of font-faces and querying of their download status.MDN Reference