Skip to content

Commit

Permalink
[instantiator] use designspace.findDefault() which in turns sets desi…
Browse files Browse the repository at this point in the history
…gnspace.default

otherwise a DS object created from code (as opposed to one loaded from string or file) has a 'default' attribute set to None (until findDefault() is first called).
  • Loading branch information
anthrotype committed Nov 14, 2024
1 parent 06baacc commit c1f95af
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion Lib/ufo2ft/instantiator.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def from_designspace(
do_glyphs=True,
):
"""Instantiates a new data class from a Designspace object."""
if designspace.default is None:
if designspace.findDefault() is None:
raise InstantiatorError(_error_msg_no_default(designspace))

if any(hasattr(axis, "values") for axis in designspace.axes):
Expand Down
2 changes: 0 additions & 2 deletions tests/instantiator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def test_default_groups_only(ufo_module, data_dir, caplog):
d.addSourceDescriptor(location={"Weight": 300}, font=ufo_module.Font())
d.addSourceDescriptor(location={"Weight": 900}, font=ufo_module.Font())
d.addInstanceDescriptor(styleName="2", location={"Weight": 400})
d.findDefault()

d.sources[0].font.groups["public.kern1.GRK_alpha_alt_LC_1ST"] = [
"alpha.alt",
Expand Down Expand Up @@ -102,7 +101,6 @@ def test_default_groups_only2(ufo_module, data_dir, caplog):
d.addSourceDescriptor(location={"Weight": 300}, font=ufo_module.Font())
d.addSourceDescriptor(location={"Weight": 900}, font=ufo_module.Font())
d.addInstanceDescriptor(styleName="2", location={"Weight": 400})
d.findDefault()

d.sources[0].font.groups["public.kern1.GRK_alpha_alt_LC_1ST"] = [
"alpha.alt",
Expand Down

0 comments on commit c1f95af

Please sign in to comment.