Ubuntu – Ugly font rendering with Android Studio on Java8

android-studiofontsjava

I am using Oracle Java 8 and Android Studio, but it is difficult to work with it because of the ugly font rendering. Here are some screen-shots.

code in Android Studio

more code in Android Studio

I am using Ubuntu 16.04 LTS 64-bit. Android Studio is set to use the GTK Themes. I have also added the following options to andriod-studio/bin/studio64.vmoptions and android-studio/bin/studio64.vmoptions as described in this post on Super User.

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

Apart from the GTK theme settings in Android-Studio > Settings > Appearance, nothing else is done.

I am also not really happy with the overall fonts settings on my machine. Here is a screenshot of firefox:

reddit posts

I have only installed some powerline fonts in my ~/.fonts directory for my rxvt terminal. That's all.

Any pointers on how to go from here?

Best Answer

In the bundled JRE, there's a font configuration file which seems to default to full hinting.

To change this, open jre/lib/fonts/font.conf and locate the following part:

<edit mode="assign" name="hintstyle">
  <const>hintfull</const>
</edit>

There, replace hintfull with a different hintstyle, e.g. hintslight which is usually the default for other UIs in Ubuntu.