Jump to content
JasperReports Library 7.0 is now available ×

Stretch Problem With Different Fonts


charleswc

Recommended Posts

Hi,

 

I'm having stretch problem in which when I use Helvetica i got a correct (and expected) result and when I use others such Lucida Sans (I can't use this font because it isn't available in my web server that is actually in linux) I got a wrong stretched report (pdf).

 

The problem occurs in the third column which has more text to be printed.

 

I'm using jasper reports 1.2.0 and I already tried to use the most recent version of IReport and iText.

 

I attached a jrxml containing a query so then you can run it and see the problem.

 

[file name=StretchProblem.jrxml size=8786]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/StretchProblem.jrxml[/file]

 

Thanks in advance,

 

Charles

 

Ps: I put some "weird" information to preserve the original information.

Post edited by: charleswc, at: 2007/05/30 18:23

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Text layout is computed at fill time using AWT, therefore you need to set "report" fonts that match the PDF fonts (not like in <font fontName="Arial" pdfFontName="LucidaTypewriterRegular.ttf" ..>).

 

If you want to use Lucida Sans, make sure it is available in the JVM and set it as fontName as well.

 

HTH,

Lucian

Link to comment
Share on other sites

Thanks for your reply.

 

I do have Lucida Sans available in my web server but this font doesn't stretch.

 

What do I have to do to fix the stretch of the field so then the whole text can be printed.

 

Thanks advanced

 

Charles

Link to comment
Share on other sites

You need to

Make sure the font is available to Java. I don't know what you mean by "I do have Lucida Sans available in my web server".

Set as fontName in the JRXML the actual name of the font: fontName="Lucida Sans" or whatever the font name is.[/ol]

 

HTH,

Lucian

Link to comment
Share on other sites

Thanks for the reply again.

 

Sorry if I misunderstood you

 

So the font name and the pdf font name have to be the same? I'm actually having problem with pdf. Please correct me if I'm wrong.

 

Thanks again and sorry for anything.

Link to comment
Share on other sites

The font name and the PDF font name should resolve to the same font, or to fonts having the same metrics.

 

This is required as the report layout (including the amount of space needed for text stretching) is computed at fill using AWT with the font specified by fontName. Hence, the text stretch height is already computed when the PDF export happens, and if the PDF font is bigger than the font used when the height was calculated, the text might not fit in the reserved height.

 

Regards,

Lucian

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...