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

FontFace interface represents a single usable font face. It allows control of the source of the font face, being a URL to an external resource, or a buffer; it also allows control of when the font face is loaded and its current status.

构造函数

FontFace()
Constructs and returns a new FontFace object, built from an external resource described by an URL or from an ArrayBuffer .

特性

This interface doesn't inherit any property.

FontFace.display
CSSOMString that determines how a font face is displayed based on whether and when it is downloaded and ready to use.
FontFace.family
CSSOMString that retrieves or sets the 系列 of the font. It is equivalent to the font-family descriptor.
FontFace.featureSettings
CSSOMString that retrieves or sets infrequently used font features that are not available from a font's variant properties. It is equivalent to the font-feature-settings descriptor.
FontFace.loaded 只读
返回 Promise that resolves with the current FontFace object when the font specified in the object's constructor is done loading or rejects with a SyntaxError .
FontFace.status 只读
Returns an enumerated value indicating the status of the font, one of "unloaded" , "loading" , "loaded" ,或 "error" .
FontFace.stretch
CSSOMString that retrieves or sets how the font stretches . It is equivalent to the font-stretch descriptor.
FontFace.style
CSSOMString that retrieves or sets the style of the font. It is equivalent to the font-style descriptor.
FontFace.unicodeRange
CSSOMString that retrieves or sets the range of unicode codepoints encompassing the font. It is equivalent to the unicode-range descriptor.
FontFace.variant
CSSOMString that retrieves or sets the variant of the font. It is equivalent to the font-variant descriptor.
FontFace.weight
CSSOMString 包含 weight of the font. It is equivalent to the font-weight descriptor.

方法

This interface doesn't inherit any method.

FontFace.load()
Loads a font based on current object's constructor-passed requirements, including a location or source buffer, and returns a Promise that resolves with the current FontFace object.

规范

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

浏览器兼容性

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
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() 构造函数 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
display Chrome 60 Edge 79 Firefox 58 IE ? Opera 47 Safari 11 WebView Android 60 Chrome Android 60 Firefox Android No Opera Android 44 Safari iOS No Samsung Internet Android 8.0
系列 Chrome 35 Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 37 Chrome Android 35 Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 4.0
featureSettings Chrome 35 Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 37 Chrome Android 35 Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 4.0
load Chrome 45
45
不支持 35 — 45
Before Chrome 45, the returned promise resolved with void instead of a FontFace object as required by the specification.
Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 45
45
不支持 37 — 45
Before WebView 45, the returned promise resolved with void instead of a FontFace object as required by the specification.
Chrome Android 45
45
不支持 35 — 45
Before Chrome 45, the returned promise resolved with void instead of a FontFace object as required by the specification.
Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 5.0
5.0
不支持 4.0 — 5.0
Before Samsung Internet 5.0, the returned promise resolved with void instead of a FontFace object as required by the specification.
loaded Chrome 45
45
不支持 35 — 45
Before Chrome 45, the returned promise resolved with void instead of a FontFace object as required by the specification.
Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 45
45
不支持 37 — 45
Before WebView 45, the returned promise resolved with void instead of a FontFace object as required by the specification.
Chrome Android 45
45
不支持 35 — 45
Before Chrome 45, the returned promise resolved with void instead of a FontFace object as required by the specification.
Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 5.0
5.0
不支持 4.0 — 5.0
Before Samsung Internet 5.0, the returned promise resolved with void instead of a FontFace object as required by the specification.
status Chrome 35 Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 37 Chrome Android 35 Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 4.0
stretch Chrome 35 Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 37 Chrome Android 35 Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 4.0
style Chrome 35 Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 37 Chrome Android 35 Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 4.0
unicodeRange Chrome 35 Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 37 Chrome Android 35 Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 4.0
variant Chrome 35 Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 37 Chrome Android 35 Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 4.0
weight Chrome 35 Edge 79 Firefox Yes IE ? Opera Yes Safari 10 WebView Android 37 Chrome Android 35 Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android 4.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

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

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

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

见实现注意事项。

另请参阅

元数据

  • 最后修改:
  1. CSS 字体加载 API
  2. FontFace
  3. 构造函数
    1. FontFace()
  4. 特性
    1. display
    2. 系列
    3. featureSettings
    4. loaded
    5. status
    6. stretch
    7. style
    8. unicodeRange
    9. variant
    10. weight
  5. 方法
    1. load
  6. Related pages for CSS Font Loading API
    1. FontFaceSet
    2. FontFaceSetLoadEvent
    3. FontFaceSource

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1