Skip to content

[ufo] Merge libs from designspace and default master#1628

Merged
cmyr merged 2 commits into
mainfrom
merge-ufo-lib
Sep 12, 2025
Merged

[ufo] Merge libs from designspace and default master#1628
cmyr merged 2 commits into
mainfrom
merge-ufo-lib

Conversation

@cmyr

@cmyr cmyr commented Sep 11, 2025

Copy link
Copy Markdown
Member

This is a conservative merge; we only update dictionary objects, and we only add items from the child that are not present in the base.

It is possible for there to be keys in the default master's lib that are not in the designspace lib, and which we want to have access to (the motivating example being the presence of the 'eraseOpenCorners' filter).

In an earlier patch I had added special handling for the case where we were compiling a single ufo; this new approach lets us delete that special case.

The decision to just look at the default master was arrived in conversation with cosimo. In general the keys that we care about are autogenerated by glyphsLib, and should be consistent between masters. We could try and verify that this is true but that feels like very low ROI at this point.

This is a conservative merge; we only update dictionary objects, and we
only add items from the child that are not present in the base.

It is possible for there to be keys in the default master's lib that are
not in the designspace lib, and which we want to have access to (the
motivating example being the presence of the 'eraseOpenCorners' filter).

In an earlier patch I had added special handling for the case where we
were compiling a single ufo; this new approach lets us delete that
special case.

The decision to just look at the default master was arrived in
conversation with cosimo. In general the keys that we care about are
autogenerated by glyphsLib, and should be consistent between masters. We
could try and verify that this is true but that feels like  very low ROI
at this point.
Comment thread ufo2fontir/src/source.rs Outdated
@anthrotype

Copy link
Copy Markdown
Member

It is possible for there to be keys in the default master's lib that are not in the designspace lib, and which we want to have access to (the motivating example being the presence of the 'eraseOpenCorners' filter).

yes, currently glyphsLib stores its custom filter in the master UFOs' lib, not the designspace.lib:

https://github.com/googlefonts/glyphsLib/blob/52c982399ba20dc96a2c2195df6fc6cea1f9a906/Lib/glyphsLib/builder/font.py#L54-L56

... but that's because ufo2ft expects them to find filters in there. I don't think it looks for filters in the designspace.lib right now (also see googlefonts/ufo2ft#933)

I wonder if this could introduce a potential difference if a DS-based project stores ufo2ft filters in the designspace.lib but only fontc looks for these, while ufo2ft doesn't...

@cmyr

cmyr commented Sep 11, 2025

Copy link
Copy Markdown
Member Author

Okay so I think this approach actually doesn't work in the general case.

Part of the motivation here was handling the case of compiling from UFO, where we synthesize the designspace, and we specifically wanted to copy over the noExportGlyphs key.

I now have failures in several variable fonts that use designspace files, where we are copying over the noExportGlyphs from the default UFO to the designspace and using it, which doesn't match fonttools.

Now I'm back to thinking that the best approach is going to be to just separately hold on to the lib for the default master? 🤦

Specifically we want to avoid merging 'public' keys in the case
where we were explicitly passed a designspace file.
@cmyr cmyr added this pull request to the merge queue Sep 12, 2025
Merged via the queue into main with commit 49aaa13 Sep 12, 2025
12 checks passed
@cmyr cmyr deleted the merge-ufo-lib branch September 12, 2025 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants