Graph quality on Linux worse than on Windows

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
bergtwvd
Posts: 3
Joined: Mon Mar 03, 2008 12:49 pm

Graph quality on Linux worse than on Windows

Post by bergtwvd » Mon Mar 03, 2008 12:54 pm

I am developing a web based jfree application (JSP) on Windows/Tomcat and get good quality images. When I deploy the same war file on Linux/Tomcat, graphics are worse. Fonts are hardly readable and lines are sometimes not displayed. Look like an aliasing effect. Does anybody have seen this problem too? What should/can I do to resolve this?
Thanks!
Tom van den Berg

bergtwvd
Posts: 3
Joined: Mon Mar 03, 2008 12:49 pm

Re: Graph quality on Linux worse than on Windows

Post by bergtwvd » Tue Mar 04, 2008 6:13 pm

[quote="bergtwvd"]I am developing a web based jfree application (JSP) on Windows/Tomcat and get good quality images. When I deploy the same war file on Linux/Tomcat, graphics are worse. Fonts are hardly readable and lines are sometimes not displayed. Look like an aliasing effect. Does anybody have seen this problem too? What should/can I do to resolve this?
Thanks!
Tom van den Berg[/quote]


After some digging around in the forum I found a related post on "font rendering quality". I applied the suggestions posted there and it solved part of the problem.

[code]
RenderingHints rh = chart.getRenderingHints();
rh.put(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
rh.put(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
rh.put(RenderingHints.KEY_STROKE_CONTROL,RenderingHints.VALUE_STROKE_PURE);
[/code]

Lines are now displayed, but the font itself is still poorly displayed. When I run the same warfile from Tomcat/Windows results are much better. Any suggestions?

oldboys
Posts: 4
Joined: Tue Apr 08, 2008 10:03 am

Post by oldboys » Tue Apr 08, 2008 10:13 am

i had also an issue with fonts when using a custom true type font (Arial).

i tried around on the rendering hints settings, but nothing had really helped.
so i switched back to the default implementation in JFreeChart.class.

after hours of searching on google i found this link => http: //java.sun.com/products/java-media/2D/reference/faqs/index.html#Q_How_can_I_specify_the_text_ant

u have to set this JVM env variable to true and restart your application server.

Code: Select all

awt.useSystemAAFontSettings=lcd
despite this is an issue with jdk 6, it worked also for my setup. i use websphere 6.0 which has a 1.4.2 jdk.

PS: sorry for the weird link above, but i am not allowed to post links as a new registered member.

bergtwvd
Posts: 3
Joined: Mon Mar 03, 2008 12:49 pm

Text quality on Linux

Post by bergtwvd » Tue Apr 08, 2008 1:04 pm

This option surely helped!!

For best results I did:

// turn off antialiasing for graphics:
rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);

// turn on anti-aliasing for text:
rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

If I do not do VALUE_TEXT_ANTIALIAS_ON then the JVM option (awt.useSystemAAFontSettings=lcd) is not picked up appearently.

oldboys
Posts: 4
Joined: Tue Apr 08, 2008 10:03 am

Post by oldboys » Tue Apr 08, 2008 1:36 pm

well, maybe these are just the right default settings on 1.4.2 jdk and they work for my setup.

as i said, i haven't changed the rendering hints of the JFreeChart.class.

if i change the rendering hints for anti aliasing to OFF, then in my combined chart, which uses a LineAndShapeRenderer and a BarRenderer, the lines are rendered pretty ugly. so in my case i would stay with the default anti aliasing setting.

maybe in a different setup u could also try tuning the rendering hints.

nevertheless, tuning the rendering hints for font anti aliasing without setting the JVM environment property awt.useSystemAAFontSettings, didn't work for me.

Locked