FontFocus white paper

Introduction

Many people spend hours a day looking at text on their desktop, laptop, and handheld computer screens, fueling a demand for the highest possible quality text rendering.

There are three primary axes to evaluate text rendering quality: contrast of the glyph renderings, fidelity to the original forms, and evenness of spacing. Until now, font rendering implementors have had to make a difficult tradeoff between these goals. It's straightforward to render glyph shapes and spacing accurately if you can tolerate a loss of contrast, as exhibited by the font rendering in Mac OS X. Similarly, applying font hinting techniques originally developed for bilevel rendering can improve contrast significantly, but at the cost of significant distortion of letterforms.

This white paper introduces FontFocus, a new patent-pending technology from Artifex Software, Inc., the people behind the Ghostscript PDL engine. FontFocus, for the first time, renders text both with uncompromising fidelity, and with contrast improvements as good as the best of the font hinting techniques.


A Times 11 sample. FontFocus on the left, unhinted rendering on the right.

For details on this showing and others, see below.

How it works

FontFocus brings text into focus, analogous to the way that focussing a camera sharpens the image.

In a film (or digital) camera, the configuration of the optics creates a zone in which the target is "in focus", meaning imaged sharply on the film. Outside the zone, the target is still visible, but the detail has reduced contrast.

Digital rendering of text also has zones of focus and blurring, but based on subpixel alignment of stems, rather than on depth as in photography. A stem with good subpixel alignment is "in focus", while moving it by a half pixel places it out of focus.

It's easy to see this effect when looking at rendering without any hints or grid-fitting but with subpixel accuracy (similar to rendering in Mac OS X). Each glyph is rendered with an essentially random subpixel offset, derived from the total escapement of the glyphs to its left. In this blowup of a 9ppem Helvetica sample, the initial "i" and final "n" are out of focus, while their counterparts in the interior are in focus:

The goal of FontFocus is simple: with as little distortion as possible, to try to make the text render so that all the stems are in focus. The result is dramatically increased contrast:

Previous grid-fitting techniques also 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. In the example above, you can see that the 'm' is slightly expanded, so that all three stems align precisely with pixel boundaries.

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.

Showings

This section presents a number of showings of FontFocus. All samples are presented left-justified, without kerning. The text is from T.-J. Cobden-Sanderson's The Ideal Book or Book Beautiful, Doves Press, 1900.


FontFocus, Times, 11ppem, enlarged 2x with pixel replication.


Unhinted rendering, Times, 11ppem, enlarged 2x with pixel replication.

The unhinted rendering is essentially identical to that of Mac OS X. It is equivalent to rendering the text at very high resolution, with baselines aligned to device pixel resolution, then downsampling using simple area-coverage sampling, and finally applying a gamma of 1.15 (slight lightening).

Here's the same sample in a smaller sans serif font:


A Helvetica 9 sample, with and without FontFocus


FontFocus, Helvetica, 9ppem, enlarged 2x with pixel replication.


Unhinted rendering, Helvetica, 9ppem, enlarged 2x with pixel replication.

Advantages of FontFocus

Comparison to RGB subpixeling

RGB subpixel rendering techniques, such as Microsoft's ClearType, Adobe's CoolType, share similar goals to FontFocus.

Advantages of FontFocus over RGB subpixel rendering:

And, as the following samples clearly show, FontFocus renders text with both better fidelity and higher contrast than the leading implementation of RGB subpixelling, Microsoft's CoolType. For fair comparison, please view on an LCD display.


Left: FontFocus. Right: Microsoft Word with ClearType

Patents

The patent literature in the field of font rendering is quite dense. In particular, implementing an LCD subpixel technique is likely to run into existing patents from Microsoft, Adobe, and others. Here is a list, by no means intended to be complete.

Microsoft ClearType patents

6,597,360 Automatic optimization of the position of stems of text characters

6,577,291 Gray scale and color display methods and apparatus

6,377,262 Rendering sub-pixel precision characters having widths compatible with pixel precision characters

6,356,278 Methods and systems for asymmeteric supersampling rasterization of image data

6,342,890 Methods, apparatus, and data structures for accessing sub-pixel data having left side bearing information

Other patents covering hinting

6,563,502 Device dependent rendering