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

Hi!

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 (http://www.infinality.net/forum/viewtopic.php?f=2&t=80#p395) 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 http://blog.andreas-haerter.com/2011/07/18/tune-improve-fedora-fonts-typeface-ubuntu-like-sharp-fonts) 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?


Regards,
Piotr Dobrogost
5 comments
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)
0
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.
0
Comment actions Permalink
There are patched versions of jdk. You can read about font rendering if java applications here:
https://wiki.archlinux.org/index.php/Java_Runtime_Environment_Fonts

I'm using ArchLinux, so installing jdk7-openjdk-infinality from AUR (https://aur.archlinux.org/packages/jdk7-openjdk-infinality/) fixed font rendering for me.

Also i used to use tuxjdk (https://code.google.com/p/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.
0
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:
INSTALL OPENJDK PATCHED WITH FONT FIXES [UBUNTU PPA] (http://www.webupd8.org/2013/06/install-openjdk-patched-with-font-fixes.html)
Infinality and OpenJDK - Patch (http://www.infinality.net/forum/viewtopic.php?f=2&t=275)
0

Please sign in to leave a comment.