I'm using IntelliJ IDEA on Arch Linux with KDE. OpenJDK version is 1.7.0_40.
Whole IDE fonts (includes code editor) are rendered without any antialiasing and font smoothing. I set in idea.properties
file idea.use.default.antialiasing.in.editor
to true
, and added in _JAVA_OPTIONS
variable -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
without any effect.
What else I can try to enable font smoothing?
In
/usr/share/intellijidea-ce/bin/idea.sh:
edit this line:and make it like this:
None of this ugly stuff is needed anymore. Download the latest IntelliJ (2016.1 onwards) for Linux. It includes a modified JRE with the fonts issue fixed.
To fix Android Studio too make a symbolic link to the IntelliJ jre:Alternatively, just open your file manager as root (assuming your IDEs are installed in the /opt directory or another system folder) and create a shortcut to IntelliJ's jre and move it to Android Studio installation folder, then rename it to 'jre'. This works for the latest android studio 2.0 but it should work with earlier versions too.
Android Studio now comes with the modified JRE so the symbolic link is not needed anymore, just download the latest version.
This applies to IntelliJ IDEA 2018
The best solution is to download the version with the included Java Runtime. This version runs on a custom JRE that is patched to better handle fonts on Linux.
IntelliJ IDEA offers 2 versions for the Linux OS, one version has an embedded JRE (This is the default download), while the other version doesn't have one and depends on the user's own Java installation.
If you don't want to re-install IntelliJ, there is another solution:
-Djava2d.font.loadFontConf=false
to both idea.vmoptions and idea64.vmoptions files located under intellij_installation_folder/bin/N.B. The result of the first solution was a bit more nice looking when I tried them.
As far as my testing goes, the @Corneliu Dascălu solution mentioned here no longer work on IntelliJ 2018.
I've found another solution here. It works for the Oracle JDK, but it may be helpful for people stumbling on this question. You have to edit the
.vmoptions
file (in my case it'sidea64.vmoptions
from/bin
). Add these three lines:If you encounter issues, you can remove the last line. You can test different versions for the first setting (get the options from the post above).
In addition, you can edit the font you're using and clear hinting (the post's author suggests using FontForge). I have not found this to be necessary.
As mentioned, this is a bug in the JDK. The good news is that there's a patch for OpenJDK that greatly improves font rendering for IntelliJ on Linux, and brings the font quality up to par with what I've seen on my Mac.
(To be clear, this is significantly better than what can be obtained by tweaking
idea.properties
.)To install it, use the packages below:
Ubuntu PPA https://launchpad.net/~no1wantdthisname/+archive/openjdk-fontfix
Arch AUR: https://aur.archlinux.org/packages/jre7-openjdk-headless-fontfix/
(I run Ubuntu/Elementary OS, so I can't vouch for this one personally)
It won't work with OpenJDK, even with whatever
_JAVA_OPTIONS
you choose, so remove it withsudo pacman -Rndd jdk7-openjdk jre7-openjdk jre7-openjdk-headless java-rhino
and install the Oracle JDK 8 from Aur. After the installation you have to logout/login to update your java environment variables (f.e.JAVA_HOME
). Voila, the font rendering is fine.Enjoy!
PS:
pacman -Rndd
removes without dependencies but with the config files, expanded:pacman --remove --nosave --nodeps --nodeps
.