Solved: Inconsolata font display problems

If you have problems with the font Inconsolata on linux-based systems with JetBrains IDEs – and possibly with other Java-based apps – try the following.  I will give this example in terms of Ubuntu 14.04 and PyCharm but it should work for some other similar situations.

1. Close PyCharm, or to be extra careful use File > Invalide Caches and then close PyCharm without restarting.

2. Remove all copies of Inconsolata from your system:

  • test first to check what will be removed:
sudo find / -depth -iname "inconsolata*"

  • then if you agree with what comes up, do the removal:
sudo find / -iname "inconsolata*" -delete
... or else remove the files that you choose by hand.

2b. It may be a good idea to open PyCharm at this point and use File > Invalidate Caches just to make sure it understands Inconsolata is gone.

3. Do not install inconsolata from your system's package repository, or from the many internet links to the designer's primary copy of it.  That version is the one with display problems in PyCharm.  Instead, go to Google Web Fonts and download their ttf version:

  • It will be in a zip archive; after downloading open the archive, open the font (only the regular version, do not install the bold version – it will confuse PyCharm) with the system font viewer, which should be the default double-click action for the file, and then click the Install button from the viewer.

4. Force your system to rebuild its font cache.
sudo fc-cache -frv
  • the 'r' option could be left out if you only want to rescan and not completely rebuild the cache.

5. Log out and back in, or reboot.

6. Open PyCharm and go to Settings > Editor > Colors & Fonts > Font.  Uncheck "show only monospaced fonts".  This is the only remaining problem but at least it doesn't really cause any issue.  Now Inconsolata will show up in the list and you can choose it.

If you have any other problems getting new fonts to work in Jetbrains IDEs on Ubuntu, experiment with the program "font-manager" which can be installed using sudo apt-get install font-manager.  It can do some re-sorting of fonts that seems to help PyCharm and other IDEs find and use them.

One other note is that fonts show up in several different locations on Ubuntu systems and they do not always install themselves in the expected or even the correct one from the several possibilities.  System fonts should be in /usr/share/fonts, but sometimes end up in /usr/local/share/fonts (not a wrong choice, really, but just be aware that either one can work).  User fonts sometimes end up in ~/.fonts, but some of them end up in ~/.local/share/fonts.

One of the things font-manager can do for you is correctly sort which fonts are system and which are user-installed and put the user ones in the right directory.  Without doing so, a great many user-installed fonts end up in the system directory for some reason, which just seems unhelpful.
Eric, Thanks for your detailed instructions!
But which display problems are you addressing exactly with these steps?
Do they include the problem that 'bold' takes up more horizontal space than 'regular' characters?
The problems I was addressing are these:

  • Sometimes inconsolata is rendered very fuzzy, lacking sharpness as if improperly hinted.

  • Sometimes inconsolata is rendered with incorrect baseline location... symptom: all highlighting and color-boxing of text is at the wrong height, usually a pixel or two higher than the text.

The above problems are caused somehow by an interaction between Java or Swing's font renderer and the standard debian package version of Inconsolata (which seems to be also Ralph Levien's standard version).  Installing Google's version of Inconsolata (and removing all others) fixes it.

The problem you refer to, worrelsik, where bold characters are wider than regular characters from inconsolata, is a problem with the font itself, or with the currently existing rendering hints for it. It is not specific to Java and can be seen in any text editor.

The current workaround for the bold-width issue with Inconsolata is to edit your editor color palette preferences and turn off the use of boldface as a way to emphasize keywords.  Instead set some other characteristic to emphasize them, such as a different color, or simply go without the bold attribute.

Please sign in to leave a comment.