Swing Font Rendering Still Playing Catch-up

Three years ago I chose SWT for my accounting application partly because Swing was painfully bad at rendering text. Since then Swing has come a long way, though it’s still not as good as Microsoft or Apple.

See for yourself; below are examples of different fonts rendered on different platforms.

Times New Roman:

Times New Roman Sample

Swing clearly has room to improve. But maybe a change of font will do it good. Let’s try Courier New:

Courier New Sample

This beauty contest is more evenly balanced. Swing is still too jagged, but Gnome’s by-line is too light and Apple’s header is bleeding into the ‘paper’.

Now let’s try Verdana:

Verdana Sample

Oh dear, Gnome really fell over. And is it just me, or does Java Swing have a greenish hue? Not healthy.

So it looks like Microsoft’s ClearType is the winner, followed closely by Apple, with Gnome and Swing bringing up the rear.

Notes:

  1. More discussion of Microsoft vs Apple font rendering is here and here.
  2. The html to reproduce the tests is here. For JEditorPane, change ‘px’ to ‘pt’. The exact configuration was:
    Gnome: Firefox on Ubuntu 7.04 with font rendering set to ‘Subpixel Smoothing’
    Swing: JEditorPane on Java 1.6.0_01 (with VM property awt.useSystemAAFontSettings=lcd)
    Windows: Firefox on Windows XP SP2 with ClearType
    Apple: Safari browser on Windows XP SP2

Leave a Reply