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.