I recently installed Arch Linux on my new laptop. Shortly, afterwards, I also installed the X Window System and Emacs 24. I like the DejaVu Sans Mono font so I added it to my .Xresources:

URxvt.font: xft:DejaVu Sans Mono:size=12
emacs.font: xft:DejaVu Sans Mono:size=12

The font works perfectly for my terminal emulator URxvt, however when I start emacs this message popped up:

$ emacs
     Font `xft:DejaVu Sans Mono:size=12` is not defined

Apparently Emacs was built with xft, as shown below:

$ ldd `which emacs` | grep libXft
     libXft.so.2 => /usr/lib/libXft.so.2 (0x00007f8498c37000)

How can the font not be defined in emacs?


3 Answers 3


Stupid me, I had not installed the ttf-dejavu package in Arch Linux. I got sidetracked by the fact that urxvt did not give me an error message, which lead me to believe that it was something wrong with emacs.

  • If this is the answer then please accept it (you can accept your own answer).
    – Drew
    Commented Apr 10, 2016 at 16:34
  • 1
    There is a waiting period of 36 or 48 hours or something like that before an original poster can accept his/her own answer.
    – lawlist
    Commented Apr 10, 2016 at 16:54

You're confusing the font backend for the font naming syntax, probably because programs like urxvt require you to prepend xft: for specifying fonts by their family name. See its manual for more details.

Emacs only accepts XLFDs in that file, so try -*-DejaVu Sans Mono-*-*-*-*-12-*-*-*-*-*-* instead.

  • I tried your suggestion and I got the same error: Font -*-DejaVu Sans Mono-*-*-*-*-12-*-*-*-*-*-* is not defined. I also tried to define the font in my .emacs file as such: (set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 200) to no avail.
    – Perry
    Commented Apr 10, 2016 at 14:18

You can set the default font by customizing your default-frame-alist. In your .emacs file, add the following:

(add-to-list 'default-frame-alist
             '(font . "DejaVu Sans Mono-12"))
  • This gives the same error message but in the message box in emacs: Font DejaVu Sans Mono-12' is not defined
    – Perry
    Commented Apr 10, 2016 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.