Fun with fonts

I’ve been playing around with some different fonts to see how they look in Emacs. For a long time I’ve been using DejaVu Sans Mono, but I felt like a change. It’s easy to switch the font for the current frame, just use M-x set-frame-font and enter the name of an installed font, or put a line like this

(set-frame-font "DejaVu Sans Mono-14" nil t)

in your scratch buffer and put the cursor at the end of the line, and use C-x C-e to run eval-last-sexp which evaluates that bit of code. This will instantly change the appearance of the current frame.

Here are some of the fonts I’ve been trying out (I installed them using the Font Book on my Mac):

(set-frame-font "DejaVu Sans Mono-14" nil t)
(set-frame-font "Fantasque Sans Mono-16" nil t)
(set-frame-font "Source Code Pro-14" nil t)
(set-frame-font "Monaco-14" nil t)
(set-frame-font "Cousine-14" nil t)

I’ve decided to go with Google’s Cousine font at the moment, so I add the following to my emacs config file to make the choice permanent:

(setq default-frame-alist '((font . "Cousine-14")))
  • Daniel

    My preferred font is CamingoCode. Although it’s from a commercial type designer the font is freely available.

    Maybe you would like to check it out as well.

    • Thanks for the suggestion. I like this a lot except it causes the lines to be spaced out too much vertically for my taste.

      • Daniel

        Fair enough. Luckily there are enough fonts available.

        Do you already know Input from Fontbureau? It’s a large family that is dedicated for coding as well.

        • I love Input! The customisation interface is great – I could choose my line spacing and the types of *, 0 and l that I wanted. Thanks!

  • James Ferguson

    Have you checked out the Ubuntu Mono font – I’ve been a fan of it from the beginning. However, Emacs doesn’t seem to render it well unless I mess with font heights. By trial and error I’ve found

    (set-face-attribute ‘default (selected-frame) :height 117)

    Heights of 102, 117, 132, 147 give me good rendering at progressively larger sizes.

  • jco79

    This is very nice also: