dawid
dawid

Reputation: 715

What do lists of multiple font families mean in VS Code font family setting values?

Everywhere it seems to say that I just simply need to change 'editor.fontFamily'. But how? This is the default value for it:

  "editor.fontFamily": "'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",

What do all those multiple entries mean ( like monospace with and without quotes ) and how would I change it to 'DejaVu' fonts for example?

Upvotes: 5

Views: 19407

Answers (2)

Victor Zamanian
Victor Zamanian

Reputation: 3190

Regarding the multiple entries, from the CSS spec:

Font family names that happen to be the same as a keyword value ('inherit', 'serif', 'sans-serif', 'monospace', 'fantasy', and 'cursive') must be quoted to prevent confusion with the keywords with the same names.

So in other words, monospace is a reserved word/font for the font-family CSS property, and if you have a font with the same name, you need to quote it. So VS Code's default settings prioritizes the 'monospace' font before the default monospace font.

I hope that makes sense.

Upvotes: 5

herrbischoff
herrbischoff

Reputation: 3326

VScode does its styling via CSS. This is knows as a "fallback group". If one font is not available, it automatically uses the next one in line, from left to right.

To do what you asked for:

"editor.fontFamily": "'DejaVu Mono', 'monospace'"

If that doesn't work, look up the correct name of the font and put in in there. The quotes are used mainly with names that have spaces in them.

Upvotes: 7

Related Questions