How to get Visual Studio 2012 to render monospaced fonts correctly?
Asked Answered
P

1

10

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

Preconceive answered 9/8, 2013 at 12:27 Comment(9)
For what its worth: on my Windows 8, VS2012, Consolas 10pt @100% renders correctly (it looks similar to your 101% example). But Terminal and others exhibit the problem.Slue
I have a Win 7 virtual machine, True Type enabled, VS 2012. Consolas and Courier New @ 10 Pt, 100%, render correctly. Courier and Terminal at the same specs do not.Incidental
The internet says a corrupt "fntcache.dat" file can cause fonts to not display correctly. You may want to try to delete it (C:\Windows\System32\FNTCACHE.DAT) and reboot and see if that fixes things. If you are paranoid, you can probably just rename the file instead of deleting it. See comment at this link; also check out this link.Incidental
Alas, deleting FNTCACHE.DAT (it came back after reboot) did not fix this problem. Thanks for the advice though.Preconceive
Could you have an extension that messes up with the out-of-the-box VS editor? Have you tried Devenv.exe /SafeMode?Heathen
Good shot in the dark, but alas, does not change the rendering. Tried it just now, renders exactly the same. Though I must say, Visual Studio started awfully fast :P Makes me want to revisit the list of addins I have.Preconceive
My other thought is to create a new user and log in with that user. Open VS and see if the fonts are displayed correctly. If so the problem may be narrowed down to just your particular user profile.Incidental
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.Randee
9 points did indeed look correct. I can even adjust the zoom factory up to 111% to compensate and it still looks OK. If you post an answer for that, and there's no better answer (ie. one that tells me without guessing :)), I'll accept that for the bounty when the bounty runs out this weekend.Preconceive
R
13

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.

Randee answered 16/8, 2013 at 12:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.