I have one goal. I want to ensure that JasperServer uses Arial when reports uses the default SansSerif.
Somehow this seems to works in our old 5.2 installation, but I can't for the life of me figure out what we did.
Moving to 6.4 and the server now default to Deja Vue which means that texts are missing the last parts because the measure is different.
I've added Arial Unicode MS to fonts as a jar (taken from the old server). I have also added it to WEB-INF/lib
I have tried to make a new one called SansSerif with a config like this <?xml version="1.0" encoding="UTF-8"?> <fontFamilies> <fontFamily name="SansSerif"> <normal><![CDATA[fonts/SansSerif/ARIALUNI.TTF]]></normal> <pdfEncoding><![CDATA[Identity-H]]></pdfEncoding> <pdfEmbedded><![CDATA[true]]></pdfEmbedded> <exportFonts/> </fontFamily> </fontFamilies>
The strange thing is that it works fine on one server v6.4 but not on a exact copy.
I then created a similar file and called it Arial and then added to jasperreports.properties
net.sf.jasperreports.default.font.name=Arial
net.sf.jasperreports.default.pdf.font.name=Arial
This apparently works for some reports in html as well as pdf, but other similar reports breaks when exported as pdf with the exception
net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font: pdfFontName: Arial pdfEncoding: Cp1252 isPdfEmbedded : false at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2323)
Could anyone remind me how this was solved in 5.2 ?
And can anyone point to a ultimate guide for fonts?
Yes, I have read https://community.jaspersoft.com/wiki/custom-font-font-extension and similar guides.
It should not be that hard, should it?
Do I need to configure java instead like https://docs.oracle.com/javase/8/docs/technotes/guides/intl/fontconfig.html
Also the documentation links to https://xmlgraphics.apache.org/fop/1.1/embedding.html
How would you do this and is it relevant for JasperServer
JASPERREPORTS® SERVER COMMUNITY PROJECT ADMINISTRATOR GUIDE RELEASE 6.4 B.1.4 Embedding Fonts in PDF Output By default, JasperReports Server can create PDF (Portable Document Format) files with many different fonts. However, if you experience font problems in the PDF output, you may need to take the steps described in this section to make the fonts available to JasperReports Server's XSL Formatting Object (XSL-FO) processor. You must have distribution rights to a font in order to embed it in a PDF file. When users save reports in PDF format, JasperReports Server generates the PDF output using Apache FOP (Formatting Objects Processor). In order for FOP to render fonts properly, you must install the font itself (for example, a TTF file) on the server host, create a font metrics file (using Apache's org.apache.fop.fonts.apps.TTFReader utility), and update the userConfig.xml file to associate the font with its metrics. For more information, refer to the Apache FOP documentation. You can embed any Unicode font using this procedure, though larger font files may have significantly larger memory footprints. To keep memory requirements small, we recommend you use the smallest font file you can, such as SimHei to support Chinese, Japanese, and Korean.
P.S. The link in the documentation is wrong pointing at "https://xmlgraphics.apache.org/fop/0.20.5/embedding.html"