Intellij IDEA font smoothing in linux
Asked Answered
M

8

29

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?

Million answered 27/6, 2013 at 15:13 Comment(0)
B
25

Take a look here. I remember having the same problem when running IDEA, but after adding the line mentioned in the wiki the problem goes away.

export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=setting' where setting may be

  • off or false or default – No anti-aliasing
  • on – Full anti-aliasing
  • gasp – Use the font's built-in hinting instructions
  • lcd or lcd_hrgb – Anti-aliasing tuned for many popular LCD monitors
  • lcd_hbgr – Alternative LCD monitor setting
  • lcd_vrgb – Alternative LCD monitor setting
  • lcd_vbgr – Alternative LCD monitor setting
Boring answered 29/6, 2013 at 20:56 Comment(4)
okay do you have problem only with IDEA or it appears in other applications as well?Boring
sorry for answering such late... only in intellij idea, other apps, inlcude those who using java such as pycharm works normalMillion
Same problem here. Were you able to find a solution?Flooded
setting useSystemAAFontSettings to LCS instead of on looks much nicer for me.Cleanly
I
16

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's idea64.vmoptions from /bin). Add these three lines:

-Dawt.useSystemAAFontSettings=on
-Dswing.aatext=true
-Dsun.java2d.xrender=true

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.

Itemize answered 16/9, 2013 at 17:58 Comment(1)
I had opposite problem - Antialiasing produced artifacts which rendered the text unreadable. Setting awt.useSystemAAFontSetting to "off" did work for OpenJDK 11 (running a program which has nothing to do with IDEA). Setting swing.aatext to true or false has no effect.Flapjack
J
5

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:

ln -s /PATH/TO/INTELLIJ/jre /PATH/TO/ANDROIDSTUDIO/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.

Jahn answered 15/4, 2016 at 20:9 Comment(3)
v2016 doesn't seem to improve font rendering for me.Henrik
@Henrik make sure you're using an unmodified installation of IntelliJ. The font thing was an actual change they did. It's made everything so much better for me.Jahn
Indeed, use the JRE delivered by JetBrains. Either download the IntelliJ directly from the JetBrains site, or use pacman to install IntelliJ and then add the JRE from JetBrains to the install directory.Baler
F
4

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)

Fishhook answered 7/3, 2014 at 21:55 Comment(0)
H
3

It won't work with OpenJDK, even with whatever _JAVA_OPTIONS you choose, so remove it with sudo 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.

IntelliJ Idea Community Edition 13.1.2 with Oracle JDK8 on Arch Linux

Harday answered 30/4, 2014 at 10:36 Comment(1)
Definitely the easier option. No need to set additional env vars, and it works out of the box. Besides, even setting the options didn't fix it for me.Interval
T
2

This applies to the current IntelliJ IDEA

The best solution is to download IntelliJ IDEA with the included JRE (the default download). This version runs on a custom JRE (Java Runtime Environment) that is patched to better handle fonts on Linux.

IntelliJ IDEA offers 2 versions for Linux, one version has an embedded JRE (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, Try the following:

  1. Download and extract this JRE
  2. Switch to it
  3. add -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 works on IntelliJ 2018 and up.

Tube answered 8/8, 2018 at 7:1 Comment(0)
P
1

This is a known bug in OpenJDK. I don't think any amount of tweaking will fix this for you, it might make it a bit better, but the font rendering is broken in OpenJDK.

The most pain free fix IMHO, is to go to the AUR and install jdk7-compat, which is designed to run next to your normal JDK.

Don't worry if you never used the AUR, its really straight forward. Basically, what you do is

  1. insure you have base-devel installed with pacman -S base-devel
  2. download the tar from the AUR page I linked above, uncompress it.
  3. run 'makepkg -di' in the folder where you uncompressed to

and its done. Now, edit /usr/share/intellijidea-ce/bin/idea.sh and change the line which executes the program (its in the bottom of the file) so it looks like this

eval "/opt/java7/bin/java" $ALL_JVM_ARGS -Djb.restart.code=88 $MAIN_CLASS_NAME "$@"

This will make intelliJ run in the ORACLE JVM rather than the OpenJDK one, which fixes the font issues all together.

Primp answered 10/12, 2013 at 16:28 Comment(0)
I
0

In /usr/share/intellijidea-ce/bin/idea.sh: edit this line:

ALL_JVM_ARGS="$VM_OPTIONS $COMMON_JVM_ARGS $IDE_JVM_ARGS $AGENT $REQUIRED_JVM_ARGS"

and make it like this:

ALL_JVM_ARGS="$VM_OPTIONS $COMMON_JVM_ARGS $IDE_JVM_ARGS $AGENT $REQUIRED_JVM_ARGS -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true"
Irons answered 17/2, 2014 at 10:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.