ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

Emacs: How to List & Set Font

Xah Lee,

This page shows you how to set font for emacs.

How to to change font?

Chose the menu 〖Options ▸ Set Default Font…〗

Then chose 〖Options ▸ Save Options〗.

How to list all fonts available to emacs?

You can evaluate the following code:

(print (font-family-list))

(list-fontsets "DejaVu Sans-10")

Select the elisp code, then call eval-region. 〔☛ Emacs: How to Evaluate Emacs Lisp Code

You can see the result in “*Messages*” buffer. view-echo-area-messagesF1 e】.

How to set a font in emacs init file?

;; set font for all windows
(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10"))

or

;; set font for current window
(set-frame-parameter nil 'font "DejaVu Sans Mono-10")

How to see all fonts in Linux?

In Linux, terminal, you can type fc-list to list available fonts.

For a sample output of fc-list, see: linux_ubuntu_default_fonts.txt.

How to install a font to emacs?

Just install to the OS normally. Restart emacs. Emacs should see it.

What's the best font for coding?

I recommend DejaVu Sans Mono, because it's the best font and has the best Unicode support. See: Best Unicode Fonts for Programing.

See also: How to Quickly Switch Fonts in Emacs.

(info "(emacs) Fonts")

blog comments powered by Disqus