Mastodon hachyterm.io

VS Code is the default editor/IDE at my future day job.

Today I wanted to switch the default font to the free JetBrains Mono font.

The font is easy to read and it also comes with font ligatures, a feature that I love for programming.

JetBrains Mono Font

Download the Font

Find the installation instructions on the official website.

For Arch Linux:

pacman -S ttf-jetbrains-mono

Line Spacing in VS Code

You should open your user settings (settings.json):

Command Palette > Open Settings (JSON)

The website for the font explains that the recommended settings are a font size of 13 and line spacing of 1.2.

Here’s what it should look like in VS Code:

{
    "editor.fontFamily": "JetBrains Mono",
    "editor.fontSize": 13,
    "editor.fontLigatures": true, // optional
}

But didn’t you tell me to set the line spacing?

Yes, I did. You can set the editor.lineHeight in VS Code (which is the same as line spacing). Don’t confuse it with editor.letterSpacing.

Line spacing is the vertical distance between lines of text. Most writers use either double-spaced lines or single-spaced lines—nothing in between—because those are the options presented by word processors. 1

In VS Code, editor.lineHeight is an absolute value, so setting it to 1.2 does not work. The line height is in “…in CSS pixels of the amount of space used for lines vertically.”.

There’s currently an open issue to allow the user to set line spacing as a relative value, but the feature is not implemented yet.

It looks like the default line spacing defaults to 1.35 relative to the font size.

For a font size of 13, setting the value in editor.lineHeight to 22 has the same effect as keeping the default (1.35 relative?). I’ve manually bumped it down to 21.