Exemplo n.º 1
0
def buildAccentedGlyphs(junk,object):
#    """Get the names of the selected glyphs in a font.
#    
#    Call the composing function for every glyph that has an entry 
#    in the dictionary."""
#    componentsByFontname(font, font.fontname)
    font_file = os.path.normpath(fontforge.activeFont().path)
    top_level = os.path.split(os.path.split(font_file)[0])[0]
    tool_path = os.path.join(top_level, "tools")

    try:
        sys.path.append(tool_path)
        from glyphcomponents import glyphComponents
    
        if type(object).__name__ == "font":
            for glyph in object.selection.byGlyphs:
                if glyph.glyphname in glyphComponents.keys():
                    composeAccented(glyph)
                else:
                    continue
        else: 
            if object.glyphname in glyphComponents.keys():
                composeAccented(object)
            else:
                logWarning('This glyph has no entry in the dictionary')
    except ImportError:
        fontforge.postError("Cannot import Python module glyphcomponents",
                "This script is made to work with the SFDs residing in top_level/SFD and the module in top_level/tools.")
Exemplo n.º 2
0
def buildAccentedGlyphs(junk,object):
#    """Get the names of the selected glyphs in a font.
#    
#    Call the composing function for every glyph that has an entry 
#    in the dictionary."""
#    componentsByFontname(font, font.fontname)
    if type(object).__name__ == "font":
        for glyph in object.selection.byGlyphs:
            if glyph.glyphname in glyphComponents.keys():
                composeAccented(glyph)
            else:
                continue
    else: 
        if object.glyphname in glyphComponents.keys():
            composeAccented(object)
        else:
            logWarning('This glyph has no entry in the dictionary')