8000 [varLib.interpolatable] Does not correctly handle discrete axes · Issue #3597 · fonttools/fonttools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[varLib.interpolatable] Does not correctly handle discrete axes #3597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
colinmford opened this issue Aug 2, 2024 · 6 comments · Fixed by #3599
Closed

[varLib.interpolatable] Does not correctly handle discrete axes #3597

colinmford opened this issue Aug 2, 2024 · 6 comments · Fixed by #3599

Comments

@colinmford
Copy link
Contributor

Hi @behdad @anthrotype,

I love the varLib.interpolatable tool, and I would love to use it on a designspace with a discrete axis. But, when I try to run one through, it gives the following error:

  File "/Users/colinmford/Git/fonttools/Lib/fontTools/varLib/interpolatable.py", line 718, in main
    axis_triples = {
                   ^
  File "/Users/colinmford/Git/fonttools/Lib/fontTools/varLib/interpolatable.py", line 719, in <dictcomp>
    a.name: (a.minimum, a.default, a.maximum) for a in designspace.axes
             ^^^^^^^^^
AttributeError: 'DiscreteAxisDescriptor' object has no attribute 'minimum'

Larger context:

if args.inputs[0].endswith(".designspace"):
from fontTools.designspaceLib import DesignSpaceDocument
designspace = DesignSpaceDocument.fromfile(args.inputs[0])
args.inputs = [master.path for master in designspace.sources]
locations = [master.location for master in designspace.sources]
axis_triples = {
a.name: (a.minimum, a.default, a.maximum) for a in designspace.axes
}
axis_mappings = {a.name: a.map for a in designspace.axes}
axis_triples = {
k: tuple(piecewiseLinearMap(v, dict(axis_mappings[k])) for v in vv)
for k, vv in axis_triples.items()
}

I suppose it should split up the designspace into its subspaces, (probably using designspaceLib.split.splitInterpolatable) and then run the interpolatable tests on each subspace, though I can see this being a can of worms.

I can attempt a PR to enable discrete axes with interpolatable, but I wanted to check first with the both of you to see that something wasn't already in progress, or if you had any suggestions to start.

Thanks!

@behdad
Copy link
Member
behdad commented Aug 2, 2024

I can attempt a PR to enable discrete axes with interpolatable, but I wanted to check first with the both of you to see that something wasn't already in progress, or if you had any suggestions to start.

It hasn't been on my radar. Let me think about it. I think it can be done without splitting the designspace. Right now I collect all masters, and for each one, pick a closest master to compare with. I just need to have multiple groups of masters.

@behdad
Copy link
Member
behdad commented Aug 2, 2024

If you don't mind sending me a reproducer, I can work on it right away. You can email me. Thanks.

@colinmford
Copy link
Contributor Author
colinmford commented Aug 2, 2024

@behdad I don't have your email address, here it is attached. It's just a simple 2-axis set up, with one axis discrete.

Discrete Axis.zip

@behdad
Copy link
Member
behdad commented Aug 2, 2024

@behdad I don't have your email address, here it is attached. It's just a simple 2-axis set up, with one axis discrete.

Thanks. first.last@gmail works...

@behdad
Copy link
Member
behdad commented Aug 3, 2024

Thanks. This should fix it: #3599

@colinmford
Copy link
Contributor Author

@behdad Thanks so much!

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 a pull request may close this issue.

2 participants
0