FontFaceSet

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.

* Some parts of this feature may have varying levels of support.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

CSS 字体加载 APIFontFaceSet 管理着字体们的加载和可查询的字体们下载状态。

Properties

FontFaceSet.status 只读

表示 font-face's 的加载状态,可能是 'loading''loaded'

Events

FontFaceSet.onloading

loading 相关事件发生时触发 EventListener,表示 font-face 集已经开始加载了。

FontFaceSet.onloadingdone

loading 相关事件发生时触发 EventListener,表示 font-face 集已经完成加载了。

FontFaceSet.onloadingerror

loading 相关事件发生时触发 EventListener,表示 font-face 集加载时产生了一个错误。

Methods

FontFaceSet.add()

向字体集添加一个字体。

FontFaceSet.check()

一个Boolean 用于表示一个字体是否加载完成,但它不回初始化你的加载。

FontFaceSet.clear()

移除字体集的所有字体。

FontFaceSet.delete()

从字体集中移除一个字体。

FontFaceSet.load()

返回解析为请求的字体的列表的 Promise

FontFaceSet.ready()

准备操作已完成且开始解析字体时返回一个 Promise

规范

Specification
CSS Font Loading Module Level 3
# FontFaceSet-interface

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
FontFaceSet
[Symbol.iterator]
FontFaceSet() constructor
DeprecatedNon-standard
add
check
clear
delete
entries
forEach
has
keys
load
loading event
loadingdone event
loadingerror event
ready
size
status
values
Available in workers

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
See implementation notes.
Has more compatibility info.