SVG font with user-applied color

I’m currently working on creating a font that has a color ‘decoration’ on one glyph that I want to preserve the color of. However, I’d like for the regular letters to be able to vary based on user-applied coloring and it needs to work in Illustrator.

Exporting it as an SVG got the color aspects to work correctly, but I was unable to change the regular letters away from black. And not assigning a color profile to the regular letters rendered them transparent in Illustrator.

Is there any way to have an SVG font with aspects that use user-assigned color?

[edit] I realized I should probably clarify one point. The “decoration” on a glyph should preserve color, but the glyph itself should be user colorable. Hope that makes sense!

Following up on my previous message. In looking at the SVG OT specification, there’s a mechanism such that the color of an element in an SVG file can be set to “context-fill”, which will set it to whatever the user-selected color is.

In context:
<rect x="100" y="365" width="200" height="135" fill="context-fill" />
<rect x="100" y="365" width="200" height="135" fill="darkblue" />

However, I’m not sure how to tell Glyphs to use “context-fill” for a given color layer. I could certainly export the font, then modify it with TTX, but I figure there must be a simpler way :).

1 Like

That is already implemented. You just need to assign a color index that is bigger than the number of colors in the palette. But be aware that the content-fill is not implemented in Illustrator. I tested it in FireFox, and there, it did work.

1 Like