16

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?

7
  • Monospace font is indeed thicker when bold than not... that's what bold means. Do you mean wider? It's not wider. If the same word in Monospace take up more of the line when bold versus normal, then perhaps Eclipse is changing the font size on you. May 23, 2012 at 11:24
  • For example, look at this: cloudfront.omgubuntu.co.uk/wp-content/uploads/2011/09/mono.jpg May 23, 2012 at 11:25
  • 1
    Same problem here. As many things are typically screwed after updating, I went through settings (antialiasing, hinting, etc.), but no luck.
    – dbrank0
    Jun 13, 2012 at 8:29
  • 1
    Same problem with droid mono, but others, like bitstream-vera mentioned below (or Liberation Mono) are fine. :/
    – dbrank0
    Jun 13, 2012 at 8:48
  • I had the same issue with NetBeansIDE (7.4). Monospace font (both bold and normal) displayed fine, until I installed PlayOnLinux and Wine, after which normal versions became narrowed than bolded. The bitstream-vera font mentioned below works fine and is an acceptable workaround.
    – loostro
    Feb 17, 2014 at 13:18

4 Answers 4

14

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.

2
  • It seems font hinting is broken for the system default monospace fonts (both Monospace and Ubuntu Mono). It appears to work for Bitstream Vera Sans Mono though - thanks for the tip!
    – kynan
    Jul 3, 2012 at 18:17
  • Thanks, that helped alot. As I mentioned above - my problems began after installation of PlayOnLinux and Wine.. which seem to have altered some font configs.
    – loostro
    Feb 17, 2014 at 13:19
3

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.

1

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.

1
  • I had to end up un-bolding everything in Eclipse because this was driving me up the wall. I need to try this though! Jul 9, 2014 at 0:03
0

I had the same problem with OpenJDK 8. The font called "Monospaced" was correctly mapped to "DejaVu Sans Mono" for the "regular"/"plain" style, but something else (probably automatically bolded) for "bold", even if using "DejaVu Sans Mono" directly does the correct thing.

The solution is to fix ~/.java/fonts/*/fcinfo*.properties. It did contain (among many others):

monospaced.1.0.file=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
monospaced.3.0.file=/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Oblique.ttf

Everything was fine after changing those to:

monospaced.1.0.file=/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf
monospaced.3.0.file=/usr/share/fonts/truetype/dejavu/DejaVuSansMono-BoldOblique.ttf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .