I'm using Jaspersoft Studio 5.6. Below I append an example jrxml file that consists of three texts with different sizes. It displays correctly in Jaspersoft Studio in Design view. In Preview view it is also correctly displayed (using java or pdf). When I execute the report from my Java application the three texts are displayed at the same size.
I noticed that Bold and Italic works fine but if I change the font type (DejaVu, Arial, Times new roman, etc) that is also ignored. In the report generated by my application I always get the same font.
I'm generating the report this way:
//inStream is an InputStream from the .jasper file JasperRunManager.runReportToPdfStream(inStream, outStream, params, datasource);
If I generate the report this other way I get the texts with the correct sizes but the font type continues to fail:
JasperReport jasperReport = JasperCompileManager.compileReport("my/report.jrxml"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, datasource); JasperExportManager.exportReportToPdfStream(jasperPrint, outStream);
Both JSS and my java application are on the same Windows machine (so the fonts must be available to both).
The example jrxml file:
<?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version last--> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="subinforme_pag_1" pageWidth="802" pageHeight="552" orientation="Landscape" columnWidth="802" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="c6f5d08f-f28b-4c77-8523-5cf4746cdcf2"> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <queryString language="SQL"> <![CDATA[]]> </queryString> <background> <band height="40" splitType="Stretch"/> </background> <title> <band splitType="Stretch"/> </title> <pageHeader> <band splitType="Stretch"/> </pageHeader> <columnHeader> <band splitType="Stretch"/> </columnHeader> <detail> <band height="551" splitType="Stretch"> <textField> <reportElement x="0" y="80" width="180" height="40" uuid="50721cba-c082-47de-9abf-effcf1b784dd"> <property name="local_mesure_unitheight" value="pixel"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="SansSerif" size="4"/> </textElement> <textFieldExpression><![CDATA["Text Field (size 4)"]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="0" width="180" height="40" uuid="05c5129f-f29e-47a1-ad82-4547b51e3d56"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="SansSerif" size="16"/> </textElement> <textFieldExpression><![CDATA["Text Field (Size 16)"]]></textFieldExpression> </textField> <staticText> <reportElement x="0" y="40" width="180" height="40" uuid="5c69d29b-b168-408d-89aa-c6d527f0cae1"> <property name="local_mesure_unitwidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.width" value="px"/> <property name="local_mesure_unitheight" value="pixel"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> <printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="SansSerif" size="8" isBold="false"/> </textElement> <text><![CDATA[Static Text (Size 8)]]></text> </staticText> </band> </detail> <columnFooter> <band splitType="Stretch"/> </columnFooter> <pageFooter> <band splitType="Stretch"/> </pageFooter> <summary> <band splitType="Stretch"/> </summary> </jasperReport>