I’m a fan of Proggy Programming Fonts for terminal use. But they don’t work out of the box on my Ubuntu machine.
The reason seems to have something to do with my display’s DPI setting, in combination with the fact that the TTF versions of these fonts are not real embedded bitmap fonts.
Actually, let me backup. The website linked above actually advertises three versions of each fonts: the windows bitmap font (.fon), the truetype file (.ttf), and a bitmap fonts for X (.pcf). Now normally, gtk+freetype+fontconfig is supposed to be able to pick up the .pcf file out of your ~/.fonts
directory, but for some reason this doesn’t work in Edgy.
Because of this, I resorted to trying to use the ttf version, but every gnome app I tried insisted on scaling the result. Because this font is unhinted, it looks terrible at any resolution other than the one it was intended for. Usually these types of fonts are done as a true type font with embedded bitmaps, but for some reason, the authors of this font decided to create outlines that approximated a bitmap font. If you open up the font in a fontforge and then view a scaled version, you’ll see that each glyph is a series of vectorized squares that match the original pixels.
I can’t imagine why they did this, but because of this, now my apps think its a regular scalable font. Worse yet, because my display DPI doesn’t match some multiple of what is encoded in the font, it’s impossible for me to specify the exact size (in points) that will make this font look right.
It was time to remind myself how to use fontconfig. I spent a lot of time realizing that the location of the user-specific font configuration file is ~/.fonts.conf
and not ~/.fonts/.fonts.conf
. But anyways, once that was figured out, the required bit is actually pretty small:
<fontconfig> <match target="font"> <test name="family"> <string>ProggyCleanTTSZ</string> </test> <edit name="pixelsize"> <double>16</double> </edit> <edit name="antialias"> <bool>false</bool> </edit> <edit name="hinting"> <bool>false</bool> </edit> </match> </fontconfig>
In layman speak, that’s roughly: “If ProggyCleanTTSZ is returned as a query for a font, make sure its rendered with pixel size 16, and no antialiasing and no hinting.” This forces every app that uses fontconfig to always render this font at pixel size 16 (which I determined was the intended size, after a little experimenting)