Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the line spacing in Visual Studio 2012?

Is it possible to change the spacing between lines in the Visual Studio 2012 code editing area? After having worked with IntelliJ IDEA for a while, I got accustomed to a slightly larger line spacing (1.2), and I want to achieve the same effect in VS12. For comparison, the top one is IDEA with 12 pixels spacing between lines, the bottom one is VS12 with 10 pixels spacing:

enter image description here

I find the IDEA version much easier to read, even if it's just 2px difference. Does anyone know?

like image 746
Lennart Avatar asked Jul 23 '13 09:07

Lennart


People also ask

How do I change line spacing in Visual Studio?

There's a built-in setting for that, just open the Tools menu > Options > Text Editor > General and look for a setting called Line Spacing, change its value to one of your liking.

What is optimal line spacing?

Line spacing should be at least a space-and-a-half within paragraphs. So around 150 percent or 1.5 times the font size. Spacing following paragraphs should be at least two times the font size.

How do you calculate line spacing?

For most text, the optimal line spacing is between 120% and 145% of the point size. Most word processors, as well as CSS, let you define line spacing as a multiple. Or you can do the math—multiply your point size by the percentage. (The text in this paragraph has line spacing of 110%.

How do I change the spacing between letters in Vscode?

I was able to set this by simply searching in the User Settings (CTRL+SHIFT+P) for spacing and there are two separate boxes that were set to 0 for terminal and editor. You can change the value and see it update live, which is really cool.


2 Answers

I've found a workaround which works pretty well, partly alread described in this comment.
You need to download and install TypeLight (free for personal use), and open the Consolas.ttf file inside. To adjust the line spacing, go to Font -> Metrics -> Advanced and change the "Line Gap" to your desire (I changed "Type Line Gap" as well, but I have no idea what this actually does). I experimented a bit with a values and found around 730 to be similar to the 12 pixels spacing in IDEA.

To distinguish the modified font from the regular Consolas, I suggest changing the name of the font under Font -> Names (to "Consolas Spaced" or something). Save the font, double-click the file and choose "Install" from the preview dialog. Then (re)start Visual Studio, choose your modified font and you're done.

like image 141
Lennart Avatar answered Sep 24 '22 00:09

Lennart


Can't change directly in Visual studio.
--> BUT You CAN change line height of font, the font you're using.
Step 1: install Fontforge.
Step 2: Open Fontforge after install finished, go to:
Element->Font Info ->OS2 -> Unit.
Change 4 value: Down win, up win, top N, down horizontal by multiplied by the desired ratio. Sample: ratio 1.5 or 2 ..etc...
(it means: if default 800, you multiple with ratio 1.5 --> result is 1200, you change 800 -->1200)
--> click OK to save setting.
Step 3: Go to File -> Generate font --> Generate with ttf format.
Step 4: Install the font just created and change font in Visual Studio.

like image 39
O Thạnh Ldt Avatar answered Sep 23 '22 00:09

O Thạnh Ldt