Java Swing anti-aliased font rendering

[Update 2011-04-03:  The Arch Wiki describes lots of options for the export below. I've been having good results with export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=setting']

Today I noticed fonts in my Swing-based Java apps were utterly hideous. They were no longer being rendered with anti-aliasing. I don't know if this is because today I logged into a minimal Openbox+fbpabel setup and GNOME was handling this automatically or if it's caused by some other subtle thingy.

No matter, it's pretty easy to fix. Add

export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"

to your ~/.profile file. You'll probably then have to logout and back in. After this anti-alised rendering will be the default.

Supposedly, you can do this system-wide by adding


to your /etc/environment file, but I have not tried this.

Update There is one downside to this: the JVM will write Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on to the console. It's not a deal-breaker, but it is a little annoying.


Popular posts from this blog

Ubuntu font rendering in Debian Squeeze

Fixing Qt5 themes in Xfce

Fixing Chromium remote extension loading in Debian sid