11 Answers
11

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:

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:

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

Awesome! Works in Windows as well :)) thank you :*
– BlokeJul 25 '13 at 10:06

1

I have tried the above on my windows machine with hi dpi (3200x1800) I have adjusted the studio.vmoptions as mentioned yet everything is still blurry. Please advise if possible I'd really like to get this working?
– PaceJan 7 '14 at 12:06

10

@Pace To remove blurry fonts you need to disable display scaling for that application (right click on its icon, select Properties, go to Compatibility tab and check Disable DPI scaling on high DPI settings, for x64 apps in Win8- you should edit the flag of the related registry key: open Regedit.exe, go to HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers and add a string value REG_SZ whose name is the full path to the application executable and whose value is HIGHDPIAWARE) ;)
– guariJan 7 '14 at 14:22

3

cant clear hints and instructions on fonts in font forge... There are errors when i try to save them after that... What am i doing wrong
– Mario ZdericSep 12 '14 at 10:05

2

Wow. Still helpful a year later. JetBrains needs to make this the default or at least perform some auto detection. The blurriness without these settings makes IntelliJ look awful and unusable.
– Andrew T FinnellSep 19 '14 at 13:18

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:

Here is a comparison between the two platforms

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

This is buried at the bottom, but THIS is the real culprit. Everyone above is focused on the Editor fonts, but I already had good editor fonts. My problem was the various callouts, tooltips, and modal dialogues all showed terrible font render with no antialiasing. I tried everything above and none of it resolved the issue, but hiding the packaged jre did the trick.
– DanDec 26 '16 at 6:42

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.

Which version do you mean? When I go to Help > About, I see Intellij IDEA 15.0.2 and Build #IU-143.1184
– BlokeApr 18 '16 at 6:47

@Bloke just go to the site and download the latest IntelliJ. It's 2016.1.1 right now I think. They changed the way they advertise the new versions now and it has that YEAR.REVISION.UPDATE# format now.
– Aspiring DevApr 18 '16 at 18:38

Using the JRE packaged with IntelliJ made all the difference for me. I had initially downloaded IntelliJ without the JRE and used my local Oracle JDK (1.7) which resulted in bad fonts. HTH.
– sengsJul 27 '17 at 17:02

If you can't clear hints with FontForge like guari explained in his answer. Use Cousine (Apache License v2.00) as editor font and set the size to 14. I tried a couple of other monospaced fonts. However, Cousine seems to have a nicer rendering than the most other fonts. See the screenshot at the end

In Windows 10, I had similar issues. Checking the Disable display scaling on high DPI settings made the fonts smoother but much bigger. Here's how to do this (from a previous comment from another user):

Right click on its icon, select Properties, go to Compatibility tab and check Disable DPI scaling on high DPI settings

Going into Windows Settings and searching for Display Settings, there's a dialog with a slider that says Change the size of text, apps, and other items. I moved it from 125% to 100% and had to logoff and log back in. The fonts are small AND smooth now:

Even more, if I uncheck Disable display scaling on high DPI settings, it appears to still be smooth.

Save it then open up IntelliJ, the fonts should work and you will be using Oracle JDK 8 for development. You will likely have to edit Project Settings and set up your JDK again but be sure to use the actual JDK and not the font fix one.

This fix also works with CLion, Android Studio and [PyCharm.

These instructions assume the JDK version was 1.8.0_25, file/path names will change for future versions.

This is how it looks like with horrible font rendering on ubuntu 16.04:

If you are using the IntelliJ IDEA 2016.X or later without bundled JDK, you can set an environment variable "IDEA_JDK" to specify a specific runtime. Font rendering in ubuntu 16.04 with Android studio is perfect, so you can share the same JRE with Intellij IDEA. IntelliJ looks for IDEA_JDK environment variable first, so set it by adding a file:

/etc/profile.d/IDEA_SDK.sh

Add this to the file:

export IDEA_JDK=/opt/android-studio/jre

Adjust /opt/android-studio/jre as per your installation. Logout and login back and fire your Intellij IDE

I realized that the anti-aliasing of phpstorm works quite well using the default configuration.The comparison of the two commands shows that the only difference is phpstorm using its own java (/usr/share/phpstorm/jre64/bin/java).

I modified the startup script of idea to make it using phpstorm's java and it worked and everything is as good as phpstorm do.
screen shot