Skip to content

Commit

Permalink
Merge pull request #887 from googlefonts/instantiator-find-default
Browse files Browse the repository at this point in the history
[instantiator] use designspace.findDefault() the first time designspace.default is checked
  • Loading branch information
anthrotype authored Nov 14, 2024
2 parents 06baacc + c1f95af commit d05c7f3
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 d05c7f3

Please sign in to comment.