Experimenting with Color Fonts

Over the past couple of weeks there’s been a lot of excitement over color fonts. Adobe describes the technology like this:

OpenType-SVG is a font format in which an OpenType font has all or just some of its glyphs represented as SVG (scalable vector graphics) artwork. This allows the display of multiple colors and gradients in a single glyph. Because of these features, we also refer to OpenType-SVG fonts as “color fonts”.

Back in March, Roel Nieskens wrote about his experience building a color font and described the problem that they intend to solve:

Typography on the web is in single color: characters are either black or red, never black and red.

So, with a color font, type designers can now embed multiple colors within the glyphs themselves. Then, a web designer can pick one of the options available with the font-variation-settings property in CSS. Below, I’ve made a demo that shows how this works with Trajan Color, a new font made by Adobe and now available with Typekit:

See how different parts of those glyphs, ABC, have different hints of color inside?

What this means is that when it comes to emoji and display type, designers will soon have more interesting choices at hand. For now, browser support isn’t that great but Adobe has provided everyone with a heads up over on the Typekit page designed by Nick Sherman:

Browser support for color fonts is still evolving, but exists in Firefox and Microsoft Edge (IE), and we expect more browser manufacturers will adopt the format before long. In browsers that lack color font support, they will fall back to regular monochrome glyphs.

I think that final point, about how color fonts fallback, was best illustrated by Roel Nieskens, which ought to be the perfect, progressively-enhanced thing that could happen in this situation:

Here are some examples of color fonts that you can experiment with today:

But beware! There are a few problems with this approach. The most troublesome being the size of the font file in my demo above: it’s 593 KB in all. Although, to be honest, in most projects we probably won’t need to load every variation of the color font which will greatly reduce the size of the font file we serve.

Secondly, it doesn’t appear that in CSS it’s possible to change the various colors inside a color font. So for a while, we’re stuck with whatever styles type designers provide for us in the font files themselves.

Regardless of those two pain points, though, I’m still very much excited by the emergence of color fonts and what that could mean for typography on the web. I can see old woodtype styles in particular coming back thanks in part to this new font format.

Make sure to check out the demo below (with Firefox or Edge) to see the color font effect:

See the Pen Color fonts demo by Robin Rendle (@robinrendle) on CodePen.


Experimenting with Color Fonts is a post from CSS-Tricks

CSS-Tricks

Add a Comment

Your email address will not be published. Required fields are marked *

21