|
|
Log in / Subscribe / Register

Variations fonts and OpenType 1.8

By Nathan Willis
September 21, 2016

ATypI

The first day of the 2016 ATypI conference was marked by the release of a major update to the OpenType font format. A panel of speakers representing the major players in font technology over the past several decades announced the update together. Although there are several changes under the hood, the key new feature is the ability for a single font file to encode sets of delta values that programs can use to automatically interpolate changes in font weight, width, and other features, each throughout a continuous range. When software support is fully rolled out, that will all but eliminate the need to distribute font families as collections of individual font files, as well as removing many longstanding assumptions about font usage.

Variations

Peter Constable from Microsoft started the session off, noting that the results being presented were a year in the making, based on [Peter Constable] discussions held at ATypI last year. But, he added, "there is nothing new under the sun." Most of the ideas encapsulated in the new revision have existed in other forms for quite some time.

A variations font (or, alternatively, variable font) is a single font file that can behave like multiple fonts. At runtime, any combination of settings on a continuous variation range (requested by the user or by software) can be used. Variations fonts can have multiple axes of variation (such as weight, width, and slant). There are no intrinsic limits to how many variation axes a font can provide, and there is no need for any particular glyph to be altered by every axis. For example, an "optical size" axis might be expected to increase the relative heights of lower-case glyphs with respect to the upper-case glyphs, but leave the punctuation unaltered.

The variations can affect not just glyph outlines, but font metrics, too: widths, font-wide ascent and descent values, left and right side bearings, horizontal and vertical kerning, and so on. Variations can also affect OpenType layout rules—for instance, by substituting simpler versions of a glyph at small optical sizes or at extremely heavy weights, or by adjusting the positioning rules used in complex scripts like Indic and Arabic. Furthermore, the variation data is stored in a set of newly defined tables, leaving the basic table set untouched. That means that any program incapable of reading the variation data will still see a valid font—just one that has only the default glyph shapes and metrics.

The new format is designed to be compact, Constable said. In [Variation axes] tests, a two-axis variations font that would be suitable to replace a family of ten traditional instance fonts took up just 30% of the size. Ultimately, the savings could be slightly better than that, he said, but the test font had not yet implemented hinting. This means smaller file sizes for operating systems, embedding in documents, and delivering over the web.

Constable also noted that the new 1.8 specification was an example of cross-industry collaboration. Much of the groundwork now implemented in the OpenType variations font specification comes from ideas implemented in the 1990s in Apple's TrueType GX. In 2015, Microsoft noticed the increasing interest in variable font techniques (such as the responsive typography trend) and reached out to Apple to discuss the matter. Little did they know at that time that Google and Adobe were also discussing the idea but, within a few months, all of the players got together and began working in earnest on the revision.

One benefit of that approach is that the new revision supports all of the various flavors of OpenType, including the TrueType flavor preferred by Microsoft and the Compact Font Format (CFF) flavor initiated by Adobe. Just as importantly, the specification defines not just the data structures used in the files, but the algorithms used to interpret them. So how the values in a font instance are derived from the base font and the variations tables is precisely defined, meaning that there should be no ambiguity in how they are interpreted. This was an issue with TrueType GX, Constable noted: GX fonts could specify their own range of possible weight values, but how Apple chose to interpret that range was not specified. In the OpenType 1.8 implementation, by contrast, weights and the ranges on all other axes must first be normalized to the interval [-1,1] before any interpolation is done.

Axes and instances

Apple's Ned Holbrook spoke next, delving a bit further into the specifics. Each axis of variation in a particular variations font has to be declared with a default, minimum, and maximum value. The axes [Ned Holbrook] are specified in a table named fvar. Five axes are predefined in the specification: weight, width, slant, italics (as distinct from slant), and optical size. If more axes prove generally useful, they can be added to the predefined list. In the meantime, designers can create and name any axes they wish to—say, stroke contrast.

The font's basic glyph, metric, and layout numbers (in the existing tables, that is) correspond to the default setting. In font-interpolation terms, each variation design included in the font file is called a "master." For each master, the font will include a set of delta values relative to the default. So, for each glyph outline that changes, there will be the default outlines as in a regular font, which are defined by a set of Bézier curve points. Then, for each master, a separate table would include a set of (delta X, delta Y) values, each of which corresponds to the adjustments made to one of the Bézier curve points. In OpenType fonts that use TrueType curves, the name of this variations table is gvar; in CFF-based OpenType fonts, the table is named CFF2.

The generic case used in most examples is a font with two variation axes: weight and width. That provides a two-dimensional [-1,1] space through which the proportions of the font can be varied. The "regular" version of the font would typically be at the origin, [0,0], and the font would include a set of deltas for the four corners: [1,1], [1,-1], [-1,-1], and [-1,1]. Those corners correspond to "maximum weight, maximum width," "maximum weight, minimum width," and so on.

So there are, in essence, five versions of the font encoded into the file. But the real benefit of the format is that a new font instance can be generated by interpolating between the masters provided, enabling a new instance to be created at runtime based only on a (weight, width) tuple requested by the user or software.

Naturally, the existence of that many possible variations can present a challenge for fitting information into the traditional font menu—at least for non-graphic-design apps like word processors. The solution, Holbrook [Variations deltas] explained, is that variations font files can also include a set of "named instances" that include a traditional font name (e.g., Source Sans Extra Bold) and its associated tuples for the relevant variation axes. The system can choose to present only these options to the user, simplifying usage.

Looking a bit beyond the generic case, Holbrook explained that a font does not have to declare [0,0] to be its default instance (nor [0,0,0] for a three-axis font, and so on), nor does it have to set its masters at 1 and -1. If the designer chooses to make a font that only covers a small range of weights, for example, that is perfectly acceptable.

There is also a mechanism available to specify more complicated interpolation. By default, the interpolation between any two master designs is linear. But the font can include an optional avar table that specifies a scaling factor to use between specific masters. By including several such scaling regions, one can approximate non-linear interpolation if desired.

Metrics and details

Next, Google's Behdad Esfahbod discussed how interpolation between masters can affect things other than the glyph outlines. Essentially, [Behdad Esfahbod] any data in the font can be interpolated between masters. As is the case with the Bézier points that make up glyph outlines, changes relative to the default font instance are stored in new tables. Deltas to changes in font-wide metrics are stored in the MVAR table, changes to horizontal metrics in HVAR, vertical metrics in VVAR, and hinting in cvar.

Fonts may also need to vary positioning data, Esfahbod said, such as the attachment points used for diacritics or for glyphs in connected scripts. Glyph substitution rules can also change between masters; for example, in extra-bold weights the designer might wish to swap in a simplified version of a glyph (in comparison to the default) simply to prevent that glyph from turning into a difficult-to-read black blob. Unlike the other kinds of variation data discussed, these positioning and substitution changes are encoded in an existing table, GDEF, but in a new subtable called Item Variation Store.

Constable then spoke briefly about hinting. Hinting data, he said, consists mainly of rules that define relationships between different outline points (such as defining two points as belonging to the same stem) or between an outline point and a font metric (such as defining that a point belongs on the base line). Because those relationships do not usually change, interpolating the hinting between two masters is a relatively simple affair, affecting only some key values that are stored in the control value table (CVT). Hints for masters in a variations font can thus be generated almost automatically (although manual review remains a good idea); in the new revision, any such changes are encoded in the new cvar table.

Finally, Adobe's David Lemon spoke about the new CFF2 table, which encodes the glyph-variation deltas for CFF fonts. The original CFF table, he said, was created for PostScript [David Lemon] Type 1 fonts, and was grafted into OpenType after the fact. Thus, while its name ("Compact Font Format") belies its original intent, the table format actually includes quite a few redundancies usually found elsewhere in an OpenType file.

20 years later, he said, CFF is only used in OpenType. So the changes in OpenType 1.8 presented Adobe with a chance to do a little "housecleaning" of the format. CFF2 drops the redundant fields, further compacts internal data representations, and makes other improvements—in addition to supporting variations fonts. Among the other notable changes is that the new table format deprecates the rather unloved CID encoding originally developed for Chinese, Japanese, and Korean fonts.

Adobe contributed a CFF2 parser and rasterizer to FreeType, and is on schedule to update its font-building tools to support the new format by the end of September.

There were several other changes made in the new revision of the OpenType specification—Constable mentioned, for example, the MERG table, which lets fonts indicate to the text renderer that certain composite glyphs (e.g., a letter with an attached diacritic) should be cached after they are rendered, not before as is the default. That will prevent rendering glitches seen when the base character exists in the renderer's cache but the diacritic does not. The format now also fully supports all of the chromatic font approaches proposed by various players in recent years.

But variations fonts are by far the biggest change; in fact, Constable called it the largest change to OpenType since the format's inception. Considerable work remains to be done before end users can reap all of the benefits of the new format, but there are plenty of places where improvements will be noticed. Smaller file sizes will benefit distributors and network services, fully adjustable fonts will benefit layout tools and publishers, and more flexibility in fonts will, hopefully, benefit end users.

Index entries for this article
ConferenceATypI/2016


to post comments

Variations fonts and OpenType 1.8

Posted Sep 22, 2016 4:09 UTC (Thu) by fratti (subscriber, #105722) [Link] (1 responses)

I can also see the variations come in handy for fonts that are a little more playful. Think of Horror-themed fonts with blood-like liquid smears running downwards, the length and shape of those could be controlled through this mechanism.

Same goes for fonts where we want to approximate a rough "scratched into a plank of wood" look, that way one could not just vary how bold the font is, but also the lengths and thicknesses of the scratches.

Variations fonts and OpenType 1.8

Posted Sep 22, 2016 8:11 UTC (Thu) by Cyberax (✭ supporter ✭, #52523) [Link]

Personally, I want true English (and Russian) cursive fonts with proper connections between symbols, and not a half-assed obviously fixed letter fonts.

Variations fonts and OpenType 1.8

Posted Sep 23, 2016 14:35 UTC (Fri) by anton (subscriber, #25547) [Link] (2 responses)

I wonder how variation fonts relate to the idea of Metafonts; sounds similar to me. However, in IIRC his book "Digital Typography" Knuth writes that font designers did not pick up the idea of Metafonts, and instead designed variations as sets of fonts. So what has changed? Have font designers finally accepted the idea of variations, or was the problem with Metafont the textual specification (rather than something more WYSIWYG) of metafonts? But are variations really compatible with WYSIWIG?

Variations fonts and OpenType 1.8

Posted Sep 26, 2016 9:52 UTC (Mon) by n8willis (subscriber, #43041) [Link]

There's not really a connection. Metafont supported variate-able parameters, but as the variables in a parametric equation. The differences between Metafont and outline fonts are too great in other respects.

Font designers have been interested in variations for quite a long time; they have simply distributed them as sets of individual font files. In recent years a lot of work has been done on the font-editor side of things to make creating interpolatable masters easier and to make generating instances from those masters more reliable, too. In a sense, the variations-font work is a straight extension of that trend, moving it from a build-time process to a run-time process.

Nate

Variations fonts and OpenType 1.8

Posted Sep 26, 2016 11:51 UTC (Mon) by anselm (subscriber, #2796) [Link]

The main problems with METAFONT are that (a) it was ahead of its time by 50 years or so, and (b) type designers have apparently not bought in any great way into the idea of designing fonts by coming up with equations for the computer to solve rather than drawing stuff – something which a genius-level computer scientist like Donald E. Knuth would take in his stride but there aren't too many of those around who are also into typeface design. METAFONT gives us a great way of generating font variations by twiddling mathematical parameters that are built into the font design, but the problem is to come up with font designs that incorporate the right parameters to twiddle such that twiddling them leads to useful results. Knuth's Computer Modern fonts are quite interesting in that respect, and there have been a few more experiments in that area, but for the most part the idea hasn't caught on.

In practical terms, the difference between METAFONT and the type rendering systems we use today is that METAFONT is based on “pens” on the design side and pixels on the output side (a consequence of Knuth's mathematical acumen and early-1980s technology, respectively) , while today's systems are based on scalable outlines at both ends. In effect, METAFONT produces pixel-based representations of glyphs at “compile time” while OpenType and friends do it at “run time” (i.e., when stuff is being displayed). This has various ramifications for things that are reasonable to do with either systems such that we end up with basically different worlds.


Copyright © 2016, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds