Centos Chinese garbled problem solving

Source: Internet
Author: User


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

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

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

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

The final step is to modify the font configuration file, first through the editor to open the configuration file:

Vi/etc/fonts/fonts.conf

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

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. Summarize

Simply record the problem of installing a font library and Chinese fonts in CentOS 7, hoping to help students with the same problem, the end.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.