Installing fontconfig with lucee

I have run into a problem with the cfchart tag and missing fonts in the Alpine linux. There are a large number of links and solutions on the web with most of them having me create a fontconfig.properties file manually in the OpenJDK lib dir and/or installing fontconfig and teh required fonts.

None of these solutions are working for me, I suspect the the fontconfig.properties file needs to be placed somewhere other than in the JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk/lib dir but I get confused with how Lucee and Commandbox setup java paths for the lucee server.

Can anyone guide me to a solution?

So far as I know, CommandBox doesn’t do anything special regarding your Java path. Is this question int he context of a Docker image? If so, which one? Can you confirm what JRE your server is actually using? Perhaps the server isn’t using what you think it is?

If this is outside of Docker, just install the packages from lines 19-23 in this file: https://github.com/Ortus-Solutions/docker-commandbox/blob/development/builds/base/Alpine.Dockerfile Those will ensure fontconfig is installed and configured properly, and should resolve your issues.

We set up our Alpine base images to ensure CFChart/CFImage/CFDocument can operate with the core fonts, because we’ve run in to the same issue.

If it’s using an Ortus Docker image, please let me know as we need to patch something, then.

Thanks,

Jon

I am using docker my image is ortussolutions/commandbox:lucee5-alpine.

Have you pulled the latest version? docker pull ortussolutions/commandbox:lucee5-alpine

Have you pulled the latest version? docker pull ortussolutions/commandbox:lucee5-alpine

Pulling the latest fixed it for me.

Thank you
Wayne

Excellent! :slight_smile:

Sorry Jon, bad news.

It did work one time but I think it was because of some other changes I had done manually to my dockerfile or docker compose.

I am now running this:
docker run -p 8080:8080 -p 8443:8443 -v D:\Docker\ChartTesting\test:/app ortussolutions/commandbox:lucee5-alpine

Where the only file in the test dir is:
index.cfm

<cfchart format="jpg" scalefrom="0" scaleto="1200000" pieslicestyle="solid" show3d=true url="../secure/time_home.cfm"> <cfchartseries type="pie" serieslabel="Working" seriescolor="blue"> <cfchartdata item="Pending" value="9"> <cfchartdata item="Blank (new)" value="1"> <cfchartdata item="Completed" value="1"> </cfchartseries> </cfchart>

Sorry Jon, bad news.

It did work one time but I think it was because of some other changes I had done manually to my dockerfile or docker compose.

I am now running this:
docker run -p 8080:8080 -p 8443:8443 -v D:\Docker\ChartTesting\test:/app ortussolutions/commandbox:lucee5-alpine

Where the only file in the test dir is:
index.cfm

<cfchart format="jpg" scalefrom="0" scaleto="1200000" pieslicestyle="solid" show3d=true url="../secure/time_home.cfm"> <cfchartseries type="pie" serieslabel="Working" seriescolor="blue"> <cfchartdata item="Pending" value="9"> <cfchartdata item="Blank (new)" value="1"> <cfchartdata item="Completed" value="1"> </cfchartseries> </cfchart>

I am getting:

Caused by: java.lang.NullPointerException ... 70 more lucee.runtime.exp.NativeException: java.lang.NullPointerException at sun.awt.FontConfiguration.getVersion(Unknown Source) at sun.awt.FontConfiguration.readFontConfigFile(Unknown Source) at sun.awt.FontConfiguration.init(Unknown Source) at sun.awt.X11FontManager.createFontConfiguration(Unknown Source) at sun.font.SunFontManager$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.font.SunFontManager.<init>(Unknown Source) at sun.awt.FcFontManager.<init>(Unknown Source) at sun.awt.X11FontManager.<init>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at sun.font.FontManagerFactory$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.font.FontManagerFactory.getInstance(Unknown Source) at sun.font.SunFontManager.getInstance(Unknown Source) at sun.font.FontDesignMetrics.getMetrics(Unknown Source) at sun.java2d.SunGraphics2D.getFontMetrics(Unknown Source) at org.lucee.extension.chart.PieSectionLegendLabelGeneratorImpl.<init>(PieSectionLegendLabelGeneratorImpl.java:45) at org.lucee.extension.chart.tag.Chart.chartPie(Chart.java:540) at org.lucee.extension.chart.tag.Chart.doEndTag(Chart.java:501) at index_cfm$cf.call(/index.cfm:16)