Monospace font is not mono spaced in eclipse, why?

I recently upgraded to Ubuntu 12.04, and I see that when using eclipse for editing source code, the bold characters displayed with the Monospace font are actually thicker than the non-bold ones. Thus, the Monospace font is actually not mono-space. (same space for all characters)

Is this a known issue? Am I missing something?

How do I make it mono-space again?


Solution 1:

I'm having a similar problem with Monospace.

As a workaround I've switched to using Bitstream Vera Sans Mono which looks very similar but doesn't have the bold problem.

If you don't have it, you can install it by doing sudo apt-get install ttf-bitstream-vera.

Solution 2:

Monospace refers to all fixed-width font. There is also a specific monospaced font called Monospace. Suppose you refer to the specific Monospace font.

I use Monospace font in Libreoffice/Openoffice to align sequences under Ubuntu 12.04. I noticed the same issue: bold Monospace letters are wider than the regular Monospace letters of same size, though they are still monospaced, i.e. fixed-width. See picture

enter image description here

To find an alternative, have a look at this article TOP 10 PROGRAMMING FONTS. I use Daja vu sans mono or Courier New, which show same width for regular and bold facetypes. At least Inconsolata has the same problem as Monospace.

Solution 3:

It appears that the font configuration in 12.04 sets Droid Sans Mono as the default monospace font (see /etc/fonts/conf.d/60-droid-sans-mono-fonts.conf), and as the OP describes, the glyphs in the bold version of this font have a different width than those in the normal version.

To change the system default monospace font, create /etc/fonts/local.conf containing something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>DejaVu Sans Mono</family>
    </prefer>
  </alias>
</fontconfig>

This way, you won't have to remember to change the Eclipse editor font for every workspace you use.