Sunday, August 22, 2010

Emacs Fonts

I just upgraded to Ubuntu 10.04 and the "fixed" font is atrocious. "fixed" is what I've been using for years for emacs and xterm since it's the smallest I've found that looks reasonable and is easy to read. This Chris Lea article provides another good suggestion, "Monospace-10". It's a bit large. A commenter, Olle, notes that "Monospace-9" is a bit smaller and also nice. Olle also provides a good suggestion for how to set your font, the .emacs file:

(if (>= emacs-major-version 23)
(set-default-font "Monospace-9"))
This seems like a more reliable way than .Xdefaults, especially considering that the program name sometimes changes from version to version.

Update (8/22/10): I found my old-faithful. It's called "6x13" (how creative!). Yes, it can be set using .emacs code like above. However, "6x13" existed in prior versions of emacs. It worked fine when I used a (>= emacs-major-version 22) condition. Other fonts I discovered while looking for my favorite include "fixed-8" and "DejaVu Sans Mono-9" (same as Monospace?).

Update (8/25/10): How ridiculous! The .emacs setting only seems to work for the main/first "frame" (aka window). If I open a 2nd frame/window (C-x 5 2), it uses the hideous font. So, .Xdefaults appears to be the better way to set the font.

2 comments:

  1. (setq my-font "Droid Sans Mono-8")
    (set-default-font my-font)
    ;; Fix the bug where new frames have a huge font.
    (setq default-frame-alist
    (append '((font . my-font)
    (geometry . "-1-1"))
    default-frame-alist))
    Took me a while to track that one down :).

    ReplyDelete