Invalid groups



  • Hi,

    I’m very new to robofont so please forgive me if this question comes across silly.

    I’m exporting some fonts from fontlab to UFO and I keep getting the following warning upon opening in robofont. (screen grab attached)

    The ' tags I can only see from the output window, the groups and glyph names don’t seem to contain the ' tags, from what I can see. I can’t find where to remove the ' tags.

    Have other people had this issue? How did they resolve it?

    Best,
    —Bobby



  • An easy way I've found is to go to the Finder, right-click or control-click on the UFO and select "Show Package Contents". You will see a file called groups.plist. Open that in a plain text editor (like BBEdit or TextMate) and then search for "'" (the apostrophe) and replace with "" (nothing). Save the file and reopen the UFO in RoboFont. If the UFO was already open in RoboFont, it will put up a message about the UFO having been changed outside of RoboFont, which you can confirm.

    (Edit: Those should be "dumb" quotes above, not smart quotes. The forum software seems to be "fixing" them automatically.)


  • admin

    or easier, make a script that is removing all ':

    font = CurrentFont()
    
    for groupName, items in font.groups.items():
        newItems = []
        for glyphName in items:
            if "'" in glyphName:
                glyphName = glyphName.replace("'", "")
            newItems.append(glyphName)
        
        if newItems != items:
            ## something changed
            font.groups[groupName] = newItems
    

    and connect this script with event observer on fontDidOpen and it happens automatically.
    see http://doc.robofont.com/api/mojo/mojo-events/

    (RoboFont will never do this automatically cause one of the main principles is that the users should always be aware of what is happening with his/her font data)



  • Thank you both for your replies.

    I tried both methods and they worked perfectly.

    I couldn’t quite get the event observer to work properly as I’m pretty terrible at scripting.

    Thanks again.

    —B


  • admin

    that is easy too :)

    from mojo.events import addObserver
    
    class RenameGroupsObserver(object):
        
        def __init__(self):
            
            addObserver(self, "checkGroupNames", "fontDidOpen")
        
        def checkGroupNames(self, info):
            print "checking group names for single quotes"
            font = info["font"]
            
            for groupName, items in font.groups.items():
                newItems = []
                for glyphName in items:
                    if "'" in glyphName:
                        glyphName = glyphName.replace("'", "")
                    newItems.append(glyphName)
        
                if newItems != items:
                    ## something changed
                    font.groups[groupName] = newItems
            print "done checking group names"
    
    RenameGroupsObserver()
    

    save this script in a file and add it in the preferences as a start up script and you never ever have to worry about single quotes in groups.
    see http://doc.robofont.com/documentation/workspace/preferences/extensions/

    Your font data will change and importing the UFO back in FL will change the groups behavior, off course

    good luck