2009-06-23

NOTE: if you like Org-Mode, please go and vote for it in SourceForge
Community Choice Award – it's in the Most Likely to Change Change the Way You Do Everything-category.

For pleasant working with emacs, one of the more important things is choosing
the right font ('face'). Especially within a windowing system, and
especially with Emacs 23, there are a lot of possibilities. I am thinking from
the Linux/X-Window perspective here – the support for anti-aliased fonts
makes things look so much nicer – as discussed before.

On X, there are different ways to set your font. One way is through the menu
(Options/Set default font.../). We can also set it in our .emacs, with
(set-default-font "<font>"), or using ~/.Xdefaults. The latter method
makes emacs-startup quite a bit faster, but this may have become less
important in the age of emacs –daemon (Emacs 23).

barb wire

In either case – .emacs or .Xdefaults – you must provide some string
describing the font. Up to Emacs-23, under X you had to use the 'barb
wire'-style X font description, which you could get from a tool like
UI-designers' dream xfontsel; the font description would then
look something like:

-*-bitstream vera sans mono-medium-r-*-*-*-120-*-*-*-*-iso8859-*

emacs 23

In the brave new world of Emacs 23, on X, you can also use the somewhat
clearer Fontname-<size> format. You can get a list of the fonts installed on
your system with the fc-list commond; if you only want to get the monospaced
fonts, use

Note that installing fonts under X is rather easy as well these days; in
most cases all you need to do is put the .ttf-files in your ~/.fonts
directory and all will be find, although some program might require a restart.

Once you have chosen a font, you can put it in your ~/.Xdefaults:

Emacs.font: Envy Code R-10

and don't forget to run xrdb ~/.Xdefaults afterwards, to tell X about the changes.
All of this should happen before you start emacs.

face value

There are many fonts; which one is the 'best' for you, obviously depends on
personal taste and also what you want to with it. As I use emacs for coding
but also for reading e-mails and writing documents, there are some things that
are important for me:

monospace

most important: clear and crisp, even when using smaller font sizes;

clearly separate O (capital O) and 0 (zero);

support italic display;

support the characters I might use (incl. accented characters and some
greek ones).

Following these rules, I found the Envy Code R font to work very nicely. It's
not fully Free though: Free to use but distribution prohibited. Raph
Levien's Inconsolata is nice as well and truly Free; it does not provide an
italic font though (at least it does not show in Emacs). Here's a list of programming fonts.

more

Hmmm… I wanted to write some small entry… And there is so much more to
say about fonts. As often, EmacsWiki has a lot of information; for example
about FontSets, which allow you to use a sort-of combination-font, which is
nice if you have to work with mixed character sets (Latin, Arabic, CJK etc.).

Also, the emacs-fu entry on zooming in/out is useful in this context, even
though Emacs 23 has gained something similar by default.

Also, the entry on color theming may be interesting, in this entry we only
look at the default font, but you can change fonts governing only part of
emacs as well; see M-x list-faces-display.

@rxfl: yeah, noticed the display thing in the font dialog, but I couldn't get italics to work in Emacs. In other apps they do (e.g. gedit), even when the font dialog has the same issue. So, maybe emacs gets confused because of some wrong info in the font files (just guessing).

Xresources should work, but make sure you run xrdb ~/.Xresources *before* starting emacs.

Hi! Sorry for commenting on a really old post, however no one else on the internet seems to explain these matters as well as you. So, question: I run fc-list :spacing=mono...Source Code Pro:style=Light

I add the lineEmacs.font: Source Code Proto .Xresources, run xrdb -merge .Xresources, then run emacs, and I get the following error:Font `Source Code Pro' is not defined

The results are the same for nearly every font except for Courier, Utopia and a few others (only one-word name length that I've found)

@MattiasI set the font in my .emacs file like this:(set-default-font "-adobe-Source Code Pro-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1")You can get a list of the supported font lines like this:M-x set-default-font and then on Font name: you press TAB twice and the completions list is presented.