Skip to content

Conversation

@mf2vec-dev
Copy link
Contributor

Fixes #5320

Apply non-linear transformations to anchor points while taking selection into account. This should work in GUI, Python and scripting. I tested in GUI and added a Python test.

This is my first contribution to a C project. Please check my changes carefully.

Type of change

  • Bug fix
  • New feature

@skef
Copy link
Contributor

skef commented Jan 15, 2024

Overall this looks like a positive and useful change, but offhand I don't remember the details of anchor state preservation. So: In the paths that call _SCNLTrans, and when the glyph isn't multilayer (which should be the typical case), can you test if (in the UI, for example), you perform a non-linear transformation and then Undo (ctrl-z) it, does the anchor point change also reverse, or not?

If it doesn't, that stuff is probably taken care of in SCPreserveState and you'll have to confirm that and then refactor a bit so that SCPreserveState is called whether multilayer is true or not.

@mf2vec-dev
Copy link
Contributor Author

I just checked this and Undo / Redo work as expected when the non-linear transformation is applied by opening the Non Linear Transformation dialog from the menu of the Font View. This way NonLinearDlg calls _SFNLTrans, which calls _SCNLTrans.

Copy link
Contributor

@skef skef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@skef
Copy link
Contributor

skef commented Jan 16, 2024

Ah, sure enough, SCPreserveLayer handles the anchor points if the layer is ly_fore.

@skef skef merged commit 99d5225 into fontforge:master Jan 16, 2024
@mf2vec-dev mf2vec-dev deleted the nltransform-anchors branch January 16, 2024 22:15
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.

Feature Request: Apply non-linear transformation to anchors

2 participants