SiteMap Search ElispArea HowTo RecentChanges News Problems Suggestions

Search:

XftGnuEmacs

Introduction

With XFT support, GnuEmacs will be able to use anti-aliased fonts in the X11 UI. Note that GnuEmacs already supports anti-aliased fonts for the Carbon and W32 UIs.

There is some experimental work going on for XFT support in GNU Emacs. Of course, like for all experimental and unreleased code, you should expect problems and you are expected to report them to the proper place (i.e. not gnu.emacs.help) with M-x report-emacs-bug. It does, however, work fairly well.

Getting the code

The canonical repository is the emacs-unicode-2 on savannah. To check it out from there,

  $ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co -r emacs-unicode-2 emacs

Packages

Pre-built binaries are available for Ubuntu. For Dapper, see http://g33k.wordpress.com/2006/11/06/gnu-emacs-with-xft-goodness/

AlexandreVassalotti maintains Edgy, Dapper and Feisty packages of the emacs-unicode-2 branch. It is updated about once a week. The deb url is http://debs.peadrop.com/dists/edgy/backports/. More information on his blog

Some instruction here on how to generate nightly packages of CVS on Ubuntu Edgy.

Configuration

Your ./configure invocation should resemble the following:

  $ ./configure --with-gtk --enable-font-backend --with-xft

Note that selection of Xft fonts through the user interface is not yet working at the time of writing — presumably there’s a lot of X ilLogical Font Description code to be worked around. ;-) If your sources are older than 2007-04-16, then you can select Xft fonts on the command line, like this:

  $ emacs --enable-font-backend --font "Bitstream Vera Sans Mono-10"

Since 2007-04-16, the Xft fonts are enabled by default, so you need only use:

  $ emacs --font "Bitstream Vera Sans Mono-10"

The Xft backend can be turned off with the --disable-font-backend option.

Setting X resources appears to work as well:

  Emacs.font: Bitstream Vera Sans Mono-8

If you want to use bold font, use “Bitstream Vera Sans Mono-10:bold” or “Bitstream Vera Sans Mono-10:weight=bold”. You can even do it in .emacs

    (set-default-font "Bitstream Vera Sans Mono-14")
    (set-fontset-font (frame-parameter nil 'font)
      'han '("cwTeXHeiBold" . "unicode-bmp"))

Fixed problems

FreeBSD support

Use gmake rather than make to compile on FreeBSD.

UI widgets

By default the scrollbars use the toolkit that has been specified on the configure command line. Some distros might require special flags for this. For example, Gentoo requires a -toolkit-scroll-bars use flag to get a GTK scroll bar.

If you encounter a monochromatic toolbar, be sure to have libxpm dev-headers installed.

100% CPU usage

A solution to the 100% CPU usage is mentioned here: http://lists.gnu.org/archive/html/emacs-pretest-bug/2006-10/msg00016.html I applied the patch at http://cedet.cvs.sourceforge.net/cedet/cedet/semantic/semantic-idle.el?r1=1.34&r2=1.35 and now emacs-cvs-23 works fine.

Please update this section with further occurrences of this behaviour.

Font specification/quality

Fonts can be specified on the command line, in .Xresources or in .emacs. There was an issue with regression, see http://article.gmane.org/gmane.emacs.devel/58987 and http://permalink.gmane.org/gmane.emacs.pretest.bugs/14278

With the GTK UI, it is possible that settings are being picked up from somewhere in your environment, most likely gnome-settings-daemon, whereas urxvt and Emacs are not, and are using the default system-wide xft settings. Try setting the X resources Xft.dpi, Xft.hinting, Xft.hintstyle, etc., or fooling with settings in ~/.fonts.conf or system-wide settings in /etc/fonts/

There was a problem with some weight (bold) not being visible. Setting the X server colour depth to 24 seems to have resolved this problem.

If one frame uses the specified font but new frames don’t, add

    (add-to-list 'default-frame-alist '(font . "Bitstream Vera Sans Mono-10"))

to .emacs

If you’re having trouble with latin characters being displayed in a different font, try the following, which is mentioned in passing at the end of README.unicode:

    (set-fontset-font "fontset-default" 'latin '("arial" . "unicode-bmp"))

Memory leaks

The MEMFULL errors have been fixed in CVS.

Background colour

The problem where the area of the window not covered by text is grey (window background color) as reported here seems to have been a gtk-qt problem it is fixed. See this UbuntuForum post.

Indic font support

The support for Devanagari, Kannada, Hindi, Tamil and Malayalam are correct as far as I can see. There might be bugs in the font encodings. See SupportHindi.

Unfixed problems

Has anyone noticed that buttons (links) blink much more than in Emacs 22? For example in irc #emacs via erc, there are so many user name buttons that Emacs 23 is using quite a bit of CPU and the window flickers once in a while. I try to track down this bug, but I don’t know how to get more details for the developers to fix it. – Leo

I find a recipe to see the bug. “C-u 3 2 M-x hanoi” you can see the screen is acting weirdly.

Swedish input method acts weird for me in Emacs 23..i.e. you can enter all the latin characters, but the not the “funky” ones(å,ö,ä). Otherwise, great job!

July 12, 2007

All I get is square outlines, and aliased fonts otherwise (latest code on the branch as of today). libxft and libxft-dev are installed, ttf-bitstream-vera as well, current Debian Sid amd64. What are directions for troubleshooting and fixing? Is this branch going to be merged into trunk and part of an official release eventually? More than a year since this was started and there’s still no consumer ready binary package? Emacs is the last app on my desktop not using AA fonts, I am starting to notice.

August 31, 2007

I got it working for the most part, but the Italic and Bold Italic faces aren’t anti-aliased, even though they seem to be with the same font (see the screenshot below). Any ideas?

http://toshkov.org/tmp/emacs-fonts.png

Screenshots

XftGnuEmacs with auctex and preview-latex

http://photos1.blogger.com/blogger/3686/2030/1600/Screenshot-Emacs%3A%20gcmgarch.tex%20%28-home-gongyi-Archives-Documents-gcmgarch.tex%29.png

With some kanji

http://farm1.static.flickr.com/107/312993958_fb13a395f5_o.png