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 an ArrayBuffer.

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 the font-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 the font-feature-settings descriptor.
FontFace.loaded Read only
Returns a 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 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 the font-stretch descriptor.
FontFace.style
A CSSOMString that retrieves or sets the style of the font. It is equivalent to the font-style descriptor.
FontFace.unicodeRange
A CSSOMString that retrieves or sets the range of unicode codepoints encompassing the font. It is equivalent to the unicode-range descriptor.
FontFace.variant
A CSSOMString that retrieves or sets the variant of the font. It is equivalent to the font-variant descriptor.
FontFace.weight
A CSSOMString that contains the weight of the font. It is equivalent to the font-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

SpecificationStatusComment
CSS Font Loading Module Level 3
The definition of 'FontFace' in that specification.
Working DraftInitial definition

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:68 次

字数:6625

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文