How to fix font rendering in Swing in Java based application in Linux (Fedora/KDE)?


Font rendering in PyCharm on my Fedora 21 with KDE is very bad. I use (default?) DejaVu Sans Mono but all others available in the dropdown in settings (DialogInput, FreeMono, Liberation Mono, Monospaced, Nimbus Mono L, Source Code Pro) do not look any better.

I've been googling for an answer how to fix font rendering in Java applications using Swing for GUI (which PyCharm does) but could not find anything that helps. For example putting '-Dawt.useSystemAAFontSettings=lcd' in 'pycharm64.vmoptions' didn't help.

From what I've read Swing as opposed to SWT (which Eclipse uses) renders fonts itself and does not use system's native font rendering. Font rendering is a rather complicated matter ( and I didn't manage to find my way through this. The additional trouble is that there's Oracle JDK and OpenJDK and each has its own quirks. I (naturally:)) prefer OpenJDK and that's what I use.

I have to note that after I installed Fedora/KDE, font rendering was ugly but after setting Xft.lcdfilter to 'lcddefault' in ~/.Xresources (see it's much better. However as Swing does not use system's native font rendering as said above this should not matter.

Considering how much bad font rendering puts user off I guess there must be some guide how to fix this in JetBrains' products. Is there any?

Piotr Dobrogost
Comment actions Permalink
Funny, I am also "evaluating" pycharm at the moment. There are many cool features, so that I could switch from eclipse with pydev. But it is also the fonts, that turn me away. It is no fun looking at it.

So what could be the solution?

(Ubuntu 14.10 with GNome)
Comment actions Permalink
I'm having problems getting the Netbeans font to look nice, this has been a problem ever since I tried Ubuntu ~8. For some reason fonts look like they're not getting subpixel smoothing in Netbeans only, for the rest of the applications they look perfect.
Comment actions Permalink
There are patched versions of jdk. You can read about font rendering if java applications here:

I'm using ArchLinux, so installing jdk7-openjdk-infinality from AUR ( fixed font rendering for me.

Also i used to use tuxjdk (, but jdk7-openjdk-infinality from AUR works better for me.

Arch's PKGBUILD is very simple, so i hope you can build patched version of jdk in Ferora easily.
Comment actions Permalink
Thanks for your answer. I've already read the links you posted before I asked here. As to patched Open JDK, they patched Open JDK 7 whereas I use Open JDK 8. Couldn't find information whether or not the patch was merged upstream in Open JDK 8 and I do not feel like able to patch and compile this myself.
The same problem is with Netbeans so there are many users affected thus I would be surprised if there weren't any "simple/ready" solution available for main Linux distros (like Fedora :))...

For those interested some more links:
Infinality and OpenJDK - Patch (

Please sign in to leave a comment.