Linux CentOS 7 Installation Font Library & Chinese fonts

Source: Internet
Author: User

Recently, with CentOS, HTML was generated using PHANTOMJS to generate PDFs, but it was generated several times, but the content was always empty.

Find it and find out what fonts are supported on the system.

After you run the following command:

Yum Install cabextract xorg-x11-font-utils-y

If it is an English character, it can be generated, but Chinese is not.

Finally, refer to the following article finally fix.

Original address: http://blog.csdn.net/wlwlwlwl015/article/details/51482065

Objective

Report found in Chinese garbled and Chinese fonts are not neat (overlapping), the first consideration is whether the operating system has a Chinese font, in CentOS 7 found the input command to see the font list is the prompt command is invalid:

As you can see, not only there is no Chinese font, not even the font library, then the next record how to install the font library and Chinese fonts in Linux CentOS 7.

Installing the Font Library

Start installing the Font library with Fontconfig in CentOS 4.x, so enter the following command:

install fontconfig

When you see the prompt, it indicates that the installation was successful:

At this point in the/usr/shared directory you can see the fonts and Fontconfig directories (not previously):

Next, you can add Chinese fonts to our font library.

Add Chinese font

In CentOS, the location of the font library is exactly what you see in the Fonts directory, so the first thing we have to do is to find the Chinese font file in the directory, and the Chinese font file can be found in our Windows system, open the Windows/fonts directory under the C drive:

For example, we just have to copy and upload the fonts we need to the Linux server, where I choose Arial and boldface (both fonts are used in the report) and you can see two files with the suffix TTF and TTC:
We also need to create a new directory before this, and first create a new directory under the/usr/shared/fonts directory Chinese:

Then you can upload the above two fonts to the/usr/shared/fonts/chinese directory:

The permissions for the Chinese directory need to be modified immediately:

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

Next you need to install Ttmkfdir to search all the font information in the directory, and summarize the generated Fonts.scale file, enter the command:

install ttmkfdir

When you see the prompt, it indicates that the installation was successful:

You can then execute the ttmkfdir command:

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

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

vi /etc/fonts/fonts.conf

You can see a list of fonts, which is the font listing, where we need to add the Chinese font location:

Then enter: Wq save exit, and finally do not forget to refresh the in-memory font cache, so that you do not have to restart the reboot:

fc-cache

So all of the steps are done, and finally look at the font list again by fc-list:

You can see that the Chinese fonts have been successfully installed, so that the installation process is complete, and again to see the report can be found in Chinese style and content can be displayed properly.

Summarize

Simply record the issue of installing font libraries and Chinese fonts in CentOS 7, hoping to help classmates with the same problems, the End.

Linux CentOS 7 Installation Font Library & Chinese fonts

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.