Reputation: 40778
I would like to change the font in Emacs from within a major mode. I am using Emacs 24.3 on Ubuntu 12.04.
I tried set-frame-font
, like:
(set-frame-font "DejaVu Sans Mono-10")
But I get error:
Debugger entered--Lisp error: (error "Font not available" #<font-spec nil nil DejaVu\ Sans\ Mono nil nil nil nil nil 10.0 nil nil nil ((:name . "DejaVu Sans Mono-10") (user-spec . "DejaVu Sans Mono-10"))>)
internal-set-lisp-face-attribute(default :font "DejaVu Sans Mono-10" #<frame [email protected] 0x116a4c0>)
The output of fc-list
is:
fc-list | grep 'DejaVu Sans Mono'
DejaVu Sans Mono:style=Bold Oblique
DejaVu Sans Mono:style=Oblique
DejaVu Sans Mono:style=Book
DejaVu Sans Mono:style=Bold
Upvotes: 4
Views: 2464
Reputation: 137088
It sounds like you've built Emacs without Xft support, which is required if you want to use anti-aliased, TrueType, and OpenType fonts.
Here is how you can build it with Xft:
Install the libxft-dev
package, which contains the required Xft headers:
sudo apt-get install libxft-dev
Build Emacs as before, but this time include the --with-xft
flag in your ./configure
command.
Now your Emacs should be able to use TrueType and OpenType fonts, including DejaVu Sans Mono.
Upvotes: 4