googlefonts/glyphsLib

There can be two color palette layers with the same color

Opened this issue · 3 comments

as seen in this example:
Bildschirmfoto 2024-04-27 um 19 52 03

Using glyphs2ufo produces this output:

Bad Color Bold: Glyph A, layer color.0: Duplicate glyph layer name
Bad Color Thin: Glyph A, layer color.0: Duplicate glyph layer name

and this layer mapping (it appends a '#' to make the name unique):

<key>com.github.googlei18n.ufo2ft.colorLayerMapping</key>
      <array>
        <array>
          <string>color.0</string>
          <integer>0</integer>
        </array>
        <array>
          <string>color.1</string>
          <integer>1</integer>
        </array>
        <array>
          <string>color.0 #1</string>
          <integer>0</integer>
        </array>
      </array>

So it is not sufficient to use GSLayer.name as layer names in the ufos.

Do you have a test font?

The handling of color layers was supposed to be applied only when minimal=True (the thinking back then was that it is a ufo2ft-specefic feature so it was enabled only when minimal mode is enabled which is used when building UFOs with ufo2ft), but it seems that it is now partially applied when minimal=False:

$ glyphs2ufo ColorComponents.glyphs
Bad Color Bold: Glyph A, layer color.0: Duplicate glyph layer name
Bad Color Thin: Glyph A, layer color.0: Duplicate glyph layer name
Bad Color Thin: Glyph Aacute, layer color.0: Duplicate glyph layer name
Bad Color Bold: Glyph Aacute, layer color.0: Duplicate glyph layer name

And no warnings with:

$ glyphs2ufo --minimal ColorComponents.glyphs

I suggest we enable the handling of color layers unconditionally, since this seems to be a source of problems (e.g. googlefonts/gftools#740).