# 通过 assets 存储库将自定义字体添加到我的主题

**URL:** <https://meta.discourse.org/t/add-a-custom-font-to-my-theme-via-the-assets-repository/260784>\
**Category:** Development\
**Created:** [2023 年4 月 6 日 09:11 UTC](https://meta.discourse.org/t/add-a-custom-font-to-my-theme-via-the-assets-repository/260784 "2023-04-06T09:11:54Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

作者： ![southpaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/southpaw/32/79352_2.png) [@southpaw](https://meta.discourse.org/u/southpaw)\
发布日期： [2023 年4 月 7 日 21:18 UTC](https://meta.discourse.org/t/add-a-custom-font-to-my-theme-via-the-assets-repository/260784/7 "2023-04-07T21:18:12Z")

</div>

您好 @Joart，

我在一个相当新的 Discourse 实例上尝试了一下，在我尝试的前几种字体时遇到了一些麻烦。我使用了一个免费的在线转换器将它们转换成了 .woff2 格式，但我认为它可能做得不太好。

当我尝试使用 .otf 字体，然后再尝试使用一个更可靠的转换器转换的另一个 .woff2 字体时，我能够按照 @pfaffman 和 @awesomerobot 链接的指南中的步骤添加自定义字体。

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/7/f/07fc25e8a56ae0ea5055f3f3dd9dcf48cfe0698b.png)

实际上只需要两个步骤——使用“添加上传”模态框上传文件，并将示例 SCSS 中仅有的 @font-face 和 body 行添加到主题或组件中。

我相信如果您能提供更多细节并分享您的代码和字体，我们就能帮助您解决这个问题。

---

_[View the full topic](https://meta.discourse.org/t/add-a-custom-font-to-my-theme-via-the-assets-repository/260784)._
