Experimental
这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
CSS 字体加载 API 的 FontFaceSet
管理着字体们的加载和可查询的字体们下载状态。
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
。
Specifications
Specification | Status | Comment |
---|---|---|
CSS Font Loading Module Level 3 FontFaceSet |
Working Draft | Initial definition |
Browser compatibility
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 35.0 | 41 (41) | ? | ? | 10 |
clear() method | 48.0 |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | 未实现 | 35.0 | 41.0 (41) | ? | ? | ? | 10 | 35.0 |
clear() method | 未实现 | 48.0 | 48.0 |