def makeSortedGlyphLists(glyphList, fdGlyphDict):
    """
    Returns a list containing lists of glyph names (one for each FDDict).

    glyphList: list of all glyph names in the font

    fdGlyphDict: {'a': [2, 1], 'negative': [1, 2], '.notdef': [0, 0]}
                 keys: glyph names
                 values: [FDDict_index, glyph_index]
    """
    glyphSetList = [[]]
    for glyph_name in glyphList:
        try:
            fddict_index = fdGlyphDict[glyph_name][0]
            while len(glyphSetList) <= fddict_index:
                glyphSetList.append([])
            glyphSetList[fddict_index].append(glyph_name)
        except KeyError:
            glyphSetList[0].append(glyph_name)
    if len(glyphSetList) < 2:
        print(
            'Warning: There is only one hint dict. Maybe the fontinfo file has not been edited to add hint dict info.'
            )
    return glyphSetList
