[#9661] - TextField truncated in PDF export depending on the font size

Category:
Bug report
Priority:
High
Status:
New
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

In TextMeasurerState two variables fontSizeSum and firstLineMaxFontSize are defined as int, but they are assigned float values which correspond the defined font size. This can actually be real float values like 7.5pt. But the assigned changes the values into int, so cuts off the .5 value (in my case). This changes the real linespacing and offset calculation where it is used. And as a result, lines are truncated off when you export to PDF (in my case) especially when the there are a lot off line. The more lines the more gets truncated. If the font size is an integer itself like 8pt, nothing gets truncated. I have the problem in version 6.2.1. But I looked at the code of version 6.3.1 and it looks pretty much the same. So I assume that it is still a problem. For me the problem was solved when I changed the variables to float.

Here is an example (no data adapter supplied, because it does not use one):

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.1.final using JasperReports Library version 6.2.1 -->
<!-- 2017-06-27T17:06:06 -->
<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="Kollokation" pageWidth="595" pageHeight="822" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="Kollokation" whenResourceMissingType="Error" uuid="3ae65fff-db49-4cc7-92a4-ac64c96b8fd8">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="ttt.xml"/>
<property name="com.jaspersoft.studio.unit." value="mm"/>
<style name="Base" isDefault="true" hTextAlign="Left" hImageAlign="Left" vTextAlign="Top" vImageAlign="Top" fontName="EserveArial" fontSize="10"/>
<style name="Table_TH" mode="Opaque" backcolor="#FFFFFF" hTextAlign="Left" vTextAlign="Middle" fontName="SansSerif" fontSize="9">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<paragraph leftIndent="0"/>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<parameter name="testVal" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["U DOS-1'213'914\n\nPrämie von 01.03.2007 bis 01.04.2007 (KVG), Verlustscheine vom 14.01.2008 bis 30.04.2008\nU DOS-1'213'914\n\n;Prämie von 01.03.2007 bis 01.04.2007 (KVG), Verlustscheine vom 14.01.2008 bis 30.04.2008\nU DOS-1'213'914\n\nPrämie von 01.03.2007 bis 01.04.2007 (KVG), Verlustscheine vom 14.01.2008 bis 30.04.2008\nU DOS-1'213'914\n\nPrämie von 01.03.2007 bis 01.04.2007 (KVG), Verlustscheine vom 14.01.2008 bis 30.04.2008\nU DOS-1'213'914\n\nPrämie von 01.03.2007 bis 01.04.2007 (KVG), Verlustscheine vom 14.01.2008 bis 30.04.2008\nU DOS-1'213'914\n\nPrämie von 01.03.2007 bis 01.04.2007 (KVG), Verlustscheine vom 14.01.2008 bis 30.04.2008\nU DOS-1'213'914\n\nPrämie von 01.03.2007 bis 01.04.2007 (KVG), Verlustscheine vom 14.01.2008 bis 30.04.2008\nU DOS-1'213'914\n\nPrämie von 01.03.2007 bis 01.04.2007 (KVG), Verlustscheine vom 14.01.2008 bis 30.04.2008xxxxx"]]></defaultValueExpression>
</parameter>
<queryString language="xPath">
<![CDATA[/RAPPORT]]>
</queryString>
<detail>
<band height="28" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="mm"/>
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
<reportElement key="TITRECREANCE" x="70" y="0" width="281" height="11" uuid="77d22bd4-7046-45e3-b491-91c5701c9f0a"/>
<box bottomPadding="0"/>
<textElement textAlignment="Left" markup="styled">
<font fontName="EserveArial" size="8" isBold="false"/>
<paragraph lineSpacing="Single" tabStopWidth="280">
<tabStop position="10" alignment="Left"/>
<tabStop position="165" alignment="Right"/>
<tabStop position="220" alignment="Right"/>
<tabStop position="280" alignment="Left"/>
</paragraph>
</textElement>
<textFieldExpression><![CDATA[$P{testVal}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
<reportElement key="TITRECREANCE" positionType="Float" x="70" y="17" width="281" height="11" uuid="d1c27b86-e5af-4afa-a9a7-9b474cdcb622"/>
<box bottomPadding="0"/>
<textElement textAlignment="Left" markup="styled">
<font fontName="EserveArial" size="7.5" isBold="false"/>
<paragraph lineSpacing="Single" tabStopWidth="280">
<tabStop position="10" alignment="Left"/>
<tabStop position="165" alignment="Right"/>
<tabStop position="220" alignment="Right"/>
<tabStop position="280" alignment="Left"/>
</paragraph>
</textElement>
<textFieldExpression><![CDATA[$P{testVal}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement positionType="Float" x="2" y="11" width="593" height="5" backcolor="#F2231F" uuid="e2a86754-f992-4f5c-b6a8-a6d5a4d13ac0">
<property name="com.jaspersoft.studio.unit.y" value="mm"/>
<property name="com.jaspersoft.studio.unit.height" value="mm"/>
</reportElement>
</rectangle>
</band>
</detail>
</jasperReport>

v6.2.1
schaumann.agnes's picture
Joined: May 19 2016 - 10:46am
Last seen: 3 weeks 3 days ago
Feedback