Subtract components on export?

Hi, been looking for a way to make a stencil font, is there a way to use LayerGeek (or any other way) at export and create a stencil version that subtracts all components that overlap a letter?

Tried the decompose and copy to layer but haven’'t seen any instructions about subtracting

Guess a reuse components and Add to Corner will work

There is a GSPathOperator method:
- (BOOL) subtractPaths:(NSMutableArray *)SubstactPaths from:(NSMutableArray *)Paths error:(NSError *__autoreleasing*)error;

So, in Python you could do something like GSPathOperator.subtractPaths_from_error_( topPaths, bottomPaths, None ) where topPaths are collectively subtracted from bottomPaths. The resulting paths are stored in bottomPaths afterwards.

Dumb question, sorry:
do I run that in Terminal, or in the Macro panel? Or as a Filter/PreFilter?? Or do I need to create a .py script and put that in the Scripts folder

It is Python, and if you want to apply at export time, you will need to write a plugin. Do you have experience in Python? Then read the Plug-in tutorial, otherwise start with the four Scripting tutorials.

Will do the tuts and try this, thanks!

Were you able to get a good workflow in place for creating a stencil? I need to create a white component effect.

@mekkablue has there been progress made with creating a white component to help with creating stencil fonts?

As of yet, you would still have to script it.

  • Hint 1: Write a plug-in, and apply it as a PreFilter parameter. That way, the components are still available to your code at export time. (Before decomposition.)
  • Hint 2: You can add a white attribute to a component with something like myComponent.userData["white"] = True, so you can query it with if myComponent.userData["white"]:
    and then go on to decompose it and subtract it from the rest.
1 Like