Using Emacs XFT Support

Thomas Nichols  Author
Ulrich Müller  Author
Joshua Saddler  Editor
Christian Faulhammer  Contributor

Updated October 7, 2009

1.  Enabling Antialiased Fonts for Emacs

Installation and setup

Note: Font anti-aliasing using the Xft library and FreeType fonts is now available with the app-editors/emacs-23.1 stable ebuild.

First, set the appropriate USE flags – you must have the xft flag.

Code Listing 1.1: Adding appropriate USE flags

# echo "app-editors/emacs xft" >> /etc/portage/package.use

Now it's time to install Emacs 23:

Code Listing 1.2: Emerging emacs-23

# emerge -av app-editors/emacs-23.1

You can now use XFT fonts in emacs; try emerging media-fonts/ttf-bitstream-vera first.

Code Listing 1.3: Enabling XFT fonts in emacs

$ emacs-23 --font 'Bitstream Vera Sans Mono-12'

If you're happy with this as your default font, set it in your ~/.Xresources:

Code Listing 1.4: Setting the default font for emacs startup

$ echo "Emacs.font: Bitstream Vera Sans Mono-12" >> ~/.Xresources
$ xrdb -merge ~/.Xresources

If you experience problems you may want to have a stable-but-not-antialiased version of Emacs available as a standby. You can use eselect to switch between the various Emacs versions installed on your system.

Code Listing 1.5: eselect for switching emacs versions

(Check available versions)
$ eselect emacs list
Available Emacs symlink targets:
  [1]   emacs-22 *
  [2]   emacs-23

XEmacs is also installed

(Select the correct version)
# eselect emacs set emacs-23

Resources

For more details on Emacs with XFT pretty fonts, see: