googlefonts / nanoemoji

A wee tool to build color fonts.
Apache License 2.0
239 stars 19 forks source link

allow to customize build of CPAL palettes #433

Open anthrotype opened 1 year ago

anthrotype commented 1 year ago

Currently, nanoemoji allows to build a COLR font with a single-palette CPAL table, which is populated from the input SVGs inlined color fills. There's no way to configure the build with additional palettes. If one wishes to add those, one can only patch the font after build (using some fonttools python script or hacking ttx file).

If a color font has such multi-palettes CPAL setup already (which was added by other means), and we then run maximum_color tool on it to generatea the missing color tables, then the multiple palettes are retained as expected (and will work with OT-SVG after #431).

It would be nice to be able to go from a set of input .svg files (in which color fills are specified using the CSS color variable notation var(--color0, red)) plus an appropriately enhanced config.toml containing a list of additional color palettes, maybe associated with optional settings like light/dark mode and other CPAL flags, and obtain a COLR font with the desired final CPAL table.