Posted by Miguel Sousa
.otf file extension) and TrueType (
.ttf file extension*) are the two modern font formats available for desktop usage today. Despite being distinct formats, OT/CFF and TT fonts actually have a lot in common. They are distinguished primarily by their different outline formats and the contrasting approaches employed to rasterize those outlines.
The glyph outlines in OT/CFF fonts are made of cubic Bézier paths whereas in TT fonts they’re made of quadratic Béziers.
I would say that the majority of type designers prefers to use cubic Béziers because they’re easier to manipulate and are able to represent a wide variety of curves with fewer points than quadratic Béziers. Many of the designs available in TrueType format may actually have started their life as PostScript outlines — type lingo for cubic Béziers — and were converted at some point in the process. This conversion, if not done properly, may result in distortions to the outlines.
While the qualities mentioned above may give a bit of an edge to OpenType/CFF, I’m certain that they won’t persuade everyone. But what if I tell you that on average OT/CFF font files are 20% to 50% smaller than comparable TrueType fonts? Does that grab your attention? Sure, you can still think it’s not that important. After all, modern hard drives are big enough and font files are actually some of the smallest assets in a project, especially when compared to print-resolution images, video files or even the artwork files themselves.
Nevertheless, you’ll have to agree that smaller font files are surely desired for fonts used in web pages, fonts used in resource-limited devices, or a combination of both: fonts delivered to and displayed by portable devices. And if you think about CJK (Chinese, Japanese, Korean) fonts which contain tens of thousands of glyphs and files ranging around 5–10 MB, size considerations become quickly obvious.
So what makes OT/CFF fonts smaller? One of the reasons lies in the compact way in which the outlines are stored. For those of you unfamiliar with the term, CFF stands for Compact Font Format (PDF file) and the compactness of a CFF font is in part achieved via a technique called subroutinization, which is performed when the font file is generated. Subroutinization is a process that surveys all the glyphs in the font looking for path segments that are identical and thus can be replaced by a shared routine/command. The more regularized the glyphs are, the more compact the font will be. The TrueType format also has a mechanism that allows turning a given glyph into a component which can then be reused by other glyphs — think of the glyph representing the letter A being reused in the glyph for the letter Á (A with acute accent). This method will also decrease the font file size, but the reduction is not as significative as with subroutinization.
The other reason why OT/CFF fonts are smaller has to do with the much reduced hinting information contained in them (compared to TrueType fonts) — which brings me to the second benefit. Hints are parameters and/or instructions that are put in fonts for the purpose of helping the rasterizer — the program that converts the vector outlines into groups of pixels or dots — make better decisions about how to fit a scalable outline onto a fixed grid.
When it comes to hinting, the two font formats have opposite approaches. In broad terms, in TrueType the hinting “intelligence” resides in each font, whereas in OpenType/CFF the intelligence is mainly in the rasterizer. This means that TT fonts can contain very detailed instructions that specify, down to individual pixels, the way each glyph should render; the rasterizer thus becomes a “dumb” interpreter that simply processes those orders. On the other hand, the hints in OT/CFF fonts only provide general information about the font and about the main features of each glyph; it’s then up to the rasterizer to render everything the best way it can. Obviously, each approach has it’s pros and cons. While in TrueType one can have great control over the rasterization, that comes at a very high price; adding good hints to a TT font is a laborious task that requires a great amount of expertise and many years of experience. In contrast, hinting a OT/CFF font takes less that one tenth of the time and requires only a fraction of the knowledge. Having the intelligence in the rasterizer also has the advantage that when it gets improved, all the fonts benefit from it, without the need of being updated.
It is true that the type of hinting allowed by the OT/CFF format provides only limited control which may not be suitable for some kinds of applications and devices. But if you consider that the pixel-density of a growing number of screens is on the rise, and that some environments such as Mac OS X and iOS disregard font hints — TT and OT/CFF alike — investing significantly in hinting may turn out to be a not-so-great bet.
In sum, the two main benefits OpenType/CFF fonts have over TrueType fonts are 1) their smaller file size, and that 2) they require far less hinting information in order to render well in environments that allow some form of anti-aliasing.
Considering these advantages and with all other things being equal, some may ask: why isn’t the OT/CFF format as popular, as widespread and as well-supported as TrueType, even in environments that would benefit from them? I can point out several reasons. For one, the TrueType format has been around for much longer than OpenType; it debuted in the late 1980s while the first OT/CFF fonts were released roughly ten years later. The second reason is perhaps related to legacy display modes: on an aliased environment, TrueType is able to deliver a superior solution — due to to its hints and ability to leverage handmade bitmaps — that OpenType/CFF would have a hard time matching. And lastly, historical reasons: despite supporting OT/CFF, the two major desktop platforms, Windows and Mac OS, are largely invested in TrueType and when it comes to testing fonts in their apps and OS, OpenType/CFF hardly registers on the radar.
The rise of DirectWrite will definitely contribute to making OT/CFF fonts first-class citizens on Windows. And given Adobe’s commitment to open-source, I’m hopeful that support for OpenType/CFF on emerging platforms such as Android will not face the shortcomings of the past.
* Although they can actually use an
.otf extension as well.