コード例 #1
0
def test_add_table():
    table_path = get_input_path('GDEF_italic.tb')
    font_path = get_input_path(ITALIC)
    actual_path = get_temp_file_path()
    assert font_has_table(font_path, 'GDEF') is False
    runner(CMD + ['-a', '-o', 'a', '_GDEF={}'.format(table_path),
                  '-f', font_path, actual_path])
    expected_path = get_expected_path('italic_w_GDEF.otf')
    assert differ([expected_path, actual_path, '-m', 'bin']) is False
    assert font_has_table(actual_path, 'GDEF')
    actual_ttx = generate_ttx_dump(actual_path)
    expected_ttx = generate_ttx_dump(expected_path)
    assert differ([expected_ttx, actual_ttx, '-s', '    <checkSumAdjustment'])
コード例 #2
0
def test_start_point_not_oncurve_bug715():
    filename = 'bug715'
    report_path = get_temp_file_path()
    actual_hstm_path = '{}.hstm.txt'.format(report_path)
    actual_vstm_path = '{}.vstm.txt'.format(report_path)
    expect_hstm_path = get_expected_path('{}.hstm.txt'.format(filename))
    expect_vstm_path = get_expected_path('{}.vstm.txt'.format(filename))

    runner(CMD + ['-f', '{}.ufo'.format(filename),
                  '-o', 'all', 'o', '_{}'.format(report_path)])

    assert differ([expect_hstm_path, actual_hstm_path, '-l', '1'])
    assert differ([expect_vstm_path, actual_vstm_path, '-l', '1'])
コード例 #3
0
def test_cross_environment_results_bug210():
    filename = 'bug210'
    report_path = get_temp_file_path()
    actual_top_path = '{}.top.txt'.format(report_path)
    actual_bot_path = '{}.bot.txt'.format(report_path)
    expect_top_path = get_expected_path('{}.top.txt'.format(filename))
    expect_bot_path = get_expected_path('{}.bot.txt'.format(filename))

    runner(CMD + ['-f', '{}.ufo'.format(filename),
                  '-o', 'a', 'g', '_a-z,A-Z,zero-nine',
                  'o', '_{}'.format(report_path)])

    assert differ([expect_top_path, actual_top_path, '-l', '1'])
    assert differ([expect_bot_path, actual_bot_path, '-l', '1'])
コード例 #4
0
def test_remove_overlap(args, ufo_filename, expct_label):
    actual_path = os.path.join(tempfile.mkdtemp(), ufo_filename)
    copytree(get_input_path(ufo_filename), actual_path)
    runner(CMD + ['-f', actual_path, '-o'] + args)
    expct_filename = '{}-{}'.format(ufo_filename[:-4], expct_label)
    expected_path = get_expected_path(expct_filename)
    assert differ([expected_path, actual_path])
コード例 #5
0
def test_report2():
    input_dir = get_input_path('font-family')
    expected_path = get_expected_path('font-family.txt')
    log_path = get_temp_file_path()
    runner(CMD + ['-o', 'd', '_{}'.format(input_dir),
                  'rm', 'rn', 'rp', 'l', '_{}'.format(log_path)])
    assert differ([expected_path, log_path, '-l', '1'])
コード例 #6
0
def test_st28_basic_cmap():
    input_dir = get_input_path('basic_cmap')
    expected_path = get_expected_path('st28_basic_cmap.txt')
    log_path = get_temp_file_path()
    runner(CMD + ['-o', 'st', '_28', 'd', '_{}'.format(input_dir),
                  'l', '_{}'.format(log_path)])
    assert differ([expected_path, log_path, '-l', '1'])
コード例 #7
0
def test_run_cli_with_output_path():
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'o', '_{}'.format(actual_path),
                  '_{}'.format(get_input_path(TEST_TTF_FILENAME))])
    actual_ttx = generate_ttx_dump(actual_path, ['maxp', 'glyf'])
    expected_ttx = get_expected_path('ttfcomponentizer.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #8
0
ファイル: makeotf_test.py プロジェクト: khaledhosny/afdko
def test_build_options_cs_cl_bug459(args, input_filename, ttx_filename):
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'o', '_{}'.format(actual_path)] + args)
    actual_ttx = generate_ttx_dump(actual_path, ['cmap'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #9
0
ファイル: sfntdiff_test.py プロジェクト: khaledhosny/afdko
def test_diff(args, txt_filename):
    if args:
        args.insert(0, '-o')
    actual_path = runner(
        ['-t', TOOL, '-s', '-f', 'regular.otf', 'bold.otf'] + args)
    expected_path = get_expected_path(txt_filename)
    assert differ([expected_path, actual_path, '-l', '1-4'])
コード例 #10
0
ファイル: tx_test.py プロジェクト: adobe-type-tools/afdko
def test_cff2_extract(args, exp_filename):
    # read CFF2 VF, write CFF2 table
    font_path = get_input_path('SourceCodeVariable-Roman.otf')
    cff2_path = get_temp_file_path()
    runner(CMD + ['-a', '-f', font_path, cff2_path, '-o', 'cff2'] + args)
    expected_path = get_expected_path(exp_filename)
    assert differ([expected_path, cff2_path, '-m', 'bin'])
コード例 #11
0
ファイル: tx_test.py プロジェクト: adobe-type-tools/afdko
def test_recalculate_font_bbox_bug618(to_format, args, exp_filename):
    font_path = get_input_path('bug618.pfa')
    save_path = get_temp_file_path()

    runner(CMD + ['-f', font_path, save_path, '-o', to_format] + args)

    file_ext = to_format
    if to_format == 't1':
        file_ext = 'pfa'
    elif to_format == 'afm':
        file_ext = 'txt'

    expected_path = get_expected_path(
        'bug618/{}.{}'.format(exp_filename, file_ext))

    diff_mode = []
    if to_format == 'cff':
        diff_mode = ['-m', 'bin']

    skip = []
    if to_format == 'afm':
        skip = ['-s', 'Comment Creation Date:' + SPLIT_MARKER +
                'Comment Copyright']

    assert differ([expected_path, save_path] + diff_mode + skip)
コード例 #12
0
def test_cjk_var():
    """
    Builds all OTFs for the 'CJKVar' project and then diffs two of them.
    """
    input_dir = get_input_path('CJKVar')
    temp_dir = os.path.join(tempfile.mkdtemp(), 'CJKVar')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'CJKVar.designspace')
    runner(CMD + ['-o', '_{}'.format(ds_path)])

    otf1_path = os.path.join(
        temp_dir, 'Normal', 'Master_8', 'MasterSet_Kanji-w600.00.otf')
    otf2_path = os.path.join(
        temp_dir, 'Condensed', 'Master_8', 'MasterSet_Kanji_75-w600.00.otf')

    for otf_path in (otf1_path, otf2_path):
        actual_ttx = generate_ttx_dump(otf_path)
        expected_ttx = get_expected_path(
            os.path.basename(otf_path)[:-3] + 'ttx')
        assert differ([expected_ttx, actual_ttx,
                       '-s',
                       '<ttFont sfntVersion' + SPLIT_MARKER +
                       '    <checkSumAdjustment value=' + SPLIT_MARKER +
                       '    <created value=' + SPLIT_MARKER +
                       '    <modified value=',
                       '-r', r'^\s+Version.*;hotconv.*;makeotfexe'])
コード例 #13
0
def test_report(font_family, font_format):
    input_dir = os.path.join(get_input_path(font_family), font_format)
    log_path = get_temp_file_path()
    runner(CMD + ['-o', 'd', '_{}'.format(input_dir), 'tolerance', '_3',
                  'rm', 'rn', 'rp', 'l', '_{}'.format(log_path)])
    expected_path = get_expected_path('{}_{}.txt'.format(
                                      font_family, font_format))
    assert differ([expected_path, log_path, '-l', '1'])
コード例 #14
0
def test_linux_ci_failure_bug570():
    table_path = get_input_path('1_fdict.cff')
    font_path = get_input_path('core.otf')
    actual_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'a', '_CFF={}'.format(table_path),
                  '-f', font_path, actual_path])
    expected_path = get_expected_path('1_fdict.otf')
    assert differ([expected_path, actual_path, '-m', 'bin'])
コード例 #15
0
ファイル: tx_test.py プロジェクト: adobe-type-tools/afdko
def test_cff2_sub_dump():
    # Dump a subroutinized CFF2 font. This is a J font with 64K glyphs,
    # and almost every subr and charstring is a single subr call.
    # A good test for problems with charstrings with no endchar operator.
    actual_path = runner(CMD + ['-s', '-o', 'dump', '6', 'g', '_21847',
                                '-f', 'CFF2-serif-sub.cff2'])
    expected_path = get_expected_path('CFF2-serif-sub.cff2.txt')
    assert differ([expected_path, actual_path])
コード例 #16
0
def test_beztools_hhint_over_limit_bug629():
    test_filename = 'bug629.pfa'
    actual_path = get_temp_file_path()
    expected_path = get_expected_path(test_filename)
    runner(CMD + ['-o', 'nb', 'o', '_{}'.format(actual_path),
                  '-f', test_filename])
    assert differ([expected_path, actual_path,
                   '-s', r'%%Copyright: Copyright'])
コード例 #17
0
def test_missing_table_extract_bug160():
    actual_path = get_temp_file_path()
    stderr_path = runner(CMD + ['-s', '-e', '-f', LIGHT, actual_path, '-o',
                                'x', '_xyz,head={}'.format(actual_path)])
    with open(stderr_path, 'rb') as f:
        output = f.read()
    assert b'[WARNING]: table missing (xyz )' in output
    expected_path = get_expected_path('head_light.tb')
    assert differ([expected_path, actual_path, '-m', 'bin'])
コード例 #18
0
def test_convert(otf_filenames, ttc_filename, tables_msg):
    actual_path = get_temp_file_path()
    expected_path = get_expected_path(ttc_filename)
    stdout_path = runner(CMD + ['-s', '-o', 'o', '_{}'.format(actual_path),
                                '-f'] + otf_filenames)
    with open(stdout_path, 'rb') as f:
        output = f.read()
    assert tables_msg in output
    assert differ([expected_path, actual_path, '-m', 'bin'])
コード例 #19
0
def test_outline_from_processed_layer_bug703():
    input_filename = 'bug703.ufo'
    ttx_filename = 'bug703.ttx'
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['CFF '])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #20
0
ファイル: tx_test.py プロジェクト: adobe-type-tools/afdko
def test_cff2_no_vf_bug353():
    # read CFF2 WITHOUT VF info, write a CFF2 out. 'regular_CFF2.otf'
    # is derived by taking the regular.otf file from the sfntdiff
    # 'input_data' directory, and converting the CFF table to CFF2.
    font_path = get_input_path('regular_CFF2.otf')
    cff2_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, cff2_path])
    expected_path = get_expected_path('regular_CFF2.cff2')
    assert differ([expected_path, cff2_path, '-m', 'bin'])
コード例 #21
0
def test_options(args, ufo_filename, num):
    runner(['-t', TOOL, '-o', 'd',
            '_{}'.format(get_input_path('font.designspace')), 'i'] + args)
    if num:
        expct_filename = '{}{}.ufo'.format(ufo_filename[:-4], num)
    else:
        expct_filename = ufo_filename
    expected_path = _get_output_path(expct_filename, 'expected_output')
    actual_path = _get_output_path(ufo_filename, 'temp_output')
    assert differ([expected_path, actual_path])
コード例 #22
0
ファイル: tx_test.py プロジェクト: tacitum/afdko
def test_dcf_call_depth_with_many_calls_bug846():
    # This font was getting an invalid subroutine count because tx wasn't
    # decrementing the subroutine call depth after the subroutine calls,
    # so it was effectively just counting the total number of calls,
    # not the call depth.
    font_path = get_input_path('SHSansJPVFTest_SUBR.otf')
    dcf_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'dcf', '-f', font_path, dcf_path])
    expected_path = get_expected_path('SHSansJPVFTest_SUBR.dcf.txt')
    assert differ([expected_path, dcf_path])
コード例 #23
0
ファイル: tx_test.py プロジェクト: tacitum/afdko
def test_ufo_altlayer(layer_name):
    if not layer_name:
        fname = 'processed'
        args = []
    else:
        fname = 'foreground' if layer_name == 'None' else layer_name
        args = ['altLayer', f'_{fname}']
    actual_path = runner(CMD + ['-s', '-f', 'altlayer.ufo', '-o', '6'] + args)
    expected_path = get_expected_path(f'altlayer_{fname}.txt')
    assert differ([expected_path, actual_path])
コード例 #24
0
ファイル: makeotf_test.py プロジェクト: vsujeesh/afdko
def test_outline_from_processed_layer_bug703():
    input_filename = 'bug703.ufo'
    ttx_filename = 'bug703.ttx'
    actual_path = get_temp_file_path()
    runner(CMD + [
        '-o', 'f', f'_{get_input_path(input_filename)}', 'o', f'_{actual_path}'
    ])
    actual_ttx = generate_ttx_dump(actual_path, ['CFF '])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #25
0
ファイル: buildcff2vf_test.py プロジェクト: vsujeesh/afdko
def test_compatibility_vf():
    input_dir = get_input_path('bug816')
    temp_dir = get_temp_dir_path('bug816var')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'bug816.designspace')
    runner(CMD + ['-o', 'c', 'd', f'_{ds_path}'])
    actual_path = os.path.join(temp_dir, 'bug816.otf')
    actual_ttx = generate_ttx_dump(actual_path, ['CFF2'])
    expected_ttx = get_expected_path('bug816.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #26
0
def test_t_option():
    actual_path = get_temp_file_path()
    expected_path = get_expected_path('shared_glyf.ttc')
    stdout_path = runner(CMD + [
        '-s', '-o', 'o', f'_{actual_path}', 't', '_glyf=0', '-f', FONT0, FONT1
    ])
    with open(stdout_path, 'rb') as f:
        output = f.read()
    assert MSG_5 in output
    assert differ([expected_path, actual_path, '-m', 'bin'])
コード例 #27
0
def test_round_glyph_bounds_values_bug128(font_format):
    bug_numb = 'bug128'
    pdf_filename = f'{bug_numb}_{font_format}.pdf'
    font_path = get_input_path(f'{bug_numb}/font.{font_format}')
    save_path = get_temp_file_path()
    runner(['-t', 'charplot', '-o', 'o', f'_{save_path}', 'g', '_o',
            'dno', '=pageIncludeTitle', '_0', '-f', font_path, '-a'])
    expected_path = get_expected_path(pdf_filename)
    assert differ([expected_path, save_path,
                   '-s', '/CreationDate', '-e', 'macroman'])
コード例 #28
0
ファイル: tx_test.py プロジェクト: download8866/afdko-chinese
def test_convert(from_format, to_format):
    from_ext = _get_extension(from_format)
    to_ext = _get_extension(to_format)

    # input filename
    from_filename = from_format + from_ext

    # expected filename
    exp_filename = from_format + to_ext

    # runner args
    if 'ufo' in to_format:
        save_path = get_temp_dir_path('font.ufo')
    else:
        save_path = get_temp_file_path()

    # diff mode
    if to_format == 'cff':
        diff_mode = ['-m', 'bin']
    else:
        diff_mode = []

    # skip items
    regex_skip = []
    skip = []
    if to_format == 'afm':
        skip = ['Comment Creation Date:' + SPLIT_MARKER + 'Comment Copyright']
    elif to_format == 'pdf':
        skip = PDF_SKIP[:]
        regex_skip = PDF_SKIP_REGEX[:]
    elif to_format == 'ps':
        skip = PS_SKIP[:]
    elif to_format == 'type1':
        skip = PFA_SKIP[:]
    if skip:
        skip.insert(0, '-s')
    if regex_skip:
        for regex in regex_skip:
            skip.append('-r')
            skip.append(regex)

    # format arg fix
    if to_format in ('ufo2', 'ufo3'):
        format_arg = 'ufo'
    elif to_format == 'type1':
        format_arg = 't1'
    else:
        format_arg = to_format

    runner(CMD + [
        '-a', '-f',
        get_input_path(from_filename), save_path, '-o', format_arg
    ])
    expected_path = get_expected_path(exp_filename)
    assert differ([expected_path, save_path] + skip + diff_mode)
コード例 #29
0
def test_GDEF_LigatureCaret_bug155(caret_format):
    input_filename = 'bug155/font.pfa'
    feat_filename = 'bug155/caret-{}.fea'.format(caret_format)
    ttx_filename = 'bug155/caret-{}.ttx'.format(caret_format)
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GDEF'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-l', '2'])
コード例 #30
0
ファイル: tx_test.py プロジェクト: adobe-type-tools/afdko
def test_long_charstring_write():
    # read a CFF2 VF with a charstring longer that 65535, write out CFF2 file
    # NOTE: the font 'CJK-VarTest.otf' cannot be used in this test because
    # once its long charstring is optimized (floats -> ints) it's no longer
    # over the 65535 bytes limit; the long charstring in 'CJK-VarTest2.otf' is
    # already as small as possible, so it will trigger the check in cffwrite.c
    font_path = get_input_path('CJK-VarTest2.otf')
    cff2_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, cff2_path])
    expected_path = get_expected_path('CJK-VarTest2.cff2')
    assert differ([expected_path, cff2_path, '-m', 'bin'])
コード例 #31
0
ファイル: buildcff2vf_test.py プロジェクト: z4rd/afdko
def test_cjk_vf():
    input_dir = get_input_path('CJKVar')
    temp_dir = os.path.join(tempfile.mkdtemp(), 'CJKVar')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'CJKVar.designspace')
    runner(CMD + ['-o', 'd', '_{}'.format(ds_path)])
    actual_path = os.path.join(temp_dir, 'CJKVar.otf')
    actual_ttx = generate_ttx_dump(actual_path,
                                   ['CFF2', 'HVAR', 'avar', 'fvar'])
    expected_ttx = get_expected_path('CJKVar.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #32
0
def _compare_results(otf_path):
    actual_ttx = generate_ttx_dump(otf_path)
    expected_ttx = get_expected_path(
        os.path.basename(otf_path)[:-3] + 'ttx')
    return differ([expected_ttx, actual_ttx,
                   '-s',
                   '<ttFont sfntVersion' + SPLIT_MARKER +
                   '    <checkSumAdjustment value=' + SPLIT_MARKER +
                   '    <created value=' + SPLIT_MARKER +
                   '    <modified value=',
                   '-r', r'^\s+Version.*;hotconv.*;makeotfexe'])
コード例 #33
0
def test_subset_vf():
    input_dir = get_input_path('bug817')
    temp_dir = get_temp_dir_path('bug817var')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'bug817.designspace')
    subset_path = os.path.join(temp_dir, 'bug817.subset')
    runner(CMD + ['-o', 'd', f'_{ds_path}', 'i', f'_{subset_path}'])
    actual_path = os.path.join(temp_dir, 'bug817.otf')
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB'])
    expected_ttx = get_expected_path('bug817.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #34
0
def test_useMarkFilteringSet_flag_bug196():
    input_filename = "bug196/font.pfa"
    feat_filename = "bug196/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug196.ttx"
    runner(CMD + ['-o', 'f', f'_{get_input_path(input_filename)}',
                        'ff', f'_{get_input_path(feat_filename)}',
                        'o', f'_{actual_path}'])
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #35
0
def test_output_file_option(input_font, expected_font):
    """
    Test the '-o' (output file) option.
    """
    in_path = get_input_path(input_font)
    out_path = os.path.join(get_temp_dir_path(), input_font)
    expected_path = get_expected_path(expected_font)
    runner(CMD + ['-f', in_path, '-o', 'e', 'o', '_' + out_path])

    assert get_font_format(out_path) == get_font_format(in_path)
    assert differ([expected_path, out_path])
コード例 #36
0
def test_contextual_multiple_substitutions_bug725():
    input_filename = "bug725/font.pfa"
    feat_filename = "bug725/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug725.ttx"
    runner(CMD + ['-o', 'f', f'_{get_input_path(input_filename)}',
                        'ff', f'_{get_input_path(feat_filename)}',
                        'o', f'_{actual_path}'])
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #37
0
def test_base_anchor_bug811():
    input_filename = 'bug811/font.pfa'
    feat_filename = 'bug811/feat.fea'
    ttx_filename = 'bug811.ttx'
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', f'_{get_input_path(input_filename)}',
                        'ff', f'_{get_input_path(feat_filename)}',
                        'o', f'_{actual_path}'])
    actual_ttx = generate_ttx_dump(actual_path, ['GPOS'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #38
0
ファイル: tx_test.py プロジェクト: adobe-type-tools/afdko
def test_cs_opt_bug684(filename):
    """ The input CFF2 variable font contains a long single charstring
    making the maximum use of the operand stack.
    tx was generating a bad CFF2 charstring that would overflow
    the operand stack of the standard size (513) after re-converted
    to CFF2 unless -no_opt option is specified."""
    font_path = get_input_path('{}.otf'.format(filename))
    result_path = get_temp_file_path()
    expected_path = get_expected_path('{}.cff2'.format(filename))
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, result_path])
    assert differ([expected_path, result_path, '-m', 'bin'])
コード例 #39
0
def test_contextual_multiple_substitutions_bug725():
    input_filename = "bug725/font.pfa"
    feat_filename = "bug725/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug725.ttx"
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #40
0
def test_cjk_vf():
    input_dir = get_input_path('CJKVar')
    temp_dir = os.path.join(tempfile.mkdtemp(), 'CJKVar')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'CJKVar.designspace')
    runner(CMD + ['-o', 'p', '_{}'.format(ds_path)])
    actual_path = os.path.join(temp_dir, 'CJKVar.otf')
    actual_ttx = generate_ttx_dump(actual_path,
                                   ['CFF2', 'HVAR', 'avar', 'fvar'])
    expected_ttx = get_expected_path('CJKVar.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #41
0
def test_ignore_contour_order(input_font, expected_font):
    """
    Test the '--ignore-contour-order' option.
    """
    in_path = get_input_path(input_font)
    out_path = os.path.join(get_temp_dir_path(), input_font)
    expected_path = get_expected_path(expected_font)
    runner(CMD + ['-f', in_path, '-o', '=ignore-contour-order', '=all', 'e',
                  'q', 'o', '_' + out_path])
    assert get_font_format(out_path) == get_font_format(in_path)
    assert differ([expected_path, out_path, '-r', r'^\s*<point'])
コード例 #42
0
ファイル: tx_test.py プロジェクト: iterumllc/afdko
def test_nonstd_fontmatrix(fmt):
    input_path = get_input_path("nonstdfmtx.otf")
    txt_filename = f"nonstdfmtx_{fmt}.txt"
    expected_path = get_expected_path(txt_filename)
    output_dir = get_temp_dir_path()
    bin_output = os.path.join(output_dir, f"nonstdfmtx.{fmt}")
    output_path = os.path.join(output_dir, txt_filename)
    runner(CMD + ['-a', '-o', fmt, '*S', '*b', '-f', input_path, bin_output])
    runner(CMD + ['-a', '-o', 'dump', '-f', bin_output, output_path])
    skip = "## Filename "
    assert differ([expected_path, output_path, '-s', skip])
コード例 #43
0
def test_mark_refer_diff_classes_bug416():
    input_filename = "bug416/font.pfa"
    feat_filename = "bug416/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug416.ttx"
    runner(CMD + ['-o', 'f', f'_{get_input_path(input_filename)}',
                        'ff', f'_{get_input_path(feat_filename)}',
                        'o', f'_{actual_path}'])
    actual_ttx = generate_ttx_dump(actual_path, ['GPOS'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #44
0
def test_useMarkFilteringSet_flag_bug196():
    input_filename = "bug196/font.pfa"
    feat_filename = "bug196/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug196.ttx"
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #45
0
def test_notdef_in_glyph_class_bug726():
    input_filename = "bug726/font.pfa"
    feat_filename = "bug726/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug726.ttx"
    runner(CMD + ['-o', 'f', f'_{get_input_path(input_filename)}',
                        'ff', f'_{get_input_path(feat_filename)}',
                        'o', f'_{actual_path}'])
    actual_ttx = generate_ttx_dump(actual_path, ['GDEF'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #46
0
def test_useException_bug321():
    input_filename = "bug321/font.pfa"
    feat_filename = "bug321/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug321.ttx"
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB', 'GPOS'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #47
0
def test_GDEF_LigatureCaret_bug155(caret_format):
    input_filename = 'bug155/font.pfa'
    feat_filename = f'bug155/caret-{caret_format}.fea'
    ttx_filename = f'bug155/caret-{caret_format}.ttx'
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', f'_{get_input_path(input_filename)}',
                        'ff', f'_{get_input_path(feat_filename)}',
                        'o', f'_{actual_path}'])
    actual_ttx = generate_ttx_dump(actual_path, ['GDEF'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-l', '2'])
コード例 #48
0
def test_mark_refer_diff_classes_bug416():
    input_filename = "bug416/font.pfa"
    feat_filename = "bug416/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug416.ttx"
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GPOS'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #49
0
def test_useException_bug321():
    input_filename = "bug321/font.pfa"
    feat_filename = "bug321/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug321.ttx"
    runner(CMD + ['-o', 'f', f'_{get_input_path(input_filename)}',
                        'ff', f'_{get_input_path(feat_filename)}',
                        'o', f'_{actual_path}'])
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB', 'GPOS'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #50
0
ファイル: tx_test.py プロジェクト: molandtoxx/afdko
def test_long_charstring_write():
    # read a CFF2 VF with a charstring longer that 65535, write out CFF2 file
    # NOTE: the font 'CJK-VarTest.otf' cannot be used in this test because
    # once its long charstring is optimized (floats -> ints) it's no longer
    # over the 65535 bytes limit; the long charstring in 'CJK-VarTest2.otf' is
    # already as small as possible, so it will trigger the check in cffwrite.c
    font_path = get_input_path('CJK-VarTest2.otf')
    cff2_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, cff2_path])
    expected_path = get_expected_path('CJK-VarTest2.cff2')
    assert differ([expected_path, cff2_path, '-m', 'bin'])
コード例 #51
0
ファイル: tx_test.py プロジェクト: molandtoxx/afdko
def test_cs_opt_bug684(filename):
    """ The input CFF2 variable font contains a long single charstring
    making the maximum use of the operand stack.
    tx was generating a bad CFF2 charstring that would overflow
    the operand stack of the standard size (513) after re-converted
    to CFF2 unless -no_opt option is specified."""
    font_path = get_input_path(f'{filename}.otf')
    result_path = get_temp_file_path()
    expected_path = get_expected_path(f'{filename}.cff2')
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, result_path])
    assert differ([expected_path, result_path, '-m', 'bin'])
コード例 #52
0
def test_rvrn_vf():
    input_dir = get_input_path('GSUBVar')
    temp_dir = get_temp_dir_path('GSUBVar')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'GSUBVar.designspace')
    runner(CMD + ['-o', 'd', f'_{ds_path}'])
    actual_path = os.path.join(temp_dir, 'GSUBVar.otf')
    actual_ttx = generate_ttx_dump(actual_path,
                                   ['CFF2', 'GSUB', 'avar', 'fvar'])
    expected_ttx = get_expected_path('GSUBVar.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
コード例 #53
0
ファイル: tx_test.py プロジェクト: molandtoxx/afdko
def test_many_hints_string_bug354():
    # The glyph T@gid002 has 33 hstem hints. This tests a bug where
    # tx defined an array of only 6 operands.
    # This is encountered only when wrinting to a VF CFF2.
    font_path = get_input_path('cff2_vf.otf')
    cff2_path = get_temp_file_path()
    dcf_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, cff2_path])
    runner(CMD + ['-a', '-o', 'dcf', '-f', cff2_path, dcf_path])
    expected_path = get_expected_path('cff2_vf.dcf.txt')
    assert differ([expected_path, dcf_path])
コード例 #54
0
ファイル: tx_test.py プロジェクト: adobe-type-tools/afdko
def test_many_hints_string_bug354():
    # The glyph T@gid002 has 33 hstem hints. This tests a bug where
    # tx defined an array of only 6 operands.
    # This is encountered only when wrinting to a VF CFF2.
    font_path = get_input_path('cff2_vf.otf')
    cff2_path = get_temp_file_path()
    dcf_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, cff2_path])
    runner(CMD + ['-a', '-o', 'dcf', '-f', cff2_path, dcf_path])
    expected_path = get_expected_path('cff2_vf.dcf.txt')
    assert differ([expected_path, dcf_path])
コード例 #55
0
ファイル: sfntedit_test.py プロジェクト: z4rd/afdko
def test_missing_table_extract_bug160():
    actual_path = get_temp_file_path()
    stderr_path = runner(CMD + [
        '-s', '-e', '-f', LIGHT, actual_path, '-o', 'x', '_xyz,head={}'.format(
            actual_path)
    ])
    with open(stderr_path, 'rb') as f:
        output = f.read()
    assert b'[WARNING]: table missing (xyz )' in output
    expected_path = get_expected_path('head_light.tb')
    assert differ([expected_path, actual_path, '-m', 'bin'])
コード例 #56
0
ファイル: proofpdf_test.py プロジェクト: ystallonne/afdko
def test_seac_in_charstring_bug125(tool_name):
    pdf_filename = f'bug125_{tool_name}.pdf'
    font_path = get_input_path('seac.otf')
    save_path = get_temp_file_path()
    runner([
        '-t', tool_name, '-o', 'o', f'_{save_path}', 'dno',
        '=pageIncludeTitle', '_0', '-f', font_path, '-a'
    ])
    expected_path = get_expected_path(pdf_filename)
    assert differ(
        [expected_path, save_path, '-s', '/CreationDate', '-e', 'macroman'])
コード例 #57
0
ファイル: stemhist_test.py プロジェクト: ystallonne/afdko
def test_cross_environment_results_bug210():
    filename = 'bug210'
    report_path = get_temp_file_path()
    actual_top_path = f'{report_path}.top.txt'
    actual_bot_path = f'{report_path}.bot.txt'
    expect_top_path = get_expected_path(f'{filename}.top.txt')
    expect_bot_path = get_expected_path(f'{filename}.bot.txt')

    runner(CMD + [
        '-f',
        f'{filename}.ufo',
        '-o',
        'o',
        f'_{report_path}',
        'z',
        'g',
        '_a-z,A-Z,zero-nine',
    ])

    assert differ([expect_top_path, actual_top_path, '-l', '1'])
    assert differ([expect_bot_path, actual_bot_path, '-l', '1'])
コード例 #58
0
def test_build_font_and_check_messages(args, ttx_fname):
    actual_path = get_temp_file_path()
    expected_msg_path = get_expected_path(f'{ttx_fname}_output.txt')
    ttx_filename = f'{ttx_fname}.ttx'
    stderr_path = runner(CMD + [
        '-s', '-e', '-o', 'f', f'_{get_input_path("font.pfa")}', 'o',
        f'_{actual_path}'
    ] + args)
    actual_ttx = generate_ttx_dump(actual_path)
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([
        expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion' + SPLIT_MARKER +
        '    <checkSumAdjustment value=' + SPLIT_MARKER +
        '    <checkSumAdjustment value=' + SPLIT_MARKER +
        '    <created value=' + SPLIT_MARKER + '    <modified value=', '-r',
        r'^\s+Version.*;hotconv.*;makeotfexe'
    ])
    assert differ([
        expected_msg_path, stderr_path, '-r',
        r'^Built (development|release) mode font'
    ])
コード例 #59
0
def test_options(args, exp_filename):
    if 'CFF_=7' in exp_filename or exp_filename == 'glyph_proof.ps':
        skip = ['0 743.4 moveto (CFF:']
    elif 'CFF_=6' in exp_filename:
        skip = ['318 764 moveto (' + SPLIT_MARKER + '72 750 moveto (']
    else:
        skip = []
    if skip:
        skip.insert(0, '-s')
    actual_path = runner(CMD + ['-s', '-f', 'black.otf', '-o'] + args)
    expected_path = get_expected_path(exp_filename)
    assert differ([expected_path, actual_path] + skip)
コード例 #60
0
def test_convert(filename):
    input_path = get_input_path('{}.otf'.format(filename))
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'o', '_{}'.format(actual_path), '-f', input_path])
    actual_ttx = generate_ttx_dump(actual_path)
    expected_ttx = get_expected_path('{}.ttx'.format(filename))
    assert differ([
        expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion' + SPLIT_MARKER +
        '    <checkSumAdjustment value=' + SPLIT_MARKER +
        '    <checkSumAdjustment value=' + SPLIT_MARKER +
        '    <created value=' + SPLIT_MARKER + '    <modified value='
    ])