Skip to content
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 filter pens that decompose components #3460

Merged
merged 5 commits into from
Mar 5, 2024
Merged

Conversation

anthrotype
Copy link
Member

This PR adds a bunch of filter and recording pens to do composite glyph decomposition (I need to use them for some ufo2ft filter).

decomposed components with flipping transform have their path direction reversed, possibly causing dropouts if they overlap other components; this option ensures they will get reversed as they are decomposed (similar to what ufo2ft DecomposeComponentsFilter or Glyphs.app does when decomposing flipped components).

Also we allow specific instances of to set skipMissingComponents differently from the class default value, and add an alias to MissingComponentError so one doesn't need to import it explicitly but can the pen's class attribute.
@behdad
Copy link
Member

behdad commented Mar 5, 2024

Does this really need to be a class? It sounds trivial / no-op:

class DecomposingRecordingPointPen(DecomposingPointPen, RecordingPointPen):

@anthrotype
Copy link
Member Author

I know, I added it mostly because 1) we already have a DecomposingRecordingPen (segment-oriented) and 2) to be able to test the DecomposingPen mixin class (which can't be instantiated on its own). It's one line, I'd just keep it.

@anthrotype
Copy link
Member Author

from this PR, I'm mostly interested in the DecomposingFilterPointPen (which allows me to selectively decompose specific components, optionally not recurse in nested comps, reverse direction for flipped ones, optionally skip missing, etc., removing some of the same logic that is currently in ufo2ft).

@behdad
Copy link
Member

behdad commented Mar 5, 2024

SGTM.

@anthrotype anthrotype merged commit a3b9edd into main Mar 5, 2024
11 checks passed
@anthrotype anthrotype deleted the decompose-filter-pen branch March 5, 2024 16:14
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.

None yet

2 participants