def generate_webfont(otf_path, strip_names=False, woff=True, woff_path=None, woff2=False, woff2_path=None, clear_ttx=True, clear_otf_tmp=True):
    """
    Generate obfuscated webfont in woff and/or woff2 formats from an otf/ttf input file.

    """
    file_name, extension = os.path.splitext(otf_path)

    # strip font infos (webfont obfuscation)
    if strip_names:
        ttx_path = '%s.ttx' % file_name
        otf2ttx(otf_path, ttx_path)
        ttx_strip_names(ttx_path)
        otf_path_tmp = '%s_tmp.otf' % file_name
        ttx2otf(ttx_path, otf_path_tmp)
        if clear_ttx:
            os.remove(ttx_path)

    # generate woff
    if woff:
        if woff_path is None:
            woff_path = '%s.woff' % file_name
        sfnt2woff(otf_path_tmp, woff_path)

    # generate woff2
    if woff2:
        if woff_path is None:
            woff2_path = '%s.woff2' % file_name
        woff2_compress(otf_path_tmp, woff2_path)

    # clear temporary ttx file
    if clear_otf_tmp:
        os.remove(otf_path_tmp)

#------------
# WOFF tools
#------------
dataset/ETHPy150Open gferreira/hTools2/Lib/hTools2/modules/webfonts.py/generate_webfont/original