How to fix font anti-aliasing in IntelliJ IDEA when using high DPI?

I’m on a high-dpi display and I got it working with a perfect font rendering, to achieve this you need to:

  • (On Linux) Install and use Oracle JDK (I’m using 1.7) and not OpenJDK (also the patched one with fontfix was useless for me). See how to do this.

  • Edit the .vmoptions configuration file that you find into the Bin installation folder (eg. studio.vmoptions and for 64bit studio64.vmoptions, or WebStorm.exe.vmoptions etc. according to the version of the IDE you installed) by adding these lines:
    -Dawt.useSystemAAFontSettings=on
    -Dswing.aatext=true
    -Dsun.java2d.xrender=true

  • Remove hinting informations from the font that you would like to use and select the new font into IntelliJ IDEA preferences (Setting -> Editor -> Font);
    if you don’t know how to do this, install FontForge then:

    1. Open your font in FontForge
    2. Select all glyphs via Ctrl+A and clear all hints (Hints -> Clear Hints)
    3. Select glyphs again and use Hints -> Clear Instruction
    4. Save the font with different name ( File -> Generate Fonts)
    5. Install the new font, select it in IDEA

If you followed the above tips and you’re experiencing lags when fast scrolling the code (this sometimes could happen on Linux distributions with a not optimized gpu driver), try removing the line
-Dsun.java2d.xrender=true
from the .vmoptions file.

Finally, here is a screenshot of the result:

IDE screenshot


(fonts used here are LucidaMAC for the main IDE and Ubuntu Mono with removed hinting informations for the code editor)


I wrote a little manual howto fix this.

   wget http://urshulyak.com/jdk-8u5-tuxjdk-b08.tar.gz
   tar -zxvf jdk-8u5-tuxjdk-b08.tar.gz
   sudo mv jdk-8u5-tuxjdk-b08 /usr/lib/jvm
   rm jdk-8u5-tuxjdk-b08.tar.gz

Script to start Intellij Idea

*only note that need to change IDEA_HOME location for your path of idea

#!/bin/sh

IDEA_HOME=/opt/idea
export JAVA_HOME=/usr/lib/jvm/jdk-8u5-tuxjdk-b08/
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=lcd \
                      -Dsun.java2d.xrender=true"
export GNOME_DESKTOP_SESSION_ID=this-is-deprecated
exec $IDEA_HOME/bin/idea.sh "$@"

More info and screenshots of better fonts: http://urshulyak.com/?p=478


I got a similar look just by downloading the Menlo font and setting the Editor Anti-aliasing to 'grayscale' within Appearance & behaviour > Appearance

This is the result:

This is how it looks

Here is a comparison between the two platforms

enter image description here

I am using a higher resolution and better hardware at work with the MAC, that is why the fonts look a bit brighter, the result will vary depending on your machine. Anyways it's worth a shot, the changes are easy to revert