FontFace - Web APIs 编辑
Experimental
This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The 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.
Constructor
FontFace()
- Constructs and returns a new
FontFace
object, built from an external resource described by an URL or from anArrayBuffer
.
Properties
This interface doesn't inherit any property.
FontFace.display
- A
CSSOMString
that determines how a font face is displayed based on whether and when it is downloaded and ready to use. FontFace.family
- A
CSSOMString
that retrieves or sets the family of the font. It is equivalent to thefont-family
descriptor. FontFace.featureSettings
- A
CSSOMString
that retrieves or sets infrequently used font features that are not available from a font's variant properties. It is equivalent to thefont-feature-settings
descriptor. FontFace.loaded
Read only- Returns a
Promise
that resolves with the currentFontFace
object when the font specified in the object's constructor is done loading or rejects with aSyntaxError
. FontFace.status
Read only- Returns an enumerated value indicating the status of the font, one of
"unloaded"
,"loading"
,"loaded"
, or"error"
. FontFace.stretch
- A
CSSOMString
that retrieves or sets how the font stretches. It is equivalent to thefont-stretch
descriptor. FontFace.style
- A
CSSOMString
that retrieves or sets the style of the font. It is equivalent to thefont-style
descriptor. FontFace.unicodeRange
- A
CSSOMString
that retrieves or sets the range of unicode codepoints encompassing the font. It is equivalent to theunicode-range
descriptor. FontFace.variant
- A
CSSOMString
that retrieves or sets the variant of the font. It is equivalent to thefont-variant
descriptor. FontFace.weight
- A
CSSOMString
that contains the weight of the font. It is equivalent to thefont-weight
descriptor.
Methods
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.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Font Loading Module Level 3 The definition of 'FontFace' in that specification. | Working Draft | Initial definition |
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论