Adjust preferences based on UFO document?



  • I was wondering if there could be a possibility to adjust preferences based on the UFO opened.

    For example:

    • adjust the grid and snap values for a low-UPM project
    • override the previewSolid observer to be outlined (for a skeleton font, for example)

    etc.

    Right now, I have this idea of just adding a .py file (which would change preferences) in the /data directory of my UFO file, and have a startup script look for such a file. However, I wonder if there’s better suggestions for accomplishing the same.
    (One downside of my idea is a permanent change of the preferences, rather than a by-project approach).


  • admin

    the /data folder seems like a good place

    you can subscribe to fontBecameCurrent and execute the .py file with

    from lib.scripting.scriptTools import ScriptRunner
    
    ScriptRunner("path/To/script.py)