SOLVED Font Info



  • Font Info copy from a specific open UFO, copy a section(s) to and from etc.


  • admin

    more options:

    # get the source font
    f1 = AllFonts().getFontsByStyleName('Regular')[0]
    
    # get the destination font
    f2 = AllFonts().getFontsByStyleName('Bold')[0]
    
    f1.info.update(f2)
    


  • here’s an example script showing how to copy font info data from one open font to another:

    # get the source font
    f1 = AllFonts().getFontsByStyleName('Regular')[0]
    
    # get the destination font
    f2 = AllFonts().getFontsByStyleName('Bold')[0]
    
    # a list of font.info atrributes to copy
    attributes = [
        'familyName',
        'xHeight',
        'openTypeNameDesigner',
    ]
    
    # copy font.info data from f1 to f2
    for attr in attributes:
        # get value from source font
        value = getattr(f1.info, attr)
        # set value in destination font
        setattr(f2.info, attr, value)
    

    the complete list of font info attributes can be found in the UFO2 specification.


Log in to reply