FontFaceSet: add() method
CSS Font Loading API
CSS Font Loading API
The **`add()`** method of the FontFaceSet interface adds a new font to the set.
## Syntax
```js-nolint
add(font)
```
### Parameters
- `font`
- : A FontFace to be added to the set.
### Return value
A new FontFaceSet.
### Exceptions
- `InvalidModificationError` DOMException
- : Thrown if this font is already included via the CSS @font-face rule.
## Examples
In the following example a new FontFace object is created and then added to the FontFaceSet.
```js
const font = new FontFace("MyFont", 'url("myFont.woff2")');
document.fonts.add(font);
```
## Specifications
## Browser compatibility
source: MDN Web Docs mirror · page
Cite this
"FontFaceSet: add() method". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/add JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy