Install on CentOS to solve problems related to drawImage Chinese garbled characters

Source: Internet
Author: User

Install on CentOS to solve problems related to drawImage Chinese garbled characters

When you use Graphics's drawString method to add Chinese characters to an image, Windows is okay. Chinese characters are always garbled on Linux, I have read a lot about it on the Internet because the Linux system does not have a font.
Find the font from the Windows system, in the C: \ Windows \ Fonts folder
Find the desired font and ftp it to the server.

/Usr/share/fonts/

Change permission to 760
Chmod 760/usr/share/fonts/*. TTC

Go to the folder
Cd/usr/share/fonts/

Run
Mkfontscale (if mkfontscale: command not found is prompted, install # yum install mkfontscale on your own)
Mkfontdir
Fc-cache-fv (if fc-cache: command not found is prompted, install # yum install fontconfig)

View installed Fonts
Fc-list: lang = zh

At this point, the server font has been installed. I thought that after the server font is installed, the Chinese character of drawImage will not be garbled, but the test result is still a small square. It may be because the server needs to be restarted to take effect after the font is installed. It is impossible to be lucky. However, there are many users on the server, and the production environment does not dare to restart easily. You can only think of other methods.

Here we see http://blog.csdn.net/u012540337/article/details/21478965.

Try to install the font for jdk

Here it is more single. You only need to ftp the font you prefer in windows to/jre/lib/fonts /.
Restart tomcat.

By the way, the default jdk path installed by rpm is under/usr/java.

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.