fonts
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.
Document
的 fonts
属性接口返回文档的 FontFaceSet
接口。
语法
let fontFaceSet = document.fonts;
值
返回值是文档的 FontFaceSet
接口。FontFaceSet
接口对 加载新字体、检查已加载字体的加载状态 来说非常有用。
例子
在所有字体加载完成后进行操作
js
document.fonts.ready.then(function () {
// 字体加载完成后的逻辑
});
说明
Specification |
---|
CSS Font Loading Module Level 3 # FontFaceSet-interface |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
fonts |
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.
参考资料
FontFaceSet
interfaceFontFace