Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Visual Studio 2012 to render monospaced fonts correctly?

In my Visual Studio 2012, monospaced fonts does not render correctly, specifically they don't render "monospaced" correctly, ie. the characters are not uniform in width.

Here's an example, this:

// 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// -|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|

renders as this with Consolas 10-point, 100% zoom:

consolas 10-point 100% zoom

and as this with 101% zoom:

consolas 10-point 101% zoom

There are other minor problems at 101% zoom, so neither are good. Is there a way for me to configure Visual Studio to render monospaced fonts correctly?

I have tried the following fonts:

Consolas
consolas 10-point 100% zoom

Courier
courier 10-point 100% zoom

Courier New
courier new 10-point 100% zoom

Terminal
terminal 10-point 100% zoom

Apparently no monospaced font that I've tried renders correctly in Visual Studio.

If I use the exact same font and font-size in Notepad2, like Consolas: notepad2 consolas 10-point

compare notepad2 and Visual Studio with Consolas

notepad2 consolas 10-point
consolas 10-point 100% zoom

Is there anything I can do?

Details:

  • Windows 7
  • Cleartype enabled
  • Font-size in Windows is set to 100%

Visual Studio 2012 font dialog:

Visual Studio 2012 font dialog

like image 688
Lasse V. Karlsen Avatar asked Aug 09 '13 12:08

Lasse V. Karlsen


People also ask

How do I make my font monospaced?

Basically, for a font to be considered monospace, every glyph has to be the same width, right down to the exact same number of units. This includes even glyphs that should normally be zero width, or a certain width (such as em spaces, em dashes, etc).

Are monospaced typefaces less legible?

Monospaced typefaces do reduce legibility, albeit by a margin. In Universal Principles of Design, the entry on legibility states: Proportionally spaced typefaces are preferred over monospaced.

How can you tell if a font is monospaced?

A font can be monospaced even if metadata tells you otherwise. Just look at the with of glyphs. Compare the width of 'i' and 'm' and/or other glyphs.

Are monospaced fonts better?

Compared to proportional fonts, monospaced fonts are harder to read. And because they take up more horizontal space, you'll always get fewer words per page with a monospaced font. In standard body text, there are no good reasons to use monospaced fonts. So don't.


1 Answers

My guess:
10pt = 13.333px and it's problem with correct render for some fonts.
Set 9pt. It's 12px by default and all is ok.

like image 182
Dima Kurilo Avatar answered Sep 24 '22 02:09

Dima Kurilo