Installing Windows Fonts on CentOS 7

On CentOS 7, attempting to list available fonts may result in an "invalid command" error, indicating that neither font management tools nor Chinese fonts are present. The following steps detail how to install necessary font libraries and Chinese fonts on CentOS 7.

Install Font Management Libray

Since CentOS 4.x, fontconfig has been used for font management. Install it using the following command:

yum -y install fontconfig

Upon successful installation, fonts and fontconfig directories will appear under /usr/share.

Add Chinese Fonts

In CentOS, the font directory is located at /usr/share/fonts. First, copy the desired Chinese font files from a Windows system's C:\Windows\Fonts directory. For example, let's use SimSun (宋体).

Before copying, create a new directory within /usr/share/fonts:

mkdir /usr/share/fonts/chinese

Upload the selected font files (e.g., simsun.ttc, simsunbd.ttc for SimSun) to the /usr/share/fonts/chinese directory.

Next, set the appropriate permissions for the new directory:

chmod -R 755 /usr/share/fonts/chinese

Now, install ttmkfdir, a utility that scans font directories and generates a fonts.scale file:

yum -y install ttmkfdir

After successful installation, execute ttmkfdir to create the fonts.scale file. The -e option points to the encodings directory:

ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir

This command generates a font list. Ensure the path to your newly added Chinese fonts is included.

Save the changes and exit the editor (e.g., using :wq in vi). Finally, refresh the system's font cache without rebooting:

fc-cache

To verify the installation, list the fonts again:

fc-list

The output should now include the successfully installled Chinese fonts, enabling proper display of Chinese characters in applications and reports.

Tags: centos Linux fonts chinese fonts fontconfig

Posted on Thu, 07 May 2026 17:02:36 +0000 by antonello