Problem with chinese characters in PDF

In order to add a custom font to Lucee (version 5.0/5.1), you need to create a file called fonts.jar.

The fonts.jar file is essentially a zip file containing a specific files structure as below:

fonts/
fonts/pd4fonts.properties
fonts/SimSun.ttf

It is quite important that the fonts/ directory exists in this archive file, and that the files reside within it.

The pd4fonts.properties is a file specifying the name(as used by Lucee) of the font and the file which it is associated with.

Our pd4fonts.properties file contains this one line:

SimSun=SimSun.ttf

If you need to load more fonts, you can add them all into this same jar file, listing each of the fonts on a new line within the pd4fonts.properties file.

Note: If your font name contains spaces, they need to escaped in the pd4fonts.properties file:

eg. Times\ New\ Roman.ttf

Once the jar file has been created, copy it into the Lucee lib directory, in this case it would be:

/opt/lucee/lib/

Make sure the file has the same permissions as the existing lucee-xxx.jar file in the same location.

Restart the Lucee service to load the new fonts file.

Travis Catlett
Senior Developer
Rone Webtech

3 Likes