How to use the gftools.util.glyphdata.DATA.by_name.get function in gftools

To help you get started, we’ve selected a few gftools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googlefonts / gftools / Lib / gftools / util / filter_lists.py View on Github external
def get_name_by_name(search_name, production_name=False):
    """
    Use this if you don't know what exact type your name is. E.g. when
    the names in your source are mixes friendly names and production names.

    Returns None if GlyphsData.xml doesn't contain search_name.
    """
    entry = (None, None)
    glyph = GlyphData.by_name.get(search_name, None) \
                            or GlyphData.by_prodname.get(search_name, None)
    if glyph is not None:
        entry = (glyph.name, glyph.production_name)
    return entry[1] if production_name else entry[0]