SOLVED Data folder



  • Hi,

    I'm generating mark feature in the mark positioning tool I wrote and I was wondering:
    1- Should I save it inside the data folder specified here in the spec or make a directory named mark next to the UFO dir.
    2- If I make the data folder, is it safe to change it using my own code or there is an internal safe method to do that?

    Thanks


  • admin

    you can store your tool specific data in the data folder!

    defcon has an api for reading and writing files, not for folders inside the data folder.

    font = CurrentFont()
    defconFont = font.naked()
    print(defconFont)
    
    
    print(defconFont.data.fileNames)
    
    
    # data must be bytes
    defconFont.data["com.bahman.superKernTool.as.bytes"] = b"myData"
    
    myData = dict()
    myData["superkern"] = "foo"
    defconFont.data["com.bahman.superKernTool.as.plist"] = plistlib.dumps(myData)
    
    
    defconFont.save('test.ufo')
    

    good luck


Log in to reply