glyphsLib: layer.name causes intermediate sources with duplicate locations

The layer.name should not be used for anything. Only when opening v2 files to convert to layer.attributes.

In Glyphs 3, layer.name is generated from the attributes but is only used for UI purposes.

I just found a problem where two glyphs with a brace layer for the same position would generate duplicate SourceDescriptors because of different names.

WARNING:glyphsLib.builder.sources:DesignSpace sources contain duplicate locations; varLib expects each master to define a unique location. Make sure that you used consistent 'brace layer' names in all the glyph layers that share the same location.
  ['{110, 0}', '25. May 22, 21:39'] => {'Weight': 110, 'Ascender': 0}

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

different API function

I think it’s the same name property of GSLayer, not a different method. The result changes based on layer type and attributes. If I print Glyphs.font.selectedLayers[0].name from the Macro window when inside one of these intermediate layers in Glyphs 3.app, it prints e.g. {201} when the layer is marked as “Intermediate” in the contextual menu; if I disable that, it gets back to the current date name. Since the user cannot edit the layer name when it is marked as one of the special layers, we must return whatever Glyphs 3.app returns; for v2 we should continue to use the actually stored layer name. We do need a name because UFO layers need to be named and they need to have a unique name.

Looks like there is layer.nameUI() that returns the actual name (though the naming is confusing, shouldn’t .name return the actual name and nameUI() do the other way around? More confusingly, if you set .name, .nameUI() returns the new name while .name still gives the UI name).