title: jasper text field getting truncated
body: <p>I'm having a font issue with my jasper report where one of my more wordy text fields (the last one in a detail band) is getting cut off in the PDF and PDF Preview but not in the Internal Preview. </p>
  
  <p>e.g. </p>
  
  <p>Internal Preview:</p>
  
  <pre><code>Here is a fake description. It fits
  perfectly, fitting just in the lines.
  </code></pre>
  
  <p>PDF Preview</p>
  
  <pre><code>Here is a fake description. It 
  fits perfectly, fitting just in the
  </code></pre>
  
  <p>Jasper is (seemingly) using some algorithm to figure out how tall the field should be, my text is barely fitting, then when the PDF is generated the text wraps and disappears on the next line.</p>
  
  <p>I'm not using custom fonts (just the default/implicit "SansSerif"), and not using any custom styles beyond bold/italic. This behavior is demonstrable in both iReport's PDF Preview and my code's generated PDF on Windows and MacOS (Linux likely still has the issue, but my example text didn't exhibit the behavior on Ubuntu).</p>
  
  <p>I've played with Stretch Type, Position Type, and Stretch with Overflow, as well as moved this text field to its own band but none fixes this bug (and several of them cause others).</p>
  
  <p>I've had luck changing the font to the other built-in fonts, but this just tells me my example doesn't work for that particular font, not that I've fixed the bug.</p>
  
  <p>Any tips would be greatly appreciated.</p>
  
  <p><strong>Update 1</strong></p>
  
  <p>I tried upgrading from Jasper Reports 5.2.0 to 6.2.0 and Jasper Fonts 4.0.0 to 6.0.0... no change.</p>
  
  <p><strong>Update 2</strong></p>
  
  <p>Tried editing my <code>src/main/resources/jasperreports_extension.properties</code> and adding</p>
  
  <pre><code>net.sf.jasperreports.export.pdf.force.linebreak.policy=true
  </code></pre>
  
  <p>... no change.</p>
  
  <p>(Notably though in  my use-case I can't use <code>isStretchWithOverflow="true"</code>, so this may be why it didn't work.)</p>
  
  <p><strong>Update 3</strong></p>
  
  <p>I tried embedding the font by editing <code>src/main/resources/jasperreports_extension.xml</code> and adding:</p>
  
  <pre><code>net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
  net.sf.jasperreports.extension.simple.font.families.arialFontFamily=fonts/customFontFamilies.xml
  </code></pre>
  
  <p>customFontFamilies.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;fontFamilies&gt;
   &lt;fontFamily name="ArialEM"&gt;
     &lt;normal&gt;&lt;![CDATA[fonts/Arial/Arial.ttf]]&gt;&lt;/normal&gt;
     &lt;bold&gt;&lt;![CDATA[fonts/Arial/Arial Bold.ttf]]&gt;&lt;/bold&gt;
     &lt;italic&gt;&lt;![CDATA[fonts/Arial/Arial Italic.ttf]]&gt;&lt;/italic&gt;
     &lt;boldItalic&gt;&lt;![CDATA[fonts/Arial/Arial Bold Italic.ttf]]&gt;/boldItalic&gt;
     &lt;pdfEncoding&gt;&lt;![CDATA[Cp1252]]&gt;&lt;/pdfEncoding&gt;
     &lt;pdfEmbedded&gt;&lt;![CDATA[true]]&gt;&lt;/pdfEmbedded&gt;
   &lt;/fontFamily&gt;
  &lt;/fontFamilies&gt;
  </code></pre>
  
  <p>... no dice. (Though this did help with an issue where Firefox's PDF renderer wouldn't render bold fonts.)</p>
  
  <p><strong>Update 4</strong></p>
  
  <p>I noticed that in all the test-cases I was able to create that the first line was blank, so I changed the particular cell to be <strong>vertical-align top</strong>, which worked, but of course made that one cell misalign when there wasn't much text in it.</p>
  
  <p>Scrapped that as a solution, but may work for someone.</p>
  
  <p><strong>Update 5</strong></p>
  
  <p>At this point hopefully it's clear I've tried the "real" solutions and watched them all die a horrible death. Thus, we enter the realm of the hack solution. First I tried @wmmci's solution, but his answer changes the height of my box (due to it being dynamically calculated by <code>Dynamic Jasper</code>). I noticed that all of the examples I could create involved intra-word periods in the string, e.g. "foo...bar". That might not be your case, but it was for me. So I injected a "hair space" (<code>&amp;#8202;</code>) after intra-word spaces. </p>
  
  <p>This is obviously not a real solution, just a temporary work-around until I'm able to find more examples of the bug.</p>
  
  <p><strong>Update 6</strong></p>
  
  <p>I checked and I don't have @KarolisŠarapnickis's issue with the <code>printOrder</code>. Ah well. I shall soldier on. ;-)</p>