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

load() 方法在 FontFaceSet forces all the fonts given in parameters to be loaded.

句法

result = aFontFaceSet.load(font);
result = aFontFaceSet.load(font, text);
					

返回

A Promise of an 数组 of FontFace loaded. The promise is fulfilled when all the fonts are loaded; it is rejected if one of the fonts failed to load.

参数

范例

// returns a promise that will be fulfilled or rejected according the success to load MyFont
// The code in 'then' can assume the availability of that font.
document.fonts.load("12px MyFont", "ß").then(…);
					

规范

规范 状态 注释
CSS Font Loading Module Level 3
在该规范中的 load 定义。
工作草案 初始定义

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
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

图例

完整支持

完整支持

兼容性未知 ?

兼容性未知

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

元数据

  • 最后修改:
  1. FontFaceSet
  2. 特性
    1. ready
  3. 方法
    1. check()
    2. load()
  4. 继承:
    1. EventTarget