-
Notifications
You must be signed in to change notification settings - Fork 73
Add '--expand-features-to-instances' arg to fontmake UFO generation #985
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
base: main
Are you sure you want to change the base?
Changes from all commits
3c98f78
b56edad
532a8b2
cc8617e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,7 @@ | |
| "checkCompatibility": True, | ||
| "overlaps": "booleanOperations", | ||
| "splitItalic": True, | ||
| "expandFeaturesToInstances": True, | ||
| } | ||
|
|
||
|
|
||
|
|
@@ -193,8 +194,6 @@ def fontmake_args(self, source, variable=False): | |
| args += " --keep-direction" | ||
| if self.config.get("removeOutlineOverlaps") is False: | ||
| args += " --keep-overlaps" | ||
| if self.config.get("expandFeaturesToInstances"): | ||
| args += " --expand-features-to-instances" | ||
|
Comment on lines
-223
to
-224
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we 100% sure that this doesn't work? If I was implementing such a feature then I'd simply chuck it here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the approach in the release as of when I made the PR, right? If so, then yes, I’m 100% sure it wasn’t working. I can test it again, though, if it seems likely that it may have changed since then.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That line feels right - I think I'd like to understand why it's not working before trying something else, because understanding why not might lead us to the right answer.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, returning later because the issue persists, and I’ve been working around it a lot, recently. To respond to the comments above:
The reason it is currently not working is that the FontMake arg It is being used during the final font binary compilation, but it needs to be used during the UFO instantiation process, as this PR makes happen. The arg is used by FontMake to get feature includes, and expand them into instance UFOs. That way, those instance UFOs can be built into final fonts. If the arg is used later, during the TTF generation process, the feature include statements will no longer have the correct relative path, so they will be unusable. And now, FontMake will now throw the error |
||
| if self.config.get("extraFontmakeArgs") is not None: | ||
| args += " " + str(self.config["extraFontmakeArgs"]) | ||
| if variable: | ||
|
|
@@ -340,6 +339,9 @@ def build_a_static(self, source: File, instance: InstanceDescriptor, output): | |
| "operation": "instantiateUfo", | ||
| "instance_name": instancename, | ||
| "glyphData": self.config.get("glyphData"), | ||
| "expandFeaturesToInstances": self.config.get( | ||
| "expandFeaturesToInstances" | ||
| ), | ||
| } | ||
| ) | ||
| steps += ( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why you're using
self.originalhere? It is breaking the tests sinceexpandFeaturesToInstancesisn't inself.original. If I change it tovarsit seems to be working but I could be wrong.Personally, I would use a dict's
getmethod if I cannot guarantee that a key exists. It also allows you to set a value incase it doesn't exist so in your caseself.original.get("expandFeaturesToInstances", False)will return False if the key doesn't exist, or it will simply return the value if it does.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, thank you for that tip on
.get()– that is news to me, but really helpful to learn!As far as I can remember, I think I just tried to use a similar format as what is a few lines below:
gftools/Lib/gftools/builder/operations/instantiateUfo.py
Line 69 in cc8617e
...and when it seemed to work, I thought I had solved it.
My impression was that
self.originalis theGOOGLEFONTS_SCHEMA, but I now realize that, even if that is true, there are other possible schemas.