这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
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.
font
: a font specification using the
CSS value syntax
, e.g. "italic bold 16px Roboto"
text
: limit the font faces to those whose Unicode range contains at least one of the characters in text. This
does not check for individual glyph coverage
.
// 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 定义。 |
工作草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
完整支持
兼容性未知
实验。期望将来行为有所改变。
FontFaceSet
check()
load()