From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/document/fonts/index.html | 57 +++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 files/zh-cn/web/api/document/fonts/index.html (limited to 'files/zh-cn/web/api/document/fonts') diff --git a/files/zh-cn/web/api/document/fonts/index.html b/files/zh-cn/web/api/document/fonts/index.html new file mode 100644 index 0000000000..c6b680f6e4 --- /dev/null +++ b/files/zh-cn/web/api/document/fonts/index.html @@ -0,0 +1,57 @@ +--- +title: fonts +slug: Web/API/Document/fonts +translation_of: Web/API/Document/fonts +--- +

{{domxref("Document")}}的 fonts 属性接口返回文档的 {{domxref("FontFaceSet")}} 接口。

+ +

语法

+ +
let fontFaceSet = document.fonts;
+ +

+ +

返回值是文档的 {{domxref("FontFaceSet")}} 接口。FontFaceSet 接口对 加载新字体、检查已加载字体的加载状态 来说非常有用。

+ +

例子

+ +

在所有字体加载完成后进行操作

+ +
document.fonts.ready.then(function() {
+  // 字体加载完成后的逻辑
+});
+
+ +

说明

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('CSS3 Font Loading','#FontFaceSet-interface','FontFaceSet')}}{{Spec2('CSS3 Font Loading')}}Initial definition
+ +

浏览器兼容性

+ + + +

{{Compat("api.Document.fonts")}}

+ +

参考资料

+ + + +
{{APIRef("DOM")}}
-- cgit v1.2.3-54-g00ecf