I had been working with SVG Layers, and am hoping to work with Glyphs’ native Color Layers (so it can export across a variety of formats). My standard workflow is to import external SVGs. I have a few questions around usage of colors in the Color layers that I am unable to find a solution in the docs nor forums. (“user-color” = what the user chooses as text-color in their applications.)
1a. How to specify a path to take user-color in the UI? (When I take a regular layer and convert it to Color, both stroke/fill are null and the path is not visible in the export.) 1b. How to specify a path to take user-color with scripts?
I markup SVGs with a fill="currentColor" attribute. Importing as SVG layers → exporting gives the expected behaviour (that these paths responds to user-color) but these are ignored in Color layers.
2. Is it possible to import from SVG and, based on a markup, specify a user-color? (In addition to being able to take currentColor, it would be very convenient to be able to convert paths that doesn’t have colors specified to this application foreground.)
Is it possible now to use color indices in Color layers? (related to this question from a while ago) If not, is there a recommended way of importing SVGs and using color palettes?
currentColor works in SVG import (into SVG layer), followed by export as OT-SVG.
I presume by iColor you mean the native Color layer; that is what all the questions in my original post pertains to. I just didn’t see any ways of working with user-color with Color (iColor?) layers.
The spec says it should be supported but when I tried I could not get it to work in Adobe apps. Can you send me a sample SVG you are embedding that works in Illustrator?
Yes, Illustrator behaves very strangely with OT-SVG but it works on other applications. The same font export works with right dimensions and takes currentColor in Keynote, MS Word (on macOS), LibreOffice etc, but is both distorted and does not take currentColor:
Thanks — I understand that import-export works with the SVG layer. It was long previous conversations with Georg that suggests I should be working with Color layers; which does work better in the export when the sizes of the images are irregular.
SVG Import → SVG layer → SVG export
Keynote (notice the light green on the first structure; that’s the currentColor):
I don’t know why they should be different, but clearly only importing into a Color layer gives the right output when exported. However, that loses any ability to set user-color / asterisk color. Is there a way around that?
[Edit: I can set the currentColor, by using fonttools to bust open the ttf → ttx, and text-editing the SVGs to add fill=“currentColor”:
But needless to say, I’d far prefer a less low-level solution, and this method doesn’t export to other color formats, negating one of the supposed advantages of using Color layer. These currentColor tags are removed the moment it’s passed through Color; if they can just be preserved, that would do the trick.]
I’ll put that on the list. One of the issues is that the Color layer supports a lot more than can be exported into SVG or CPAL/COLR fonts. And currently there is no such thing as ‘user-set color’ (or the SVG currentColor) implemented yet.
Thanks for confirming the limits. I am enthusiastic about pushing the limits of color fonts (e.g., the released SIL 1.1 Cantonese Font at www.visual-fonts.com), and would be happy to be sounding board / tester.
in the Changelog (for 3209; 2023-08-10), so I think there may have been an attempt at solving this. However, the current behaviour (3227), when importing an SVG, remains that the path carrying fill="currentColor" attribute are imported as no-fill no-stroke, and exports to SVG font as invisible (and not accepting application color).