compareString but for paths

I’m doing something where I need to compare two fonts, find matches between paths that are constructed similarly (but nodes positions or bounds don’t necessarily match), so I can delete every path that have no match.

The compareString method of a layer object is exactly what I would want to use, but for a path instead.

I know I can find matches by comparing node types for each path which is basically the same thing, but compareString is a nice thing to have to go faster, wouldn’t it be nice to have it available for path objects too?

You can build a function that builds those paths quite easily. Iterate over the nodes and append a letter for each node type.

Thats exactly what I did! It’s not that its complicated to do, but since compareString is already there and provide a nice shortcut, it would have been cool to be able to just call that on a path too. But I see how there is more urgent things to work on :wink:

I refactored it in the new codebase. So soon you can do path.compareString()

2 Likes

Nice! Thanks Georg!