8

In my .spacemacs I try to change my default font but it draws an error, how to find the name of fonts that you can write up in config files ?

Unimor
  • 93

1 Answers1

23

Check the output from the fc-list command (in a terminal window):

/usr/share/fonts/TTF/LiberationMono-Italic.ttf: Liberation Mono:style=Italic
/usr/share/fonts/TTF/VeraMono.ttf: Bitstream Vera Sans Mono:style=Roman
/usr/share/fonts/TTF/DejaVuSansMono-Oblique.ttf: DejaVu Sans Mono:style=Oblique
/usr/share/fonts/OTF/LinLibertine_M.otf: Linux Libertine Mono O:style=Mono

/usr/share/fonts/OTF/LinLibertine_M.otf: Linux Libertine Mono O:style=Mono

For example:

/usr/share/fonts/OTF/LinLibertine_M.otf       File name
:                                             Separator
Linux Libertine Mono O                        Font name (note, remove the initial space)
:                                             Separator
style=Oblique                                 The font 'style'

Font style is normally one of Regular (or Normal), Italic (or Oblique), Monospace (or Mono), Book, and combinations of these are valid.

The middle value ('Font name') is normally the name you'd want to use. If it contains space(s) you might need to escape each space (with a '\' in front) or put the entire name in quotes ('"'). Not always necessary though.

Beware that some font names contain extended characters (such as the TM or Copyright symbol) so you may need to handle those. (they can appear as, eg. ⢠in fc-list output)

Software such as font-manager show those names too.

jcoppens
  • 613
  • 3
    What if there is a comma in the name? For example: ƦB.ttf: TTEditFont,花鳥風月B:style=Regular – drumfire Dec 06 '18 at 21:23