Font Info

RoboFont Forums Help / General Font Info

This topic contains 4 replies, has 3 voices, and was last updated by  frederik 6 years, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5936

    Jeremie
    Member

    Hi,

    Is there a way to copy all font infos from a font to another?

    #5937

    Jeremie
    Member

    OK,

    The only way I found to do this is that:
    https://github.com/sansplomb/RobofontTools/blob/master/Tests/copyFontInfos.py

    might be useful to some, unless there is a smarter way to do?

    #5938

    Jens K.
    Participant

    On the file system level, copy the

    fontinfo.plist

    from one UFO to the other.

    #5939

    Jeremie
    Member

    yep, this works too:

    ###
    import os
    import shutil
    
    f = CurrentFont()
    nf = NewFont(showUI=False)
    
    UFOroot = f.path
    infotail = 'fontinfo.plist'
    sourcefontinfopath = os.path.join(UFOroot, infotail)
    
    root, tail =  os.path.split(f.path)
    newUFOTail = 'New_' + tail.split('.')[0] + '.ufo'
    newUFOroot = os.path.join(root, newUFOTail)
    
    destfontinfopath = os.path.join(newUFOroot, infotail)
    
    nf.save(newUFOroot)
    
    shutil.copyfile(sourcefontinfopath, destfontinfopath)
    nf.close()
    
    RFont(newUFOroot)
    ###
    
    #5940

    frederik
    Keymaster

    an info object has a method asDict() returning a dict with all the key / values of the font info

    hope this helps

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.