liunx picture text watermark garbled problem

During the development process, there were too many QR codes generated. It is necessary to add a watermark at the bottom of the QR code to facilitate differentiation, and the specific generation logic can be searched online.

However, during the development process, the watermark can be printed locally. However, when it is placed on the server, garbled characters appear. At first, I thought it was a character set problem. Later, the Internet search is not the case, and the solution is now provided:

 

1. Open your local directory "C:\WINDOWS\Fonts"

 

 

2. Copy the red part of the picture, that is, simsun.ttc, to the server (the directory I created is mkdir /usr/share/fonts/win), /usr/share/fonts/win directory

 

3. Execute the command:

# cd /usr/share/fonts/win
# mkfontscale
#mkfontdir
# fc-cache

 (If it prompts mkfontscale: command not found, you need to install it by yourself # yum install mkfontscale )

(If it prompts fc-cache: command not found, you need to install # yum install fontconfig )

 

4. Copy simsun.ttc to the jdk directory, such as my local

cp /usr/share/fonts/win/simsun.ttc /usr/java/jdk1.7.0_55/jre/lib/fonts

 

5. Restart tomcat

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326653955&siteId=291194637