anti-aliasing : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (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 and 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 (Liquid Crystal Display) 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. 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 Java 1.6
In Java 1.2 Anti-aliasing Gotchas
In Java 1.3 Links
In Java 1.4

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 and W2K. You are certain to see anti-aliasing in the FontShower for Swing under XP, W2003, Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64. 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 Java version 1.2

To anti-alias fonts in AWT (Advanced Windowing Toolkit), you have to go through a gambit like this in your Canvas

There is another technique that uses an undocumented Oracle 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 (Operating System) Control Panel.

Anti-aliasing in Java version 1.3

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

Smooth Metal LAF (Look And Feel) adds anti-aliasing to various Oracle LAFs (Look And Feels).

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

Anti-aliasing in Java version 1.5

In  Java version 1.5 you don’t have to override paint methods. Since Java version 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 Java version 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 (Cathode Ray Tube), 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  Java version 1.6 there is a system property called awt.useSystemAAFontSettings you can use to control anti-aliasing. Possible values include: In Java version 1.6 or later 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

Oracle’s Javadoc on RenderingHints class : available:


This page is posted
on the web at:

http://mindprod.com/jgloss/antialiasing.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\antialiasing.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[18.97.14.91]
You are visitor number