FontFaceSet: add() メソッド
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
add()
は FontFaceSet
インターフェイスのメソッドで、集合に新しいフォントを追加します。
構文
js
add(font)
引数
返値
新しい FontFaceSet
です。
例外
InvalidModificationError
DOMException
-
このフォントがすでに CSS の
@font-face
ルールによって含まれている場合に発生します。
例
次の例では、新しい FontFace
オブジェクトを作成し、FontFaceSet
に追加しています。
js
const font = new FontFace("MyFont", "url(myFont.woff2)");
document.fonts.add(font);
仕様書
Specification |
---|
CSS Font Loading Module Level 3 # dom-fontfaceset-add |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
add |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.