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
Graph quality on Linux worse than on Windows
Re: Graph quality on Linux worse than on Windows
[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?
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?
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.
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.
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
PS: sorry for the weird link above, but i am not allowed to post links as a new registered member.
Text quality on Linux
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.
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.
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.
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.