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
$ fc-list :spacing=mono
For details, see the FontConfig user manual.
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.
Alternatively, you can put in your .emacs
something like:
(if (eq system-type 'windows-nt)
(set-default-font "-outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-iso8859-1"))
(if (eq window-system 'x)
(set-default-font "Inconsolata-11"))
This will set a different default font, based on whether you are running on
Windows or X. You can freely adapt it to your own desires of course.
Side note: if there is yellow in the code snippet above, that is because of
hightlighting lines that are too long.
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
.
Or get information about the font at point with C-u C-x =
.
No comments:
Post a Comment