An adventure in Unicode PC fonts
Posted by drow on the 25th of October, 2007 at 1:47 pm under tech. This post has 3 comments.I have always had some trouble with my eyes. One bizarre side effect of this is that switching fonts is very unpleasant. I recently got fed up with fighting things to live in the stone age of pre-Unicode fonts and locales and started hunting for a new console font. First I looked for nice new ones already designed for Unicode, with a selection of accented characters and so forth. The nicest I found was Terminus, but I’ve had trouble adjusting to it. So eventually I decided to stick with the font I’d been using - at least for now.
I have been using the same font for my consoles since before 1997. This is, or at least was, the default Linux console font back when I did all my work on a VT on Linux/PPC: /usr/share/consolefonts/default8x16.psf.gz. When I started using X routinely I missed it quite a lot. Mostly that was because I used BitchX, and BitchX is written for an IBM437 code page set of line drawing characters. So I opened up that console font in xmbdfed and converted it to a PCF file. If you have Debian’s BitchX package installed, you’ve got a copy of this work in /usr/share/fonts/X11/misc/default8x16.pcf.gz.
So I’ve done the same trick again. Here’s the steps I followed:
- Open the PCF font file in FontForge.
- Choose Add Enconding Name… from the Encoding menu.
- Enter IBM437, which is the iconv name for the traditional PC ROM character set.
- Choose Force Encoding and select IBM437.
- Choose Reencode and select ISO 10646 (BMP).
- Choose Generate Fonts… and save it as a BDF file, since PCF wasn’t an option.
- Create a fonts.dir file by running mkfontdir.
- Add the directory to the font path using xset +fp.
- Attempt to start an xterm.
Actually, after all that I was having trouble with the font’s name and eventually getting scary resource errors from X. I opened the font in gbdfed and saved it, which added some attributes and modified the bitmaps. Then I tried again and it worked.
And now, I can use a UTF-8 locale and gcc’s error messages come out with `foo’ (”angled” quotes) instead of display corruption!
The resulting font is uni8×16, if anyone else would like it. I have switched to using it for all my terminals other than the one I run BitchX in; BitchX still needs the IBM437 version in order to display correctly.
Of course, as soon as I finished this Paul Brook informed me that Konsole includes basically the same sort of font. I do not know the origins of KDE’s console8×16, but I do know that it’s a slightly different font (the @ has a smaller center, for example). And I know that I’m mighty annoyed it didn’t get added to my font path correctly when I installed konsole ages ago, since I might otherwise have found it!
Submit Comment