草案
此页面不完整。
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
FontFace()
构造函数创建新
FontFace
对象。
var fontFace = new FontFace(family, source, descriptors);
font-family
descriptor of
@font-face
.
系列
: Family
style
: Style
weight
: Weight
stretch
: Stretch
unicodeRange
: Unicode range
variant
: variant
featureSettings
: Feature settings
async function loadFonts() {
const font = new FontFace('myfont', 'url(myfont.woff)');
// wait for font to be loaded
await font.load();
// add font to document
document.fonts.add(font);
// enable font with CSS class
document.body.classList.add('fonts-loaded');
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Font Loading Module Level 3
The definition of 'FontFace Constructor' in that specification. |
工作草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
FontFace()
构造函数
|
Chrome 35 | Edge 79 | Firefox 41 | IE ? | Opera 22 | Safari 10 | WebView Android 37 | Chrome Android 35 | Firefox Android 41 | Opera Android 22 | Safari iOS 10 | Samsung Internet Android 4.0 |
完整支持
兼容性未知
FontFace
FontFace()