Intellij IDEA font smoothing in linux

2019-02-03 03:57发布

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?

8条回答
聊天终结者
2楼-- · 2019-02-03 04:26

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"
查看更多
小情绪 Triste *
3楼-- · 2019-02-03 04:27

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.

查看更多
叼着烟拽天下
4楼-- · 2019-02-03 04:28

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:

  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 work on IntelliJ 2018.

查看更多
何必那么认真
5楼-- · 2019-02-03 04:36

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.

查看更多
Lonely孤独者°
6楼-- · 2019-02-03 04:36

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)

查看更多
啃猪蹄的小仙女
7楼-- · 2019-02-03 04:40

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

查看更多
登录 后发表回答