Python script to shift mask layer

scruggsdesign's picture

I'm in the very early stages of trying to learn python. Of course, I’m most interested in using Python to script FontLab. However, I find the documentation on how Python works with the Fontlab methods to be extremely sparse. I’m familiar with this but that doesn't make much sense to me right now. I've also worked with Robofab a little. I’m sure it will click as I learn more about Python but right now I’m not much further than learning about strings, lists, and loops.

Anyway… I keep hitting a dead end on something that I’m sure is pretty simple…
I frequently save my progress as I’m designing by copying my outlines to the mask layer and shifting the entire mask layer to the left (-1200 units at 2048 UPM). I have an Action Set saved for this that works by shifting outline & mask -1200 then shifting just the outline back 1200. I would like to do this with just a keyboard shortcut so I explored ways of making it happen with a Python script but I could never find a way to act on the mask layer in either the built-in FontLab methods or Robofab.

Any help on this would be greatly appreciated.


eigi's picture


glyph = fl.glyph.mask
fl.glyph.mask = glyph


scruggsdesign's picture

Thank you! Thank you! Thank you!

That works perfectly!
How did you become so well versed in scripting FontLab with Python?

I'm going to keep studying and someday, hopefully, I’ll be skilled enough to solve my own problems…
Thanks again!

Syndicate content Syndicate content