iReports - poor font mapping
I have been building reports on my Win7 laptop - in general the font is set to 'sanserif' - the default - and also the setting used in the standard reports. All works wonderfully.
However, these same reports (mine and the standard ones) behave badly on our Win2003 server. The symptom is that some parts of the reports don't print. Investigation shows that the fields that don't print are of such size that the text will not fit in the field on the Win2003 system although it will on my Win7 laptop.
I can fix the problem by changing the font from the generic 'sanserif' to say Arial, or by running iReports on the Win2003 system, leaving the font at sanserif, but increasing the field sizes so that the text displays.
I conclude that this is some sort of font mapping problem. I have checked a) that Arial is present on the Win2003 system; b) that both systems have the same jre (7) and that the java font mapping <JAVA_HOME>\lib\fontconfig.* files are unaltered from the standard.
Note that as I am not in Hong Kong, I am using Preview to look at the pdfs. If I look at the pdf properties/fonts, in both cases the fonts are Arial.
Any ideas?
Regards, TimG
Re: iReports - poor font mapping
Take a look at http://jasperreports.sourceforge.net/sample.reference/fonts/index.html#f...
It looks like the default font used in PDFs is Helvetica. Grepping the .jrxml files in the distribution shows entries like:
<font isBold="true" pdfFontName="Helvetica-Bold"/>
<font size="10" isBold="false" pdfFontName="Helvetica"/>
So perhaps Windows 2003 doesn't have a Helvetica font and it is getting mapped to something else, or the Helvetica font is slightly wider than the Arial font, exceeding field sizes.
-Tim A
Re: iReports - poor font mapping
No - the problem is more subtle than this. It manifests itself when you run iReport on the Win2003 machine. Calling up one of the standard reports (eg customer acquisition) shows that some of the fields are blank. The title caption (which does not display) is 24 points high. You can get the title to show if you either increase the height to 26 points, or change the font to Arial. If you change it to Arial Unicode MS [which I installed as I need it for chinese characters] then it still does not display. Change to Helvitica also makes it display.
Conclusion - the problem is to do with what font SanSerif gets mapped to. One would have thought it was Arial, and indeed the registry font substitute entries are set this way (in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes ), and I tried adding SanSerif to this set with no luck.
For reasons I do not understand, SanSerif is getting mapped to Arial Unicode MS and this is slightly taller.
My solution is to stop trying to find how to fix windows and change the font in iReport from SanSerif to Arial.
Regards, Tim G