Skip to content

Add glyph-level genericGlyphChange (same as UI "Change Glyph ...")#4133

Merged
ctrlcctrlv merged 1 commit intofontforge:masterfrom
skef:ggc
Feb 6, 2020
Merged

Add glyph-level genericGlyphChange (same as UI "Change Glyph ...")#4133
ctrlcctrlv merged 1 commit intofontforge:masterfrom
skef:ggc

Conversation

@skef
Copy link
Copy Markdown
Contributor

@skef skef commented Feb 4, 2020

The oft-requested (but already possible) "Change Glyph" Python API, but on the glyph object to avoid having to use the selection interface. Uses the same parameter parsing logic as the old command, moved to a separate function

The main annoyance with the API compared with the UI is the lack of a default vMap. The dialog VMap is based on the BlueValues (when those are present). However, the font.private object has these available in a tuple, so if that's what the user wants they're not too hard to build.

Closes #2925

@ctrlcctrlv
Copy link
Copy Markdown
Member

It worries me vis à vis #4078 to add more code that doesn't seem to have been tested on multilayer fonts. Did you do tests on the font in that PR?

@skef
Copy link
Copy Markdown
Contributor Author

skef commented Feb 6, 2020

I did not test on those fonts. However, the pattern of the code follows the usual pattern of applying to the currently selected layer, which is how almost all of the glyph-level methods work (when they affect contours).

@ctrlcctrlv
Copy link
Copy Markdown
Member

I notice the use of FontViewBase. Would you mind testing on the font there?

@skef
Copy link
Copy Markdown
Contributor Author

skef commented Feb 6, 2020

I can, but if you scan up the old code you'll see that's part of the current font-level call as well -- it just wound up being moved in the process of isolating the parameter parsing.

@skef
Copy link
Copy Markdown
Contributor Author

skef commented Feb 6, 2020

They both work. You have to set font.activeLayer to have the font-level method later that level and glyph.activeLayer for the glyph-level method. And if you wanted to change the whole glyph you'd have to cycle through the layers.

Of course, the way Change Glyph works makes good results unlikely because the output depends on the relation of the contour shape to the font metrics, which is likely to be different for different layers in a multi-layer font.

@ctrlcctrlv
Copy link
Copy Markdown
Member

Thanks, sorry to bother you. Hopefully you understand the reasons behind my concern :-)

@skef
Copy link
Copy Markdown
Contributor Author

skef commented Feb 6, 2020

Given that the methods depend on the layer value it's a reasonable test to run.

@ctrlcctrlv ctrlcctrlv merged commit b4ba439 into fontforge:master Feb 6, 2020
This was referenced Feb 23, 2020
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 this pull request may close these issues.

Python API for "Change Glyph"

2 participants