Matt's Mind

Saturday, June 18, 2005

Swing's new text renderer

It looks like Swing (or more correctly Java2D) is getting sub-pixel anti-aliased text (aka ClearType) in Java 1.6. This addresses one of the chronic problems with Swing's native look and feel emulation - it's hard to look native when you're the only jaggedy-ass app on the desktop.

Or it would address the issue if Swing's slightly retarded font renderer didn't bravely snatch defeat from the jaws of victory.

Look at this side-by-side example. Swing'osities abound. The Sans Serif font is particularly worth mentioning: bollixed up letters include "M", "W" and "y". It looks like it gave up anti-aliasing the "2" altogether. The "#" is sloped in the original, but Swing goes for the more upright look. And the letter spacing for "FOX" is quite original. In fact looking Swing's "FOX" rendering compared to the rendering on the Mac I'm writing this on forced an involuntary guffaw.

I don't want to come across as totally mean-spirited here. It seems that Sun is getting the message. It's just that it also seems they aren't competent to address it. The well-meaning JDIC project is producing components like the taskbar icon API, which developers have already built many times over (I know, I wrote one too), but this one at least has the virtue of trying to be cross-platform (e.g. task bar icons sort of work on Mac OS X too, for a given value of "work").

However, the fact that Swing menus attached to taskbar icons cannot popup over the taskbar means they do the same crazy dancing workaround as all other Swing popup windows and can thus appear several centimeters above the icon when you click on it.

This is kind of emblematic of the Swing attitude right now: let's add anti-aliasing before we fix the basic font renderer. Let's add taskbar icons before we fix the basic popup menu support. Let's add a new look and feel skinning engine before we fix the native look and feel on the world's largest desktop platform.

There's no reason to be surprised that many developers are happy to put up with the extra deployment hassles that come with using SWT - at least these are something we have some control over.

Whereis ...

I generally use www.whereis.com.au reflexively when looking for maps online. Not sure why, given that they insist on using POST to generate map pages meaning you can't send a whereis link to anyone or bookmark it.

Looking at their URL while cursing their POST technique, I noticed they do put some info in the URL. There's a "brandId" field, which selects which brand logo appears in the page. Slightly amateurish but, even better, setting brandId to an invalid value (e.g. 4) generates a server error (what a 733t hax0r I am).

Even if I couldn't tell they're using Struts by the ".do" in the URL, the NullPointerException gives the game away. I wonder why such a big site can't afford to employ developers with some sort of clue?