19 Jun 2007

by Noel

Font Rendering Fun

I’ve always wondered why fonts looked different on OS X and Windows and thanks to this blog post I now know why. The summary is that Windows favours aligning the fonts with the pixel grid, which leads to clearer type but thinner blockier text. Follow the link to see examples of the difference.

More interesting are the various font rendering techniques in use. Microsoft’s ClearType takes advantage of the known arrangement of pixels in LCD monitors which effectively triples horizontal resolution at the expensive of distorting colour. FontFocus takes a different approach to get a better result. It again focuses on aligning fonts with the pixel grid. Here’s an explanation from the white paper linked above:

Previous grid-fitting techniques … improve contrast by aligning stems to pixel boundaries, but in doing so distort individual letterforms. FontFocus leaves the shapes of the glyphs completely unchanged. Instead, it shifts each character left or right by a tiny subpixel amount, and also subtly expands or condenses individual glyphs to align all stems, if there are more than one. …

While the idea of subtly shifting and stretching glyphs to enhance contrast is simple, the core of the of FontFocus technology is how it chooses these tweaks. Most existing font rendering techniques work with a single glyph at a time. FontFocus optimizes the entire word at a time. The results are similar to what you’d get from trying each combination of subpixel offset and width stretch for each glyph in the word, and picking the combination with the best overall score. FontFocus uses an intelligent divide-and-conquer algorithm to avoid the combinatorial explosion of this brute-force method.

This immediately suggests a further improvement: try to align a whole line of text optimally. Of course the search space gets much larger so a better search method is needed. If anyone is looking for a PhD this could be fun.

Posted in Design | Comments Off on Font Rendering Fun

Comments are closed.