# 允许用户选择字体

**URL:** https://meta.discourse.org/t/allow-users-to-choose-font/243458
**Category:** Support
**Created:** [2022年十月31日 21:45 UTC](https://meta.discourse.org/t/allow-users-to-choose-font/243458 "2022-10-31T21:45:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [2022年十月31日 21:45 UTC](https://meta.discourse.org/t/allow-users-to-choose-font/243458/1 "2022-10-31T21:45:57Z")

</div>

如何实现这一点？

这是否需要多个主题，每个主题除了字体和名称外都完全相同？

---

<div class="post-metadata">

### Author: ![michaelhenderson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaelhenderson/32/76069_2.png) [@michaelhenderson](https://meta.discourse.org/u/michaelhenderson)
#### Post date: [2022年十月31日 23:26 UTC](https://meta.discourse.org/t/allow-users-to-choose-font/243458/2 "2022-10-31T23:26:11Z")

</div>

我在论坛上搜索了一下，没有找到能帮助你实现这个目标的信息。你可能需要请求一个插件来实现该功能。你可以请求一个插件来更改 [功能类别](https://meta.discourse.org/c/feature/2) 中的字体。

---

<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年十一月1日 21:25 UTC](https://meta.discourse.org/t/allow-users-to-choose-font/243458/3 "2022-11-01T21:25:53Z")

</div>

在主题中，您可以通过添加一个保存到 [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) 的设置来实现这一点，缺点是用户必须在他们使用的每个浏览器中更改偏好设置。

您可以拥有多个主题，但如果您想提供更多更改字体以外样式的选项，这会变得很复杂。

插件会稍微复杂一些，但可能是最无缝的实现方式，因为您可以添加实际的设置，而不是依赖浏览器存储或拥有许多主题。

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [2022年十一月5日 15:47 UTC](https://meta.discourse.org/t/allow-users-to-choose-font/243458/4 "2022-11-05T15:47:34Z")

</div>

是否可以通过添加一个用户字段来修改，类似于您的 Google 字体组件，允许用户从列表中选择？

> [@Google Fonts](https://meta.discourse.org/t/google-fonts/143720?u=heliosurge):
>
> discourse2Summary Google Fonts is a simple theme component that allows you to add a font from [Google Fonts](https://fonts.google.com/) without writing any CSS.eyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/google-fonts)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-google-font-component](https://github.com/discourse/discourse-google-font-component)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Features This component allows you to set the main site font, and optionally …
