- Try setting the
pdfFontName
and isPdfEmbedded
.
Sample:
<font fontName="Arial" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
An embedded PDF flag indicates whether an external TrueType font file in the PDF file should be included.
- Another way is to use the
Font Extensions
mechanism. This method is recommended by the supplier.
Example:
You can create a font extension for a Calibri font using iReport. The result will be a jar file.
The configuration file (from the generated jar package) will be:
<?xml version="1.0" encoding="UTF-8"?> <fontFamilies> <fontFamily name="Calibri"> <normal><![CDATA[fonts/calibri.ttf]]></normal> <bold><![CDATA[fonts/calibrib.ttf]]></bold> <italic><![CDATA[fonts/calibrii.ttf]]></italic> <boldItalic><![CDATA[fonts/calibriz.ttf]]></boldItalic> <pdfEncoding><![CDATA[Identity-H]]></pdfEncoding> <pdfEmbedded><![CDATA[true]]></pdfEmbedded> <exportFonts> <export key="net.sf.jasperreports.html"><![CDATA[CalibriHtml]]></export> </exportFonts> <locales> <locale><![CDATA[en]]></locale> </locales> </fontFamily> </fontFamilies>
A snippet from the jrxml file to demonstrate the use of the new font extension:
<staticText> <reportElement x="215" y="26" width="100" height="20"/> <textElement> <font fontName="Calibri"/> </textElement> <text><![CDATA[Static text]]></text> </staticText>
You can use this link to learn more about using fonts in JasperReports.
source share