|
|
Subscribe / Log in / New account

Chromatic fonts are coming

LWN.net needs you!

Without subscribers, LWN would simply not exist. Please consider signing up for a subscription and helping to keep LWN publishing.

By Nathan Willis
August 28, 2013

TypeCon 2013

Outline fonts historically define their constituent glyphs with just two "colors": the foreground color inside the character's contours, and the background color that lies everywhere else. On a generic document, those colors usually equate to black and white, although both can be assigned to other colors in virtually every application. But this situation is misleading; when applied to digital fonts, the term historically only takes one back a few decades. Typefaces in other media have existed for centuries, and were never restricted to black and white. So it should come as no surprise that there is a push to adapt digital font formats to natively support multiple colors. At TypeCon 2013 in Portland, there were in fact two competing proposals under discussion: one advocated by Microsoft, and one backed by Adobe and Mozilla.

In graphic design circles, the term "chromatic fonts" is used to describe fonts built to support multiple colors. Today, chromatic fonts are generally incorporated into designs by taking a set of fonts with complementary shapes and layering them in software, one color per layer. A good example would be the HWT American Chromatic system from Hamilton Wood Type, a digitized font family based on 19th Century woodblocks. The different layers would be combined in layout software, such as Adobe InDesign, Photoshop, or Inkscape. For the web, there are other approaches, such as Colorfont.js, which we looked at in 2012. But even with software support, layering and aligning blocks of text in multiple fonts is tedious and error-prone. It would be simpler if the font could support regions of different colors out of the box.

There is, however, a use case for multi-color glyph support in fonts that is completely unrelated to multi-color type as graphic designers use, which is what leads to the two competing proposals. The second use case is emoji, the character-sized pictographs popular in text messages and online chat applications. While emoji are relatively popular everywhere, as Microsoft's Michelle Perham explained in her TypeCon talk, they are a far bigger deal in Japan, where they originated with mobile phone operator NTT DoCoMo. DoCoMo and its two largest competitors in Japan, KDDI and SoftBank, standardized on a common set of emoji in the mid-2000s.

While the standard was originally only used in Japan, it was accepted into the Unicode 6.0 specification in 2010, incorporating 722 symbols. The standard emoji set has since spread to many other mobile and Internet platforms, with one of the most notable being Apple's iOS. iOS 5 was the first Apple release to support emoji in every region of the globe, but iOS 6 took things a step further in late 2012 by rendering the emoji glyphs in multiple colors. As would be expected, this proved to be a big hit among the demographics that care about emoji, and, in June, Microsoft announced at one of its developer events that Windows 8.1 would feature color emoji, too.

My emoji

However, while Apple's color emoji implementation was a custom iOS-only solution, Perham said, Microsoft decided instead to implement its color support by adding a set of extensions to the OpenType font format. OpenType already supports a large set of extensions through the use of "feature" tags, which are text tables that usually describe character-matching expressions, substitution rules, spacing adjustments, and so on.

Microsoft's new tags operate a bit differently from the most common OpenType tags. The first is called colr (following the convention of four-letter-or-less tag names). The base emoji glyph is a black-and-white outline character as it is in existing fonts; a colr table is attached to it, which contains a list of additional glyphs, one for each color used, along with an indexed color value for each glyph (these indexes are mapped to colors in another structure, discussed below). The list also indicates the z-order in which the color glyphs are meant to be stacked. If the device or application wants to display the color version of the character, it just looks up the components in the colr table and composites them together. If it does not care about color, it can use the black-and-white base glyph like normal.

The actual color that each of the components should be rendered in is listed in the second addition to OpenType, the cpal (for "color palette") table. The cpal table encodes a color palette as a list of RGBA values. The table must include one such palette (palette number 0), but it can offer alternate palettes as well, leaving it up to the software how best to expose the palette options to the user. Perham pointed out that Apple's color emoji font took a great deal of criticism by rendering all of the human face emoji in decidedly Caucasian-looking colors; supporting multiple palettes offers a relatively simple and space-efficient fix.

At the moment, Perham said, creating these color fonts is a manual process, since no font editing software supports the new tables or rendering in color. But Microsoft is moving forward with the fonts for Windows 8.1, and believes the system is flexible enough to be used for other multi-color symbols or for general typographic usage. Currently, Microsoft's proposal is under discussion on the mpeg-OTspec mailing list; one must join the list to read the messages or the posted files (including the specification), but joining is not restricted or moderated. Microsoft has also announced its intention to formally submit the proposal for standardization by the ISO, which maintains OpenType as ISO/IEC 14496-22.

SVG

While Microsoft's solution is sure to reach users in short order, it is not the only proposed system for adding color glyph support to OpenType. There is one competing extension that can also be tested today: the SVG glyphs for OpenType proposal, which is being developed by a World Wide Web Consortium (W3C) community group with most of the input coming from Adobe and Mozilla. Mozilla and Adobe had each drafted its own proposal, but the two were merged into a single draft specification in July 2013.

The draft adds a single table to OpenType named svg. This table can contain any number of SVG objects, and an index that associates each object with a glyph encoding slot in the font. In that sense, it differs considerably from Microsoft's specification, because it references a completely different data type for the "color version" of each supported glyph. There is also a color-palettes subtable, which lists one or more sets of RGBA colors that can be used to draw the SVG elements.

Just before TypeCon, Mozilla's Robert O'Callahan posted an update on the draft proposal. O'Callahan has added support for SVG-in-OpenType fonts to his personal builds of Firefox, and has also made a web application to add SVG support to existing OpenType font files.

The most frequently-cited advantage of the SVG-based approach is that, by adopting an existing and well-known standard for the color elements, OpenType avoids defining yet another graphics format. The software stack would have to be modified in order to render the SVG glyphs, but it could simply hand that duty off to the system's existing SVG renderer. In comparison, the Microsoft colr approach would require modification to the text rendering process as well, but with entirely new code.

In addition, although at the moment the emphasis of both proposals is on relatively simple, flat-color rendering, the SVG proposal can also include other design features that would be of appeal to graphic designers, such as color gradients, without further alteration. It can also incorporate animated elements, which seems to be regarded by many as the next step in the "evolution" of emoji. The principal drawback, of course, is that SVG itself is a large and complex standard. Incorporating SVG in OpenType fonts would by necessity require defining a "safe" subset of SVG to support; no one is keen on the notion of embedding streaming video elements into font glyphs.

Or at least no one seems interested in such a feature today.

The future

The reality on the ground, though, is that no one is quite sure what type designers will come up with when creating chromatic fonts with either proposal. Gradients, of course, seem like a natural fit; one can already see graphic designers applying gradient effects to plenty of typefaces on the web and in print, and it is a clear analog to the effects that can be produced with ink and a letterpress. Animation is not quite as easy to predict; it is simple to imagine terrible eyesores created with animated fonts, but then again one can already design terrible eyesores with any number of existing web standards today.

Both proposals have a long road ahead before making it into a standard. Microsoft, of course, is marching ahead with its own implementation in the meantime. The SVG-glyphs-for-OpenType group held a meeting during TypeCon (which I did not attend); there is more discussion scheduled for the coming weeks and months. As a practical matter, what the industry's type designers and graphic designers find more useful is ultimately what matters the most, but it could still be many years before chromatic fonts become widespread. On Sunday, type designer Crystian Cruz gave a presentation showcasing many of the advanced effects that are already possible with OpenType's existing features—including randomization, contextual substitutions, and character forms that adapt to fit the available space. But the majority of these features are rarely, if ever, employed by existing fonts, and they have scant support in software. Whether the popularity of emoji is enough to spark a larger revolution in chromatic fonts remains to be seen.

Index entries for this article
ConferenceTypeCon/2013


to post comments

Chromatic fonts are coming

Posted Aug 29, 2013 2:24 UTC (Thu) by roc (subscriber, #30627) [Link]

Pretty good writeup, thanks.

It's worth pointing out that the Mozilla SVG-in-OpenType proposal has been shipping in Firefox releases for about a year, albeit behind an about:config flag and disabled by default so as not to preempt the standards process. Unfortunately Microsoft doesn't seem to be following the same protocol.

I've just updated Firefox nightly to the merged Adobe-Mozilla proposal. Animation support should land very soon.

I think "Both proposals have a long road ahead before making it into a standard" is probably an exaggeration. It's quite likely that both the Microsoft and Adobe-Mozilla proposals will be approved by ISO before long.

Chromatic fonts are coming

Posted Aug 29, 2013 3:39 UTC (Thu) by zenaan (guest, #3778) [Link] (1 responses)

> no one is keen on the notion of embedding streaming video elements into font glyphs

Awww c'mon, surely it's the future? Or perhaps an X86VM (Javascript is just too limiting IMNSHO) ... that could increase the performance of the video renderer..

Chromatic fonts are coming

Posted Aug 29, 2013 10:53 UTC (Thu) by k3ninho (subscriber, #50375) [Link]

This quote is my 'underachievers of the week'.

Chromatic fonts are coming

Posted Aug 29, 2013 4:34 UTC (Thu) by foom (subscriber, #14868) [Link] (1 responses)

There's another proposal [1] by Google, as well, which I guess wasn't at TypeCon. This is a solution for including color bitmapped data, not outline data. It's already implemented in freetype [2].

Note also that Apple's Color Emoji font is also an extension to the font format, and is actually present on both MacOS and iOS. And, while they never published the format ("sbix"), it was quickly reverse-engineered. Freetype has recently had code added for rendering it, as well [3]. Apple's undocumented thing is basically the same as the Google proposal -- PNG images per glyph, in multiple sizes -- it's basically just a difference in how it's spelled.

As for MS's proposal, I'm sure that color layered fonts are much more useful than bitmaps for a "real" font, but since it seems as if the only reason people even care about this now is for Emoji fonts, I don't much see the point. Bitmaps are almost certainly more useful for making nice-looking emoji fonts than single-color layers, so I'm surprised that MS is proposing a layered font as a solution for the emoji use-case. I mean, look at the existing emoji fonts, they're all full of things like gradients and large numbers of colors.

And SVG...wow. I mean, it sounds cool, but embedding an svg interpreter into font renderers doesn't seem likely to be an easy undertaking.

I guess it's just not sexy enough to embed a png image and be done with it. Too easy. :)

[1] http://google-opensource.blogspot.com/2013/05/open-standa...
[2] http://git.savannah.gnu.org/cgit/freetype/freetype2.git/c...
[3] http://git.savannah.gnu.org/cgit/freetype/freetype2.git/l...

Chromatic fonts are coming

Posted Aug 29, 2013 12:21 UTC (Thu) by hummassa (guest, #307) [Link]

> I guess it's just not sexy enough to embed a png image and be done with it. Too easy. :)

The VG in SVG stands for "vector graphics" and bitmapped fonts are soooo 1980... ;)

Aren't these icons?

Posted Aug 29, 2013 4:47 UTC (Thu) by ncm (guest, #165) [Link] (3 responses)

I'm having trouble identifying a difference between "chromatic font" glyphs and "icons". Once we get the proper support for chromatic fonts, maybe the whole raft of icon apparatus can be pitched over the side. To repurpose icon infrastructure to render chromatic fonts would surely lead to madness.

Aren't these icons?

Posted Aug 29, 2013 7:04 UTC (Thu) by Karellen (subscriber, #67644) [Link] (2 responses)

Excellent point.

The one thing that does occur to me is that a "chromatic font glyph" must be assigned to one (or more) unicode code points, whereas an "icon" never can be.

Aren't these icons?

Posted Aug 29, 2013 16:14 UTC (Thu) by iabervon (subscriber, #722) [Link]

Plausibly, there could be a unicode code point for "the icon for the program", and the system would render each program's icon in a different font, where that font has only that one code point with a distinctive-looking glyph. Of course, there are a bunch of icons like "document" or "spreadsheet" (or "OK" or "cancel" or "save") that could have code points with standard appearances.

Aren't these icons?

Posted Aug 29, 2013 20:21 UTC (Thu) by ncm (guest, #165) [Link]

Unicode sets aside a code space for application-specific glyphs, and it is very widely used. We can expect Gnome, Apple, KDE, Microsoft, and Android to homestead segments of this space for their cross-app icons. The Unicode consortium might end up needing to assign points in another space for the more common icons.

I wonder if it was wise to limit Unicode to 1M code points.

Chromatic fonts are coming

Posted Aug 29, 2013 11:11 UTC (Thu) by etienne (guest, #25256) [Link] (1 responses)

> Gradients, of course, seem like a natural fit

I wonder if gradient (from transparent to opaque) fonts is a cleaner solution than anti-aliasing at display time.

Chromatic fonts are coming

Posted Aug 29, 2013 14:55 UTC (Thu) by gidoca (subscriber, #62438) [Link]

Anti-aliasing depends on the target display resolution and, when hinting is used, on the alignment of the character with respect to pixel borders. I do not therefore think that this would be a workable solution.

how do you change colors on these new font types?

Posted Aug 29, 2013 12:49 UTC (Thu) by dlang (guest, #313) [Link] (5 responses)

so how are users supposed to deal with changing colors with these new font types? or are users just supposed to stick with the colors that the font designers picked?

how do you change colors on these new font types?

Posted Aug 29, 2013 14:50 UTC (Thu) by lambda (subscriber, #40735) [Link] (3 responses)

Presumably, if you used Microsoft's proposal, tools could allow you to select between the different palettes that the font provides, or define your own entirely custom palette. For things like Emoji, you would probably only select between different palettes, as there would be way too many colors to make customizing it practical. But for the use case that's now filled by layering two or three fonts, manually specifying your own palette would be the way to go.

The other proposals don't seem as well tailored to that approach. I suppose the SVG approach could give you some way to apply custom CSS, but that seems like even more complication. Font renderers are complicated enough; building a full SVG and CSS engine into them seems like massive overkill.

how do you change colors on these new font types?

Posted Aug 30, 2013 3:50 UTC (Fri) by roc (subscriber, #30627) [Link] (2 responses)

Most platforms have an SVG and CSS renderer built into them these days.

how do you change colors on these new font types?

Posted Aug 30, 2013 5:15 UTC (Fri) by lambda (subscriber, #40735) [Link] (1 responses)

Yes, but on most platforms those are provided by a browser engine. Which generally depends on the font rendering layer. Which would then need to depend on a browser engine. Which gives you a nice circular dependency.

For web browsers, it's obviously not a problem, but there are lots of things which use fonts which may not want to add a full browser engine as a dependency. I know there's librsvg, but you still wind up with the circular dependency problem there (it depends on Pango, which depends on FreeType, which would need to depend on librsvg or something of the sort), and you would have to deal with all of the librsvg rendering bugs.

In fact, how do you get around the circular dependency problem that SVG can include text which requires font rendering to work? What if you want to render a font which uses SVG glyphs within an SVG glyph? Of course that's on top of all of the other subsetting problems; do you require full SVG, or some subset? The existing proposal refers to "secure animated mode" and "secure static mode" of the SVG Integration spec, but those still seem to require that a DOM is constructed and accessible from clients, which doesn't seem like a feature that font glyphs generally have, and of course they also require font rendering as well.

Furthermore, on some platforms (*cough*Windows*cough*), font rendering is apparently done in the kernel. Adding big extra blob of code to implement XML parsing, CSS parsing, and SVG rendering (including filter effects and everything else you can do in SVG) in the kernel seems like a non-starter. I can imagine why Microsoft would make the proposal that they did; it's the simplest possible way to achieve what they want, without introducing too much new, untrusted code. And for font rendering, I think that's a good thing.

In fact, I wonder if it wouldn't be a good idea, instead of embedding SVG (as in the Adobe/Mozilla proposal) or PNG (as in Apple's implementation) within the font itself, to just define a CSS glyph mapping feature, that would map glyphs (or characters) to any element you want, which could be an <svg> element, an <img>, a <video>, a <canvas>, or what have you, covering all of the possible use cases. Obviously, this would only apply in a web browser or something that already used an embedded a web browser to render text, but as far as I can tell, that seems to already be a dependency for this proposal to work anyhow.

how do you change colors on these new font types?

Posted Aug 30, 2013 9:39 UTC (Fri) by roc (subscriber, #30627) [Link]

This circular dependency issue isn't that hard to solve. One solution is for the font engine, say Freetype, to define an interface that can be implemented by any SVG rasterizer. Then a layer above Freetype can configure Freetype to use an SVG rendering library or a embedded browser engine without forcing Freetype to depend directly on those components.

I imagine that if Microsoft were to implement this proposal they would use a similar approach to call out to user space to render glyphs. (If they're still rasterizing text in the kernel ... that never made any sense to me.)

In the secure subsets of SVG used for glyphs, we prevent the glyphs document from triggering its own external resource loads. E.g. a glyphs document can't use an HTTP URL to load some other resource. There is therefore no way for a glyph to refer to its own font or otherwise create a real cyclic dependency.

There is no requirement that the DOM of SVG glyphs be exposed to clients of the font. You don't necessarily need to even construct or retain a DOM.

how do you change colors on these new font types?

Posted Aug 30, 2013 14:51 UTC (Fri) by lambda (subscriber, #40735) [Link]

Now that I've actually read the SVG proposal, it defines a series of colors that get passed into the font via CSS, with the font having one or more color schemes pre-defined, or you can assign your own colors to a number of named parameters. So it works similarly to the Microsoft proposal for that case.

The Google proposal (embedding raw color bitmaps or PNGs) doesn't have any provision for manipulating the colors, nor, I believe, does Apple's proprietary PNG embedding.

Both Google proposal and Apple's format are already implemented in FreeType. I guess for color bitmaps, it's fairly well agreed upon what to do, with some minor implementation details different; the real open question is for color vector fonts.

multi-layer colors match the printing process

Posted Aug 29, 2013 12:56 UTC (Thu) by dlang (guest, #313) [Link] (1 responses)

When it comes time to print the document, the different colors need to be converted into separate layers. The printing equipment can only print one color at a time in a particular spot and so must deal with printing the different colors separately, including the problem of aligning them.

There was an article here just a few weeks ago talking about how desktop publishing apps needed better support for managing the colors in different layers to improve the output for large-scale printing.

doesn't this sort of proposal take things in the wrong direction?

multi-layer colors match the printing process

Posted Aug 31, 2013 11:38 UTC (Sat) by smurf (subscriber, #17840) [Link]

Presumably you already have colors and alignment elsewhere in your document; otherwise you'd probably just print the black/white version.

Anyway, color layering (like "grow all C M Y areas by 0.1px to cover any inevitable alignment boogaboos") is better with SVG since it's an open format so you can (in principle; I have no knowledge of current practice) add appropriate hints thereto, like "don't extend the baseline, that'd look ragged". Bitmaps, not so much.

Chromatic fonts are coming

Posted Aug 29, 2013 14:37 UTC (Thu) by josh (subscriber, #17465) [Link] (1 responses)

Honestly, the colr proposal seems saner here. Having a set of font glyphs with associated colors, versus embedding a full SVG image into each glyph: the former seems far simpler as a solution to the problem of multi-colored fonts, and the latter seems like massive overkill.

Chromatic fonts are coming

Posted Aug 30, 2013 3:53 UTC (Fri) by roc (subscriber, #30627) [Link]

If you only ever want to render a set of uniform-color glyph parts, sure.

If you want gradients, animation or other effects, you can add those to your format one by one ... or, you can just use SVG and get all that and more, without having to write new specs, new code and new tests.

Chromatic fonts are coming

Posted Aug 30, 2013 15:17 UTC (Fri) by BenHutchings (subscriber, #37955) [Link]

They may be 'coming' now, but AmigaOS had colour fonts in 1991! (Bitmap only though, and probably dependent on setting the screen palette to match.)


Copyright © 2013, 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