I'm using Jaspersoft Studio 5.2, and I did a report with Courier New font, and when I exports this to PDF, it's change the font to Arial.
I'm using just the Studio tool. When I preview the report is all right, but when I export it's happens.
What can I do with my report to export with Courier New font?
My textField model that I'm using in report:
<textField pattern="dd/MM/yyyy HH:mm:ss">
<reportElement uuid="f50b279a-b480-498f-8af7-be7e23c4b80b" x="415" y="11" width="105" height="10"/>
<textElement>
<font fontName="Courier New" size="8"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
The same problem happened to me. I tried the following way to find a solution -
If you want a font to be embedded in your
Jasper Report
PDF file viewer and that font is not available in your font list, all you have to do is:Window -> Preferences -> Jaspersoft Studio -> Fonts
. You will see a box to add your .ttf file of your font.Embed this font to PDF
. After that you will see your font in the list of fonts with the name as you gave earlier.That's it. Thank You.
If your report is not being correctly rendered for any fonts, you may have some compatibility issue with iReport / JasperStudio and jasper libs in your system. I had this problem when trying to export a report to pdf using a jasper file. The solution was to compile the report inside my code like below:
You should use the Font Extensions mechanism.
Steps
Creating font in Jaspersoft Studio
You should create a new font with Window -> Preferences dialog:
With Font Family dialog you can set ttf file for your font:
Creating report's style
You should create a new style with help of context menu:
After that you can set font for this style:
And after that you can use this new style:
The sample
The jrxml file:
The report's design in Studio:
And the result will be (pdf file generated by Jaspersoft Studion and opened in Adobe Reader):
Note:
You can find more info about Font Extensions here