Using Custom Fonts in Lucee

If you are using a font within a PDF you are creating and it's not a standard font already installed on the server, you need to make the source fonts available to Lucee.

When using Lucee 5.2 you need to bundle the font TTF files in with a file to make a file called fonts.jar. Remember, a jar file is just a zip file renamed.

The file maps the font face to the font file. In this example I want to use the Calibri font in my PDF documents. Therefore my file looks like this:

Calibri\ Bold=Calibrib.ttf
Calibri\ Italic=Calibrii.ttf
Calibri\ Bold\ Italic=Calibriz.ttf
Calibri\ Light=calibril.ttf
Calibri\ Light\ Italic=calibrili.ttf

There have been some reports that a trailing newline needs to exist at the end of the file.

My fonts.jar contents looks like this:


The fonts.jar file needs to be placed in the WEB-INF/lib/ directory for the Lucee instance. Make sure the file has the same permissions as the existing lucee.jar file in the same location.

Finally you'll need to restart Lucee for the the fonts to be recognised.