Note: This feature is available in Web Workers.
The add() method of the FontFaceSet interface adds a new font to the set.
add(font)fontA FontFace to be added to the set.
A new FontFaceSet.
InvalidModificationError DOMExceptionThrown if this font is already included via the CSS @font-face rule.
In the following example a new FontFace object is created and then added to the FontFaceSet.
const font = new FontFace("MyFont", 'url("myFont.woff2")');
document.fonts.add(font);