-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add '--expand-features-to-instances' arg to fontmake UFO generation #985
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
-196
to
-197
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. 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. 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. |
||
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 += ( | ||
|
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.original
here? It is breaking the tests sinceexpandFeaturesToInstances
isn't inself.original
. If I change it tovars
it seems to be working but I could be wrong.Personally, I would use a dict's
get
method 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.original
is theGOOGLEFONTS_SCHEMA
, but I now realize that, even if that is true, there are other possible schemas.