googlefonts / googlefonts/glyphsLib

Hanging intermediate layers off different masters causes a build failure

Open
#995 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
201
Forks
56
Avg merge
17m
Merged PRs (30d)
1

Description

While trying to build [Barlow](https://github.com/jpt/Barlow) as a variable font, I found that glyph `a` hangs some of its intermediate layers off the Bold master, like so:

Screenshot 2024-04-05 at 14 53 13

while `ae` hangs the same intermediate locations off the light master:
Screenshot 2024-04-05 at 14 53 34

Glyphs export is fine with this, but when converting to designspace, glyphsLib converts each one of these to a different source:

```












```

And then it complains that it has two masters with the same location:

```
File "/opt/homebrew/lib/python3.11/site-packages/fontmake/font_project.py", line 1302, in _run_from_designspace_interpolatable
self.build_variable_fonts(
File "/opt/homebrew/lib/python3.11/site-packages/fontmake/font_project.py", line 450, in build_variable_fonts
fonts = ufo2ft.compileVariableTTFs(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/ufo2ft/__init__.py", line 172, in compileVariableTTFs
return VariableTTFsCompiler(**kwargs).compile_variable(designSpaceDoc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/ufo2ft/_compilers/baseCompiler.py", line 420, in compile_variable
vfNameToTTFont = self._merge(designSpaceDoc, excludeVariationTables)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/ufo2ft/_compilers/interpolatableTTFCompiler.py", line 44, in _merge
return varLib.build_many(
^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/fontTools/varLib/__init__.py", line 1125, in build_many
vf = build(
^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/fontTools/varLib/__init__.py", line 1199, in build
model = models.VariationModel(normalized_master_locs, axisOrder=axisTags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/fontTools/varLib/models.py", line 253, in __init__
raise VariationModelError("Locations must be unique.")
fontTools.varLib.errors.VariationModelError: Locations must be unique.
```

We should ignore the putative "master" for an intermediate layer, and should just create a master purely based on the location coordinates.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.