anti-aliasing : Java Glossary
home A words local find no local find frame, full screen Google search web for topic jump to footer translate with Babelfish 2008-02-05 by Roedy Green ©1996-2008 Canadian Mind Products
Go to : punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
anti-aliasing
A technique of making fonts look smoother on screen by using blended colours in the pixels around the edges of letters. It fools the eye into thinking that the edges are sharper than they really are.

You can get W2K/XP to anti-alias with Start ⇒ Control Panel ⇒ Display ⇒ Effects ⇒ Smooth edges of screenfonts. You can get Vista to anti-alias with Start ⇒ Control Panel ⇒ System and Maintenance ⇒ Performance Information and Tools ⇒ Adjust Visual Effects (on left) ⇒ smooth edges of screen fonts.

. You can get Vista to anti-alias with Start ⇒ Control Panel ⇒ System and Maintenance ⇒ Performance Information and Tools ⇒ Adjust Visual Effects (on left) ⇒ smooth edges of screen fonts.

With an LCD monitor, you want subpixel anti-aliasing called ClearType. To turn it on click Start ⇒ Control Panel ⇒ Appearance and Personalization ⇒ Personalization ⇒ Windows color and appearance ⇒ Open classic colour and appearance ⇒ Effects ⇒ ClearType.

Without anti-aliasing, you will see jagged diagonal lines especially in the large sizes of spidery fonts with thin diagonal lines (e.g. e.g. Bodoni, Book Antiqua, Garamond, Serif and Zapf Calligraphic) especially on the capital W. Sun, even when anti-aliasing, pays no attention to the font rendering hints. This why small font sizes are so grungy looking. Anti-aliasing is primarily to make large font sizes look better.

Appearance In JDK 1.6
In JDK 1.2 Anti-aliasing Gotchas
In JDK 1.3 Links
In JDK 1.5

What Does Anti-aliasing Look Like?

You can compare the same fonts anti-aliased and plain using the FontShower for Swing amanuensis which will display fonts in various sizes and colours with and without anti-aliasing and in the FontShower for AWT Applet in canvas mode. You are certain to see fonts without anti-aliasing in the FontShower for AWT Applet in canvas mode under W95/W98/Me/NT/W2K. You are certain to see anti-aliasing in the FontShower for Swing under XP/W2K3/Vista. The font where the differences are most obvious is DPCustomMono2.
Without anti-alias Anti-aliased
DPCustomMono2 unaliased DPCustomMono anti-aliased
The further back you stand, the more the samples look alike. Anti-aliasing is a similar sort of blurring that ironically creates the illusion of sharpness.

Several influences combine to decide whether you will get anti-aliasing:

Anti-aliasing in JDK 1.2

To anti-alias fonts in AWT, you have to go through a gambit like this in your Canvas paint method:
There is another technique that uses an undocumented Sun class.

It won’t do you any good to override the paint method of a peered Component such as Label, TextField or TextArea since the rendering is handled by the peer. Whether they are anti-aliased is determined by the OS Control Panel.

Anti-aliasing in JDK 1.3

Anti-aliasing in Swing is similar to AWT, except that you override paintComponent instead of paint.

Smooth Metal LAF adds anti-aliasing to various Sun LAFs.

WrapLF is a LAF that lets you insert your own code.

Anti-aliasing in JDK 1.5

In JDK 1.5 you don’t have to override paint methods.
Since JDK 1.5, it is possible to set the system property globally with swing.aatext=true. You can do that with java.exe -Dswing.aatext=true on the command line. Unfortunately the results are not always desirable. Sometimes small fonts look worse anti-aliased.

Anti-aliasing in JDK 1.6

The Java 1.6, has yet another anti-aliasing scheme, one that allows sub-pixel anti-aliasing that takes advantage of the geometry of the tiny red, green and blue phosphor dots on a CRT, or the equivalent dots on an LCD panel, that make up each pixel. Microsoft uses a scheme like this in Vista they call ClearType. In JDK 1.6 there is a system property called awt.useSystemAAFontSettings you can use to control anti-aliasing. Possible values include: In JDK 1.6+ there are also new values to use in setRenderingHints key and value, including VALUE_ANTIALIAS_OFF to turn anti-aliasing off.

Anti-aliasing Gotchas

Learning More

Sun’s Javadoc on the RenderingHints class : available:
Sun’s JDK Technote Guide on anti-aliasing : available:
ClearType
fonts
FontShower for AWT: display fonts in various sizes and colours without and without anti-aliasing
FontShower for Swing: display fonts in various sizes and colours without and without anti-aliasing

CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.17] The information on this page is for non-military use only.
You are visitor number 15,472. Military use includes use by defence contractors.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/jgloss/antialiasing.html J:\mindprod\jgloss\antialiasing.html