Preface
Report found in Chinese garbled and Chinese fonts are not neat (overlapping) situation, the first consideration is whether the operating system has Chinese fonts, in CentOS 7 found the input command to see the font list is the prompt command is invalid:
As can be seen above, not only does not have Chinese fonts, not even the font library, then the next record in the Linux CentOS 7 how to install the font library and Chinese fonts. Install font Library
At CentOS 4.x, start installing the font library with Fontconfig, so enter the following command:
Yum-y Install Fontconfig
1
When you see the prompt in the following illustration, you are installed successfully:
The fonts and Fontconfig directories are visible in the/usr/shared directory (previously not available):
Next you can add Chinese fonts to our font library. Add Chinese fonts
In CentOS, the location of the font library is the fonts directory seen in the previous figure, so the first thing we do is to find the Chinese font file in the directory, and the Chinese font file in our Windows system can be found, open the Windows/fonts directory under C disk:
As shown above, we simply copy the fonts we need and upload them to the Linux server, where I choose XXFarEastFont-Arial and boldface (the two fonts are used in the report), and I can see two files with suffixes named TTF and TTC:
Before that we need to create a new directory, first in the/usr/shared/fonts directory to create a new directory Chinese:
Then upload the top two fonts to the/usr/shared/fonts/chinese directory:
Immediately thereafter, you need to modify the permissions for the Chinese directory:
Chmod-r 755/usr/share/fonts/chinese
1
Next you need to install Ttmkfdir to search for all the font information in the directory, and summarize the build Fonts.scale file and enter the command:
Yum-y Install Ttmkfdir
1
When you see the prompt in the following illustration, you are installed successfully:
Then execute the ttmkfdir command:
TTMKFDIR-E/usr/share/x11/fonts/encodings/encodings.dir
1
The final step is to modify the font configuration file, first through the editor to open the configuration file:
Vi/etc/fonts/fonts.conf
1
You can see a font list, which is a listing of fonts, where you add the Chinese font position we added:
Then enter: Wq save exit, and finally do not forget to refresh the memory of the font cache, so you do not have to reboot reboot:
Fc-cache
1
So all the steps are complete, and finally again through the fc-list look at the font list:
You can see that the Chinese fonts have been installed successfully, so the installation process is complete, and viewing the report again reveals that the Chinese style and content are displayed correctly. Summary
Simply record the problem of installing a font library and Chinese fonts in CentOS 7, and hope to help students with the same problem, the end. This article is transferred from https://blog.csdn.net/wlwlwlwl015/article/details/51482065