# 如何实现Google字体资源的懒加载？

**URL:** <https://meta.discourse.org/t/how-to-make-load-of-google-font-be-lazy/240808>\
**Category:** Support\
**Created:** [2022年十月3日 22:03 UTC](https://meta.discourse.org/t/how-to-make-load-of-google-font-be-lazy/240808 "2022-10-03T22:03:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)\
**Post date:** [2022年十月3日 22:03 UTC](https://meta.discourse.org/t/how-to-make-load-of-google-font-be-lazy/240808/1 "2022-10-03T22:03:54Z")

</div>

我们有一个愚蠢的政府，每当发生什么事情时就会屏蔽谷歌服务 🤦‍♂️ 。  
今天我意识到我的论坛加载速度非常慢（空白页面大约需要 10 秒或更长时间）。然后我意识到请求中有一个对 Google Fonts 的请求，而且它不是延迟加载的。所以它会等待直到超时，然后论坛才会加载。

我们如何才能让这个请求延迟加载？

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/0/8/5082c6a46c1187e2a1c6c1f815db4660bee3c0be.png)

---

<div class="post-metadata">

**Author:** ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)\
**Post date:** [2022年十月3日 22:49 UTC](https://meta.discourse.org/t/how-to-make-load-of-google-font-be-lazy/240808/2 "2022-10-03T22:49:07Z")

</div>

您能否尝试使用核心网站设置字体？我相信那个根本不使用 Google Fonts，因此请求将是本地的，因此对您来说应该快得多。

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/a/c/aac3079907aba20fc207562dcf685f86b8cbde97.png)

---

<div class="post-metadata">

**Author:** ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)\
**Post date:** [2022年十月4日 05:40 UTC](https://meta.discourse.org/t/how-to-make-load-of-google-font-be-lazy/240808/3 "2022-10-04T05:40:50Z")

</div>

> [@pmusaraj](#):
>
> 您能尝试使用核心网站设置来设置字体吗？

已经在使用核心网站设置了。

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/8/3/48374a28642d5b2a1b2b0ff5791322a72b1ffe78.png)

---

<div class="post-metadata">

**Author:** ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)\
**Post date:** [2022年十月4日 21:02 UTC](https://meta.discourse.org/t/how-to-make-load-of-google-font-be-lazy/240808/4 "2022-10-04T21:02:25Z")

</div>

看起来导致问题的字体是 Roboto，而您的网站设置已配置为使用 Arial……因此，该字体很可能来自某个主题。

您可以移除主题中调用 Google 服务器的链接，并在网站设置中切换为使用 Roboto。您也可以下载 Roboto 并将其作为主题资源包含进来。我们有一个关于创建带有本地服务器字体的自定义主题组件的指南：[Create and share a font theme component](https://meta.discourse.org/t/create-and-share-a-font-theme-component/62462)

您也可以尝试将 `font-display: swap;` 添加到您的 `@font-face` 规则中：[`font-display` for the Masses | CSS-Tricks](https://css-tricks.com/font-display-masses/)
