We have Lucee 5.1 installed on a server running CentOS 6.
Our application generates sales orders as PDF that include Chinese characters.
We have no problems saving Chinese characters to the database or calling them up, and no problem displaying them on screen. The Chinese characters in the PDF are hardcoded.
We are generating the PDF by creating an HTML document and then using CFDOCUMENT to convert it to PDF
To get this to work in Coldfusion, we registered the font pack (SimSun) in the Coldfusion administrator.
We cannot get this font to register in Lucee.
Here is a simplified version of the code that is generating the 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.
The maximum upload size for this site is 3Mb and the file is 5Mb so please download it here.
You might have to modify the structure of the file to deal with your server.