Home  >  Article  >  Operation and Maintenance  >  How to install fonts in linux

How to install fonts in linux

WBOY
WBOYOriginal
2022-01-27 11:28:4623310browse

Method: 1. Use the "cp specify font file /usr/share/fonts/" command to copy the font file to the specified directory; 2. Use "cd /usr/share/fonts/ mkfontscale mkfontdir fc -cache" command to install the font.

How to install fonts in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to install fonts in Linux

1. Check the system fonts

Before starting the installation, we first check the fonts that have been installed in the system.

To view the fonts installed in the system, we can use the fc-list command to view. If this command does not exist in the system, we need to install the relevant software packages first.

On centos, use the following command to install:

yum install -y fontconfig mkfontscale

##On ubuntu, use the following command Install:

sudo apt-get -y install fontconfig xfonts-utils

After the installation is complete, we can use the fc-list command to view the system Installed fonts. As follows:

cat /etc/issue

fc-list

##The above picture shows the fonts installed by default on centos6.

The picture above shows the fonts installed by default on ubuntu.

If you want to view the Chinese fonts installed in the system, we can use the following command:

fc-list :lang=zh

Through the picture above, we can see that centos6 and ubuntu do not have Chinese fonts installed by default.

2. Install fonts

Through the first chapter, we know that there is no Microsoft Yahei font in the current system. We now need to upload the MSYH.TTF (Microsoft Yahei font file) file to the Linux server. As follows:

C:\Windows\Fonts All files in this directory can be packaged and uploaded, and they can still be used in the following way (tested)

在centos上和ubuntu上安装字体方法都是一样的,我们只需要进行相关的操作即可。

把MSYH.TTF复制到/usr/share/fonts/目录下,使用如下命令:

cd /root/

cp MSYH.TTF /usr/share/fonts/

然后建立字体索引信息,更新字体缓存,使用如下命令:

cd /usr/share/fonts/

mkfontscale

mkfontdir

fc-cache

至此,字体已经安装完毕。

现在我们再来查看微软雅黑字体,是否安装成功,使用如下命令:

fc-list :lang=zh

Through the above picture, We can clearly see that the Microsoft Yahei font has been successfully installed.

Related recommendations: "

Linux Video Tutorial

"

The above is the detailed content of How to install fonts in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn