Java Font Rendering

Are the AWT Desktop Properties of any help? In particular, "awt.font.desktophints" - these contain the AA hints that the native components use, but can be applied to any Graphics2D you want.

Just a shot in the dark, having recently read through the AA section in Filthy Rich Clients.

Use would look something like this:

String str = "A quick brown fox jumps over the lazy dog";
Toolkit tk = Toolkit.getDefaultToolkit();
Map desktopHints = (Map)(tk.getDesktopProperty("awt.font.desktophints"));
Graphics2D g2d = (Graphics2D)g;

if(desktopHints != null) {
    g2d.addRenderingHints(desktopHints);
}

g2d.drawString(str, someX, someY);

I was able to get the same results (using your example class and drawChars and drawImage, just typed drawString for simplicity) as the LCD HRGB mode using these hints and no other calls on my machine.

I'm not sure what release of Java this requires, if it's what you're looking for...


Don't forget: "Implementations are free to ignore the hints completely." For reference, here's what I see at 24 points:

AwtTestFrame, 24 points