We gave up on using fonts to create barcodes and create images using ZXing instead. You include the zxing files (core-3.1.0.jar and javase-3.1.0.jar in our case, which can be found at http://central.maven.org/maven2/com/google/zxing/core/3.1.0/ and http://central.maven.org/maven2/com/google/zxing/javase/3.1.0/) in [lucee]/tomcat/lib, then the following code will produce a barcode:
<cfset format=createObject('java','com.google.zxing.BarcodeFormat')>
<cfset writer=createObject('java','com.google.zxing.oned.Code128Writer').init()>
<cfset matrix=createObject('java','com.google.zxing.client.j2se.MatrixToImageWriter')>
<cfset output="My Barcode">
<cfset barcode=writer.encode(output,format.CODE_128,75,75)>
<cfset image=ImageNew(matrix.toBufferedImage(barcode))>
<cfoutput>#image#</cfoutput>
Put the relevant text in the ‘output’ variable and fiddle with the parameters in the ‘barcode’ variable to adjust the barcode to your needs.
Simon