FontFaceSet

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

FontFaceSet interface of the CSS 字体加载 API manages the loading of font-faces and querying of their download status.It is available as document.fonts.

特性

FontFaceSet.status 只读
Indicates the font-face's loading status. It will be one of 'loading' or 'loaded' .
FontFaceSet.ready 只读
Promise which resolves once font loading and layout operations have completed.

Events

FontFaceSet.onloading
An EventListener called whenever an event of type loading is fired, indicating a font-face set has started loading.
FontFaceSet.onloadingdone
An EventListener called whenever an event of type loadingdone is fired, indicating that a font face set has finished loading.
FontFaceSet.onloadingerror
An EventListener called whenever an event of type loadingerror is fired, indicating that an error occurred whilst loading a font-face set.

方法

FontFaceSet.add()
Adds a font to the font set.
FontFaceSet.check()
A Boolean that indicates whether a font is loaded, but doesn't initiate a load when it isn't.
FontFaceSet.clear()
Removes all manually-added fonts from the font set. CSS-connected fonts are unaffected.
FontFaceSet.delete()
Removes a manually-added font from the font set. CSS-connected fonts are unaffected.
FontFaceSet.load()
返回 Promise which resolves to a list of font-faces for a requested font.

规范

规范 状态 Comment
CSS Font Loading Module Level 3
The definition of 'FontFaceSet' in that specification.
工作草案 初始定义

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
FontFaceSet
Chrome 35 Edge ≤79 Firefox 41 IE ? Opera Yes Safari 10 WebView Android 37 Chrome Android 35 Firefox Android 41 Opera Android Yes Safari iOS 10 Samsung Internet Android 4.0
add
Chrome 48 Edge ≤79 Firefox Yes IE ? Opera 35 Safari 10 WebView Android 48 Chrome Android 48 Firefox Android Yes Opera Android 35 Safari iOS Yes Samsung Internet Android 5.0
check
Chrome 35 Edge ≤79 Firefox 41 IE ? Opera ? Safari 10 WebView Android 37 Chrome Android 35 Firefox Android 41 Opera Android ? Safari iOS Yes Samsung Internet Android 4.0
clear
Chrome 48 Edge ≤79 Firefox Yes IE ? Opera 35 Safari 10 WebView Android 48 Chrome Android 48 Firefox Android Yes Opera Android 35 Safari iOS Yes Samsung Internet Android 5.0
delete
Chrome 48 Edge ≤79 Firefox Yes IE ? Opera 35 Safari 10 WebView Android 48 Chrome Android 48 Firefox Android Yes Opera Android 35 Safari iOS Yes Samsung Internet Android 5.0
load
Chrome 35 Edge ≤79 Firefox 41 IE ? Opera 35 Safari 10 WebView Android 37 Chrome Android 35 Firefox Android 41 Opera Android 35 Safari iOS Yes Samsung Internet Android 4.0
onloading
Chrome 48 Edge ≤79 Firefox Yes IE ? Opera 35 Safari 10 WebView Android 48 Chrome Android 48 Firefox Android Yes Opera Android 35 Safari iOS Yes Samsung Internet Android 5.0
onloadingdone
Chrome 48 Edge ≤79 Firefox Yes IE ? Opera 35 Safari 10 WebView Android 48 Chrome Android 48 Firefox Android Yes Opera Android 35 Safari iOS Yes Samsung Internet Android 5.0
onloadingerror
Chrome 48 Edge ≤79 Firefox Yes IE ? Opera 35 Safari 10 WebView Android 48 Chrome Android 48 Firefox Android Yes Opera Android 35 Safari iOS Yes Samsung Internet Android 5.0
ready
Chrome 35 Edge ≤79 Firefox 41 IE ? Opera 35 Safari 10 WebView Android 37 Chrome Android 35 Firefox Android 41 Opera Android 35 Safari iOS Yes Samsung Internet Android 4.0
status
Chrome 48 Edge ≤79 Firefox Yes IE ? Opera 35 Safari 10 WebView Android 48 Chrome Android 48 Firefox Android Yes Opera Android 35 Safari iOS Yes Samsung Internet Android 5.0
Available in workers
Chrome 69 Edge ≤79 Firefox ? IE ? Opera ? Safari ? WebView Android 69 Chrome Android 69 Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android 10.0

图例

完整支持
完整支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。