CSS Font Loading API
The add() method of the FontFaceSet interface adds a new font to the set.
Syntax
add(font)
Parameters
font- : A FontFace to be added to the set.
Return value
A new FontFaceSet.
Exceptions
InvalidModificationErrorDOMException- : 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.
const font = new FontFace("MyFont", 'url("myFont.woff2")');
document.fonts.add(font);
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
