Processing outlines with custom pens

Hey all, long time no posts. I’ve been trying to get something working in Glyphs but having some difficulties. I have written a custom filter-like pen that transforms outlines, and which works in other software but I can’t get my head around how to implement it in Glyphs.

In short - I cant work out how to draw the current layer into the pen, as one would do with the below:

pen = MyPen(glyphSet, outPen)

Any pointers here would be great, as I’d prefer to wrap this in a Glyphs plugin at this stage.


What is currentGlyph? A glyph or a layer?

In Glyphs’ terms; a layer

The code looks good. What happens? Do you get an error. It is most likely an incompatibility with the pen protocol. You might need to import objectsGS to get (some) compatibility with the robofab API.

This works now, thanks Georg. I had been trying to draw into the pen by requesting a pen from the glyph [getPen()], and then drawing with that into my own pen which yielded errors. Overly complicating it, I forgot/didn’t realise that we can draw the glyph directly.