Mon, 06 Sep 2004

Building a tool [21:29]

I'm thinking on doing some more work on the FreeType font hinting code sometime soon, so I've spent some time the last few weekends building a program to view hinted outlines. The way that hinting fonts for the screen works is that the outline is modified to better fit the grid of pixels, then the modified outline is scan-converted. My program allows looking at a magnified version of the modified outline and comparing it to the resulting pixels.

Hinting viewer screenshot

As you might guess from the spiffy, antialiased, alpha-blended graphics, I'm using Cairo to do the main drawing. It's been a lot of fun to write a very small, limited purpose application and really nail the details. To list a few:

I was suprised by how well saving the entire application state to GConf worked. There is no separation between preferences and transient state. You can just exit the viewer at any time and bring it up and it remembers where you were. This clearly isn't the right model for most applications, but I wonder if there are places in the GNOME desktop where idea could be effectively applied; perhaps desk accessories like gcalctool, gconf-editor, and gucharmap should work like that. For the viewer, the code flow for interacting with GConf is a little unusual; instead of monitoring GConf actively as the "model" of the application, the viewer simply initializes from GConf on startup and saves changes to GConf as they happen. This allows having multiple viewers usefully running at once.