|
AntiAlias not working |
Posted by Adrian on Jan-05-2010 14:37 |
|
Hi,
I'm trying the code below to force AntiAlias for the fonts. It works fine on my dev environment. Java 6, CD Version 5.0, Tomcat 6, Output is PNG image, Windows XP.
// Set x, y and labels to AntiAlias
log.error("Setting alias");
c.setAntiAlias(true, 1);
But when I try this in my Test environment, it doesnt' work. The log msg "Setting alias" appears but the fonts aren't forced to AntiAlias. The test environment uses Java 6, CD Version 5.0, Tomcat 6, Output is PNG image, Linux 2.6.27.18-24
Am I missing something? |
Re: AntiAlias not working |
Posted by Peter Kwan on Jan-06-2010 00:08 |
|
Hi Adrian,
Anti-alias only works if your Java VM supports anti-alias.
Your Java VM may not support anti-alias if:
(a) Your system does not have any font that supports anti-alias. Alternatively, your system may not have the font your code specified (eg. your code special the Arial font, but your Linux system does not have Arial installed for Java), and the Java VM automatically choose a substitute font, and the substitute font does not support anti-alias.
(b) Your Java VM does not support any font at all. For example, it is running in a headless environment, but without setting the headless flag. If the Java VM does not support fonts, ChartDirector will substitute the fonts with some built-in bitmaps as a last resort, so at least some texts are visible on the chart. The bitmaps are not anti-aliased.
The above two cases are more common on Linux, FreeBSD, Solaris and many UNIX like OS, because these OS do not have built-in fonts support. So you may need to install for your Java VM yourself. Also, these OS are commonly used in headless mode. By default, the Java VM will disable font support in headless mode.
In contrast, the above two cases will not happen in Windows or Mac OS X. It is because these two OS have built-in fonts support, so the Java VM should be able to automatically use the fonts.
For details, please refer to the Java documentation for your Java VM. (The exact details differ depending on the brand of Java you are using and the version.)
The followings are some links from older SUN documentaton for your reference:
http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html
http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless
The followings contain a test JSP that can print out the fonts supported by your Java VM, if it supports fonts at all (otherwise the code will throw exceptions):
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1124682051#N1124781705
Hope this can help.
Regards
Peter Kwan |
|