» Wednesday, 17 December A.D. 2008
emacs font idiocy
I upgraded to Ubuntu 8.10 and one of the joys that came with that is a new shiny hemorrhaging-edge Emacs. Apparently, somewhere between the last such version I was using (whatever came with Ubuntu 8.04 or so) and this one, fonts were radically overhauled in Emacs internals. I wouldn't mind this so much except that the Emacs developers apparently assumed that everybody has sailed boldly into the brave new world of whatever horrendous TrueType fonts can be found on your typical Linux system.
Not I, for I am a curmudgeonly geek, and use ProFont, a ISO8859-only bitmap font which comes in a restricted range of sizes. I restarted Emacs after installing the new packages (I only did this after getting weird errors about bytecode files, which I assume to be related to the fact that said bytecode files had been removed by the package manager during the course of the upgrade. I suppose it would be too much to ask that upgrades of currently running programs imply that said programs continue to work flawlessy after the upgrade. What is this, Windows?) and was greeted by errors about bad fonts that ended in “fontset-startup”.
Such an error message was greek to me, since I didn't actually ask Emacs to use such fonts and indeed such fonts didn't exist in the X font database. Of course, in this day and age, Google knows all, so I searched and found several bugreports related to my symptoms, several obscure mailing list posts from earlier this decade arguing about obscure technical details about multibyte font support in Emacs, and other miscellaneous bits. Google failed me. It attempted to redeem itself by gesturing at the fontsets node in the Emacs manual. I dare you to actually find useful information in that page or the other pages it relates to, such as the defining fontsets page following.
I attempted to comment out all relevant definitions of ProFont in my emacs startup files (note to self: Emacs now starts like a rusted Model A Ford if you don't byte-compile files), but Emacs was still mysteriously attempting to use this "-*-profont-*mumble*mumble*-fontset-startup" monstrosity even so. (No, I don't have anything defined in X resources! Sit down there, you in the back!)
Really, this whole thing needn't have been a big deal: Emacs was still perfectly usable except for one minor detail: creating new windows, whoops, sorry, frames was totally broken, as Emacs was apparently dependent on this fontset that it couldn't find for creating new frames. Why? You created an initial frame just fine despite these problems, why can't you create another one just like it? Have we heard of fallback code?
Anyway, after becoming slightly more desperate and starting to click though most every Google search result, instead of the ones that appeared relevant, I found this post, ostentatiously about turning off anti-aliasing on Emacs on OS X. So, for the record, if you are having problems with ProFont or any other old-style X font under Emacs and the mysterious "fontset-startup", you want to add something similar to the following to your init files (possibly before you define your faces and such):
(create-fontset-from-fontset-spec "-*-profont-medium-r-normal--12-*-*-*-*-*-fontset-startup, ascii:-nil-profont-medium-r-normal--12-120-72-72-c-60-iso8859-1, latin-iso8859-1:-nil-profont-medium-r-normal--12-120-72-72-c-60-iso8859-1" nil "profont")
So you apparently need a mapping to X fonts per character set, or something. Which makes sense, I suppose, but I would have been nice to spell that out a bit more explicitly somewhere. (Yes, I know that create-fontset-from-fontset-spec is documented on one of the aforementioned Emacs manual pages, and it almost looks like I might have been able to puzzle out what to do from the description. But this is a rant, I should have been in bed an hour ago, and it's my blog anyway, so go away.)
posted by Nate @ 11:54PM