如何将字体添加到 Fedora
字体
![](/data/attachment/album/201804/22/010626bzeetgdlugbrdeo5.jpg)


字体可帮助你通过设计以创意的方式表达你的想法。无论给图片加标题、编写演示文稿，还是设计问候语或广告，字体都可以将你的想法提升到更高水平。很容易仅仅为了它们的审美品质而爱上它们。幸运的是，Fedora 使安装字体变得简单。以下是如何做的。


### 全系统安装


如果你在系统范围内安装字体，那么它可以让所有用户使用。此方式的最佳方法是使用官方软件库中的 RPM 软件包。


开始前打开 Fedora Workstation 中的 “Software” 工具，或者其他使用官方仓库的工具。选择横栏中选择 “Add-ons” 类别。接着在该类别中选择 “Fonts”。你会看到类似于下面截图中的可用字体：


[![](/data/attachment/album/201804/22/010627tolldveg9pe08d3e.png)](https://fedoramagazine.org/wp-content/uploads/2017/11/Software-fonts.png)


当你选择一种字体时，会出现一些细节。根据几种情况，你可能能够预览字体的一些示例文本。点击 “Install” 按钮将其添加到你的系统。根据系统速度和网络带宽，完成此过程可能需要一些时间。


你还可以在字体细节中通过 “Remove” 按钮删除前面带有勾的已经安装的字体。


### 个人安装


如果你以兼容格式：.ttf、 otf 、.ttc、.pfa 、.pfb 或者 .pcf 下载了字体，则此方法效果更好。这些字体扩展名不应通过将它们放入系统文件夹来安装在系统范围内。这种类型的非打包字体不能自动更新。它们也可能会在稍后干扰一些软件操作。安装这些字体的最佳方法是安装在你自己的个人数据目录中。


打开 Fedora Workstation 中的 “Files” 应用或你选择的类似文件管理器应用。如果你使用 “Files”，那么可能需要使用 `Ctrl+H` 组合键来显示隐藏的文件和文件夹。查找 `.fonts` 文件夹并将其打开。如果你没有 `.fonts` 文件夹，请创建它。 （记住最前面的点并全部使用小写。）


将已下载的字体文件复制到 `.fonts` 文件夹中。此时你可以关闭文件管理器。打开一个终端并输入以下命令：



```
fc-cache

```

这将重建字体缓存，帮助 Fedora 可以找到并引用它。你可能还需要重新启动需要使用新字体的应用程序，例如 Inkscape 或 LibreOffice。你重新启动后，新的字体应该就可以使用了。




---


照片由 [Raphael Schaller](https://unsplash.com/photos/GkinCd2enIY?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) 发布在 [Unsplash](https://unsplash.com/search/photos/fonts?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) 中。




---


作者简介:


Paul W. Frields 自 1997 年以来一直是 Linux 用户和爱好者，并于 2003 年 Fedora 发布不久后加入项目。他是 Fedora 项目委员会的创始成员之一，并从事文档、网站发布、倡导、工具链开发和维护软件工作。他于 2008 年 2 月至 2010 年 7 月在红帽担任 Fedora 项目负责人，现任红帽公司工程部经理。他目前和他的妻子和两个孩子一起住在弗吉尼亚州。




---


via: <https://fedoramagazine.org/add-fonts-fedora/>


作者：[Paul W. Frields](https://fedoramagazine.org/author/pfrields/) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Fonts help you express your thoughts in creative ways through design. Whether you’re captioning an image, building a presentation, or designing a greeting or advertisement, fonts can boost your idea to the next level. It’s easy to fall in love with them just for their own aesthetic qualities. Fortunately, Fedora makes installation easy. Here’s how to do it.


## System-wide installation

If you install a font system-wide, it becomes available to all users. The best way to take advantage of this method is by using RPM packages from the official software repositories.

To get started, open the *Software* tool in your Fedora Workstation, or other tool that uses the official repositories. Choose the *Add-ons* category in the group of banners shown. Then in the add-on categories, select *Fonts.* You’ll see a list of available fonts similar to this screenshot:

When you select a font, some details appear. Depending on several conditions, you may be able to preview how the font looks with some example text. Select the *Install* button to add it to your system. It may take a few moments for the process to complete, based on your system speed and network bandwidth.

You can also remove previously installed font packages, shown with a check mark, with the *Remove* button shown in the font details.

## Personal installation

This method works better if you have a font you’ve downloaded in a compatible format: *.ttf*, *otf*, *.ttc*, *.pfa*, *.pfb* or .*pcf.* These font extensions shouldn’t be installed system-wide by dropping them into a system folder. Non-packaged fonts of this type can’t be updated automatically. They also can potentially interfere with some software operations later. The best way to install these fonts is in your own personal data directory.

Open the *Files* application in your Fedora Workstation, or a similar file manager app of your choice. If you’re using *Files*, you may need to use the *Ctrl+H* key combination to show hidden files and folders. Look for the *.fonts* folder and open it. If you don’t have a *.fonts* folder, create it. (Remember the leading dot and to use all lowercase.)

Copy the font file you’ve downloaded to your *.fonts* folder. You can close the file manager at this point. Open a terminal and type the following command:

fc-cache

This will rebuild font caches that help Fedora locate and reference the fonts it can use. You may also need to restart an application such as Inkscape or LibreOffice in which you want to use the new font. Once you restart, the new font should be available.

Photo by [Raphael Schaller](https://unsplash.com/photos/GkinCd2enIY?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/search/photos/fonts?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText).

## Daniel Aleksandersen

You can also use add custom fonts to ${XDG_DATA_HOME:-$HOME/.local/share/fonts instead of $HOME/.fonts if you prefer to keep your home directory clean.

## Dimitri

As a recent Linux full time user (Fedora KDE), I just tested this with a ttf font and it works great, thanks!

However, it would be nice to have some command-free option to refresh the font cache, or to be able to install the new font with a transparent font cache refresh. In too many cases I notice that anybody in my family (without IT knowledge) wouldn’t be able to do these things if they were using Linux, as the terminal is not an option for them.

Anyway, nice article!

## bitlord

Since you’re using KDE, you should be able to use font installer inside System Settings.

Take a look at https://userbase.kde.org/System_Settings/Font_Installer (System Settings > Fonts > Font Management) most likely outdated screenshot, but it should look similar to that one.

## Dimitri

Oh wow, I didn’t know about this. Thanks!

Glad to see that this is not one of those things necessarily requiring the command line!

I just tested this and it works perfectly 🙂

## LEMC

These were very helpful tips. To add some fonts, I have been using the method of creating the “.fonts” directory, but without running the “fc-cache” command. However, everything has been working as expected. So I wonder what exactly the fc-cache command does. Should I run it whenever I add a new font to the “.fonts” directory ?

I also would like to suggest that the FOSS serif font EB Garamond be added to the official Fedora repositories. This font is currently available at:

https://fonts.google.com/specimen/EB+Garamond

http://www.georgduffner.at/ebgaramond/

It is a classical, historically accurate Garamond font, and it is very well done. It is excellent for texts or anywhere an elegant serif font is appropriate.

## Nauris

And you may also copy your fonts to /usr/share/fonts/ for all users (and run fc-cache with root permissions)

## nicu

I prefer to install them in .fonts, this way my fonts choice will survive a system reinstall. They will survive also a system move, then you copy your home from a machine to another.

## nicu

…of, forgot to add this: most artistic fonts (if you do graphics, design, DTP) are not available as RPM packages, you have to download them as font files from sites like DaFont, another plus for .fonts

## Sasan

I’m too lazy to manually download and copy fonts, I just use what comes in the repos.

I only wish Fira Code was available.

## Andreas Jonsson

I normally just open downloaded fonts (e.g. a TTF downloaded from Google Fonts) with the Fonts application in Gnome. From there I install it by clicking the ‘Install’ button. The font is copied to $HOME/.local/share/fonts. Don’t know how this differs from the CLI method explained above?

## Joszko

My favorite font is labiryntowy-fonts

😉 it is creazy but very nice

## Joszko

@Sasan look at Inconsolata

and powerline fonts for prompt bash