batchRoboFontExtension icon indicating copy to clipboard operation
batchRoboFontExtension copied to clipboard

Feature suggestion: preprocessing and postprocessing scripts

Open djrrb opened this issue 8 years ago • 6 comments

I ❤ Batch and I wouldn't want to use anything else. However there are a few things that I like to do that are specific to my workflow, such as dealing with double encodings that the FDK strips from the UFO, etc. Right now I have to run them as a separate step, but would love to incorporate it into my generating process.

Would you consider allowing users to add an optional preprocessing and postprocessing script to Batch? I think it would be as easy as letting the user select these scripts in the UI, and then providing a way for the scripts to access the source UFO and the generated font (and the designspace, if applicable).

(I considered making my own version of Batch, but then I have to keep it up to date and distribute it to anyone else generating my fonts. Adding a custom preprocessing/postprocessing preferences seems like a cleaner solution.)

Feel free to close this issue if you’re not interested, and thanks for hearing me out!

djrrb avatar Apr 25 '17 13:04 djrrb

this would be indeed a welcome addition :)

I would rather propose to either use the already embedded RoboFont notifications: fontWillGenerate and fontDidGenerate

If this is not sufficient Batch could add his own notifications before and after generating binaries.

typemytype avatar Apr 25 '17 13:04 typemytype

Thank you for reminding me about these notifications! I will give it a go, and submit a pull request if I come up with something respectable. ;-)

Looking forward, would be cool for these notifications to also contain a designspace attribute if one is being used in the generation process.

djrrb avatar Apr 25 '17 15:04 djrrb

would be cool for these notifications to also contain a designspace attribute if one is being used in the generation process.

maybe Batch should add his own notifications and send the additional data like design space docs objects.

typemytype avatar Apr 26 '17 07:04 typemytype

I just made a first attempt a postprocessor, and it works when I use RoboFont’s File > Generate. But is it just me or is Batch not providing a fontDidGenerate notification?

from mojo.events import addObserver

class Postprocessor:
    
    def __init__(self):
        addObserver(self, "didGenerateObserver", "fontDidGenerate")
    
    def didGenerateObserver(self, info):
        print 'POSTPROCESS!!!!!!!'
Postprocessor()

djrrb avatar Apr 27 '17 21:04 djrrb

Hope I am not being a bother, just following up on the status of the fontDidGenerate notification,which at the moment still doesn't appear to fire when I generate a font with Batch (but fires as expected when I use File > Generate). Thanks for whatever advice you're able to give!

djrrb avatar May 16 '17 11:05 djrrb

Batch 2.0 is almost there

is there still a need to post notifications and maybe subscriber notifications specific from Batch?

something like batchDidGenerateFont(ufo/ufoOperator, binaryPath)

typemytype avatar Sep 21 '23 15:09 typemytype