Jump to content
We've recently updated our Privacy Statement, available here ×

Line Spacing Difference in Linux and Windows


guoguo2002

Recommended Posts

Hello.

I think I am having a line spacing-related problem.

 

Previously I experienced the problem that some text fields are shown in Windows but not in Linux. I have configured jre/lib/font.properties, mapping "sansserif" to Lucida Sans in both Linux and Windows.

I thought this could solve the problem. However, as I am working with it further, I found that with sansserif 10 point appears in a 12 pixel height text field on Linux server, whereas it does not in Windows. In Windows, the minimum possible field height would 13 pixel.

 

This is basically what happened and all the facts I have got. Following is a little experiment I have done try to detect the possible reason for this, and I am not sure it is correct. I just hope that more information could help anybody to help me.

 

After a little study, I am pretty sure that the font itself has identical size in both Linux and Windows. But rather it is the space under the font. As in a report, I typed in a series of lines of numbers, and found that the numbers are in same size but the space between lines is different in Linux and Windows.

 

I also have attached the .jrxml file that I used in the experiment above. I am looking forward any help, clue or any thing related to this.

Thank you in advance!! [file name=__________________.jrxml size=3172]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/__________________.jrxml[/file]

Link to comment
Share on other sites

  • Replies 17
  • Created
  • Last Reply

Top Posters In This Topic

Could you confirm whether the same physical font (ttf file) is used in both Linux and Windows? If this turns out to be so, then the only explanation is that the AWT font rendering algorithms differ from Linux to Windows. Note JasperReports does not implement such algorithms, but it merely uses the text rendering features provided by AWT.

 

For your reference, I've tried running a report with a 10 point Lucida Sans text in a 12 pixel high text element and the text didn't appear with Sun 1.6.0_03 64-bit Java on Linux (using the Lucida Sans font included in the JRE).

 

Regards,

Lucian

Link to comment
Share on other sites

Thank you very much, Lucianc.

By the way, I am sorry that I did not mension I am using Red Hat Enterprise Linux 4.5.

 

>> Could you confirm whether the same physical font (ttf file) is used in both Linux and Windows?

Yes, I think so. Because I have mapped sansserif to Lucian Sans in both OS. This physical font is shipped with JRE/JDK, so I think they are identical.

 

 

I think maybe I need to check out the text rendering algorithms. I will go to Sun and RH community to ask about this question, and post it back here is I have any replies.

 

And finally, if it is not too much trouble, can you please check it to see if it shows on RHEL?

Post edited by: guoguo2002, at: 2008/02/06 00:49

Link to comment
Share on other sites

Guoguo,

 

I have the same spacing issue. I would like to troubleshooting the cause. Could you please let me know where I can find ttf file in Jdk?

 

I am using jrocki jvm, and I only find fontconfig.bfc, alike files, not font.properties. In local dev, we are using jdk5, and prod is weblogic with Jrokie. Do you think we need to use Jrocki to compire jasper file?

 

Thanks

 

Yi

Link to comment
Share on other sites

Hi, Wangyi. Thank you for takeing care of the problem. Can you please share your findings with us as you go? That would be very beneficial to us.

 

And also, if there is any thing I can do, please tell me. I will try my best in assisting you.

 

For your questions, here are the answers.

 

I am using Sun JDK. My ttf files are located in JAVAHOMEjrelibfont with jdk1.6 update 3. fontconfig.properties is in JAVAHOMEjrelib. where JAVAHOME represents the folder of jdk installation folder.

 

Please note that different fontconfig files are loaded according to OS. The above file applies in Windows XP Professional. I will give you the property file name for RHEL4.5.

 

I will try to find jrocki jvm in the weekend.

 

And yes, I think it is better to use the same jvm to compile the .jrxml file and run the .jasper file.

 

Post edited by: guoguo2002, at: 2008/02/26 14:35

Post edited by: guoguo2002, at: 2008/02/26 23:16

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

i'm having the same problem....

 

some titles in my reports get truncated, some report return more pages in linux than in windows...and some line spaces are bigger...

 

does any one already found the reason for this to happen? and how to fix it?

 

best regards,

João Taborda

Post edited by: taborda, at: 2008/07/03 14:31

Link to comment
Share on other sites

ok, we did it ;)

 

in the end i don't really know what was the correct step to make the reports equal in windows and linux, first we installed windows true type fonts on linux (verdana, arial, times new roman..etc..) i don't remember which rpm we installed, but it was a simple google search...

 

only this didn't help, so (after installing 3 different packages of "windows fonts") we also discovered there were some fonts on our java instalation directory, probably java was using these by default, after erasing them reports were OK and looked like windows generated ones ;)

 

thanks for all the hints here in the forum :)

João Taborda

Link to comment
Share on other sites

  • 2 weeks later...

I'm having the same problem and i tried change the "net.sf.jasperreports.export.pdf.force.linebreak.policy" attribute to true, but it didn't work.

I tried change the fonts and nothing.

I can't change my linux version, because my clients won't accept it. I can change the java version.

Can anyone tell me if theres any other solution that works? Java 6 solves it?

 

thank you

Link to comment
Share on other sites

  • 1 month later...

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...