FontFace
        
        
          
                Baseline
                
                  Widely available
                
                 *
              
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年1月.
* Some parts of this feature may have varying levels of support.
FontFace 接口表示一个可用的字体。它允许你控制字体的源文件,作为外部资源的 URL 或缓冲区; 它还允许你控制字体的加载时间和字体当前的状态。
Constructor
- FontFace()
- 
使用 URL 指向的外部资源或 ArrayBuffer构造并返回一个新的FontFace对象。
Properties
这个接口不继承任何属性。
- FontFace.family
- FontFace.style
- FontFace.weight
- FontFace.stretch
- FontFace.unicodeRange
- 
这是不是一个 DOMString?是的话将表示该字体涵盖的 range of code(字符编码的范围),相当于unicode-range。
- FontFace.variant
- FontFace.featureSettings
- 
这是不是一个 DOMString?是的话将表示该字体的 features 属性,相当于feature-settings。
- FontFace.status只读
- 
返回一个表示字体当前状态的可枚举值,它可能是下列之一: "unloaded"、"loading"、"loaded"、"error"。
- FontFace.loaded只读
- 
当字体完全加载或加载失败时返回该 FontFace的Promise。
方法
这个接口不继承任何方法。
- FontFace.load()
- 
加载该字体,返回该字体完全加载或加载失败时的 Promise。
规范
| Specification | 
|---|
| CSS Font Loading Module Level 3> # fontface-interface> | 
浏览器兼容性
Loading…