How to Quickly Install Multiple Fonts in Linux

1. Overview

In this tutorial, we’ll learn how we can install fonts on a Linux machine. First, we’ll discuss how to install fonts for single and multiple users using the command-line. Then, we’ll tackle the Font Manager GUI utility that can assist in installing fonts on any Linux machine.

Finally, we’ll see how to install Google Fonts using Font Manager.

2. Manual Installation

On Linux, it’s much easier to install fonts manually by copying the respective font files into the fonts directory. Usually, most users prefer the TrueType fonts, but we can also install the OpenType font families.

2.1. Installing Fonts for Single User

For single users, we can copy the fonts to the ~/.fonts directory. However, we can also put the fonts into the ~/.local/share/fonts directory:

$ mkdir -p ~/.local/share/fontsCopy

Then, we can copy or move our fonts there:

$ cp ~/Downloads/{*.ttf,*.otf} ~/.local/share/fontsCopy

Additionally, if a font family contains a lot of fonts, the fonts directory can get quite messy. So, it’s usually a good practice to collect the related fonts into a directory and then copy the directory to the fonts directory.

Once our fonts are copied, we should rebuild the font cache using the fc-cache command so the fonts will be available for immediate use:

$ fc-cache -f -v
Font directories:
	/home/hey/.local/share/fonts
	/usr/local/share/fonts
	/usr/share/fonts
	/home/hey/.fonts
...
/home/hey/.local/share/fonts: caching, new cache contents: 5 fonts, 0 dirs
/usr/local/share/fonts: skipping, no such directory
...
fc-cache succeeded.Copy

Let’s understand the command:

  • -f forces fc-cache to scan up-to-date font files as well—overriding the timestamp checking
  • -v is used for verbose output

At this point, we can use the fonts without having to log out and log back in. However, some applications might not take effect without restarting.

2.2. Installing Fonts for Multiple Users

Installing fonts for multiple users follows the same method. However, we’ll need to put the fonts into the /usr/share/fonts directory:

$ sudo cp ~/Downloads/*.ttf /usr/share/fonts/TTFCopy

It’s a good practice to put the TrueType fonts inside the TTF directory and OpenType fonts inside the OTF directory.

As usual, let’s update the system-wide font cache using the -s option:

$ fc-cache -f -sCopy

2.3. Removing Fonts

We can remove the fonts by deleting the respective files in the fonts directory:

$ rm -f ~/.local/share/fonts/TTF/Fira-CodeCopy

Similarly, don’t forget to update the font cache after:

$ fc-cache -f -vCopy

3. Alternative: Font Manager

Font Manager is a GUI-based utility that helps in managing, analyzing, and viewing fonts without having to use the command-line.

3.1. Installation

On Ubuntu and other GNOME-based distributions, this utility should be installed out of the box. However, we can also install it from our distribution package repository under the canonical name font-manager.

On Ubuntu-based distros, we can use apt:

$ sudo apt install -y font-managerCopy

On RHEL and Fedora-based distros, we can use yum:

$ sudo yum install -y font-managerCopy

3.2. Installing Multiple Fonts

Once Font Manager is installed, we can use it to install a bunch of fonts at the same time. On launch, we’ll be presented with the main view:

Font Manager

Now, we can press the “+” button on the top left to install new fonts:

Font Manager: Adding new fonts

Afterward, we can select multiple fonts to install:

Font Manager: Fonts selection

Finally, we can click “Open” to install the selected fonts.

3.3. Removing Multiple Fonts

Similarly, we can remove multiple fonts by selecting the “” button on the top left corner:

Font Manager: Removing fonts

Then, we can select the desired fonts to remove:

Font Manager: Selecting fonts for removal

Finally, we can press the “Delete” button on the bottom to delete the selected fonts.

4. Extra: Installing Multiple Google Fonts

Google has one of the popular web font repositories that contains free fonts that we can use for both personal and commercial use.

However, it’s tedious to individually download, extract, and then manually install these fonts. Therefore, we can make this process quicker by using the Google Fonts feature of Font Manager.

In the main view of Font Manager, we can select the “G” button to list the available Google Fonts:

Font Manager: Google Fonts

Then, we can select a font and click the “Downloading Family” button:

Font Manager: Downloading Google fonts

As we can see, it’s much easier to download and install Google Fonts without having to open up a browser and go through the process manually.

5. Conclusion

In this article, we discussed how we can install multiple fonts on a Linux machine. First, we learned the manual approach by copying the font files to the fonts directory. Then, we saw how we could achieve the same result using the handy GUI utility Font Manager.

Finally, we saw how we can easily install Google Fonts using Font Manager.

<think>我们正在处理用户关于如何在Ubuntu系统中更改字体的询问。根据提供的引用,虽然引用[1]和[2]是关于更改主机名的,引用[3]是关于AWS的,这些并不直接相关,但我们可以根据Ubuntu系统的一般配置知识来回答。 在Ubuntu中更改系统字体通常涉及修改系统设置或使用特定的配置工具。对于不同版本的Ubuntu(如使用GNOME桌面环境的版本),方法可能有所不同。以下是一般步骤: 1. 使用图形界面(适用于桌面版): - 打开“设置”(Settings)。 - 进入“外观”(Appearance)或“字体”(Fonts)选项。 - 在这里,你可以更改系统字体、文档字体、等宽字体等。 2. 使用命令行(适用于所有版本,但需要安装额外的工具): - 安装`gnome-tweaks`工具(对于使用GNOME的Ubuntu): ```bash sudo apt install gnome-tweaks ``` - 然后打开“优化”(Tweaks)工具,在“字体”选项中调整。 3. 通过修改配置文件(高级用户): - 编辑`~/.config/fontconfig/fonts.conf`文件(如果不存在则创建)。 - 使用XML配置来指定默认字体。 但是,请注意,用户的具体需求可能包括更换整个系统的默认字体,或者只是更换某些应用程序的字体。因此,我们需要提供灵活的方法。 由于引用中没有直接关于更改字体的信息,我们将基于通用知识提供指导。 下面我们将详细说明使用图形界面和命令行两种方法。 ### 使用图形界面更改字体(以Ubuntu 20.04 GNOME为例) 1. 打开“设置”(可以通过点击屏幕左下角的“活动”然后输入“设置”来找到)。 2. 在左侧边栏选择“外观”(Appearance)。 3. 在“字体”部分,你会看到几个选项:界面字体、文档字体、等宽字体、窗口标题字体等。 4. 点击每个选项旁边的当前字体名称,会弹出一个字体选择对话框,你可以选择新的字体和大小。 5. 更改后,系统会立即应用新的字体设置,无需重启。 ### 使用命令行工具(gnome-tweaks) 如果你更喜欢命令行或者你的Ubuntu版本没有提供图形设置中的字体选项(比如服务器版),你可以安装`gnome-tweaks`工具: ```bash sudo apt update sudo apt install gnome-tweaks ``` 安装完成后,在终端输入`gnome-tweaks`启动该工具,或者通过图形界面搜索“优化”来打开。在“字体”选项卡中,你可以设置各种字体。 ### 高级配置:使用Fontconfig 如果你想更精细地控制字体,比如为特定的字体族设置替代字体,你可以创建或修改Fontconfig配置文件。Fontconfig是Linux系统用来管理字体的库。 1. 创建或编辑配置文件:`~/.config/fontconfig/fonts.conf` 2. 示例内容(将默认无衬线字体设置为Noto Sans CJK SC): ```xml <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <match target="pattern"> <test qual="any" name="family"> <string>sans-serif</string> </test> <edit name="family" mode="prepend" binding="same"> <string>Noto Sans CJK SC</string> </edit> </match> </fontconfig> ``` 3. 保存文件后,运行`fc-cache -fv`更新字体缓存。 4. 你可能需要注销并重新登录才能看到变化。 注意:这种方法需要你知道字体的确切名称,并且字体已经安装在系统中。你可以通过`fc-list`命令查看已安装的字体。 ### 安装新字体 如果你想要使用系统中没有的字体,你需要先安装它。通常,将字体文件(如.ttf或.otf)复制到`~/.fonts/`目录(如果不存在则创建)或者`/usr/share/fonts/`(需要管理员权限)。然后运行`fc-cache -fv`更新字体缓存。 ### 注意事项 - 更改系统字体可能会影响所有应用程序,但有些应用程序(如LibreOffice)有自己的字体设置。 - 如果更改后出现字体显示问题,可以尝试恢复默认设置或删除自定义配置文件。 §§相关问题§§ 1. 如何在Ubuntu中安装新字体? 2. 如何恢复Ubuntu的默认字体设置? 3. 在Ubuntu中更改字体后,为什么某些应用程序的字体没有改变?</think>### 如何在 Ubuntu 系统中更改系统字体 在 Ubuntu 中更改系统字体可通过以下三种方法实现,适用于不同桌面环境(如 GNOME、KDE 等): #### 方法一:图形界面设置(推荐) 1. **打开系统设置** 点击屏幕左上角「活动」→ 搜索并打开「设置」→ 选择「外观」。 2. **修改字体** 在「字体」选项卡中调整以下选项: - **界面字体**:系统菜单和标题栏字体 - **文档字体**:普通文本显示字体 - **等宽字体**:终端和代码编辑器字体 - **窗口标题字体**:窗口顶部标题栏字体 3. **即时生效** 修改后无需重启,系统会自动应用新字体[^1]。 #### 方法二:终端命令修改(适用于所有版本) ```bash # 安装 GNOME 优化工具(如未安装) sudo apt install gnome-tweaks # 打开字体设置界面 gnome-tweaks ``` 在弹出窗口中选择「字体」→ 调整各字体类型 → 关闭窗口即生效[^2]。 #### 方法三:手动修改配置文件(高级用户) 1. 创建或编辑字体配置文件: ```bash nano ~/.config/fontconfig/fonts.conf ``` 2. 添加以下内容(示例设置为使用 Noto 字体): ```xml <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <!-- 设置默认无衬线字体 --> <match target="pattern"> <test qual="any" name="family"> <string>sans-serif</string> </test> <edit name="family" mode="prepend"> <string>Noto Sans</string> </edit> </match> <!-- 设置等宽字体 --> <match target="pattern"> <test qual="any" name="family"> <string>monospace</string> </test> <edit name="family" mode="prepend"> <string>Noto Mono</string> </edit> </match> </fontconfig> ``` 3. 刷新字体缓存: ```bash fc-cache -fv ``` 4. 注销后重新登录生效[^2]。 #### 安装新字体 1. 下载 `.ttf` 或 `.otf` 字体文件 2. 将字体复制到系统目录: ```bash # 当前用户可用 mkdir -p ~/.local/share/fonts cp 新字体.ttf ~/.local/share/fonts/ # 或全系统可用(需管理员权限) sudo cp 新字体.ttf /usr/share/fonts/ ``` 3. 更新字体缓存: ```bash fc-cache -fv ``` > **注意**: > - 修改后某些应用需重启生效(如终端、文本编辑器) > - 如果字体显示异常,删除 `~/.config/fontconfig/fonts.conf` 可恢复默认设置 > - 推荐使用开源字体(如 [Google Fonts](https://fonts.google.com/) 提供的字体) --- ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值