hacks

Ligature (ab)use

March 25th, 2011  |  Tags: , ,  |  Leave a comment

Even people who don’t care about typography probably recognize ligatures, or special glyphs that can represent the combination of two or more letters. Most commonly, these are used to make unsightly glyph combinations like these:

Ligatures before

look less awkward:

Ligatures after

In the bad old days of computer typesetting, getting ligatures to print involved some degree of manual effort and suffering, depending on what applications and typefaces you were using. However, now we have OpenType fonts, which can specify that the rendering engine should automatically select particular glyphs for sequences of characters, thus bringing WYSIWYG typesetting in the 21st century roughly up to par with where TeX was in the early 1980s.1

Delightfully, digital font designers have taken full advantage of these capabilities, offering faces like Typodermic’s Owned, which uses a wide range of contextual-alternate glyphs to mimic felt-tip graffiti, or like Alphabet Soup’s Metroscript, in which ligatures can both provide natural-looking lettering and convert sequences of underscores to tails like you might see in sports-team logos:

Metroscript

Certainly, these take automatic ligature replacement far beyond simply replacing common sequences of glyphs with more attractive alternates. But one of the most amazing applications of OpenType’s ligature technology I’ve seen is Travis Kochel’s Chartwell, which converts a sequence of numbers separated by plus signs into bar charts, pie charts, and sparkline graphs. For example:

Pie chart

In the image above, the two sides of the equals sign have the same text — but on the right, ligature replacement is enabled, and on the left it is not! Because the raw numbers remain in either case, Chartwell essentially supplies simple, flexible charting capabilities to any application that can render OpenType fonts: you can turn ligature replacement off, edit, recolor, and rearrange your data and then turn ligature replacement back on. It’s an extremely clever hack, but one that is also likely to be useful in a lot of domains.

1 TeX and LaTeX have always had decent support for automatically applying common ligatures (e.g. “fl” and “fi”). But LaTeX hackers also developed more involved applications, like automatically generating Cyrillic text from a Latin transliteration (!)