Skip to content

Commit

Permalink
Ensure there is an instance mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Oct 31, 2024
1 parent 473bfea commit 39c3331
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Lib/glyphsLib/builder/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,16 +347,17 @@ def _potentially_invert_mapping(self, mapping, instance_mapping):
"and save in a recent version of Glyphs to avoid this warning."
)
return mapping
if min(mapping.keys()) == min(instance_mapping.keys()) and max(
mapping.keys()
) == max(instance_mapping.keys()):
# Looks like userspace->designspace
return mapping
if min(mapping.keys()) == min(instance_mapping.values()) and max(
mapping.values()
) == max(instance_mapping.keys()):
# Looks like designspace->userspace
return inverted
if instance_mapping:
if min(mapping.keys()) == min(instance_mapping.keys()) and max(
mapping.keys()
) == max(instance_mapping.keys()):
# Looks like userspace->designspace
return mapping
if min(mapping.keys()) == min(instance_mapping.values()) and max(
mapping.values()
) == max(instance_mapping.keys()):
# Looks like designspace->userspace
return inverted
# No idea
logger.warning(
"Axis %s: The Axis Mappings custom parameter is ambiguous, "
Expand Down

0 comments on commit 39c3331

Please sign in to comment.