Exemplo n.º 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'])
Exemplo n.º 2
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', f'_GDEF={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'])
Exemplo n.º 3
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'
        ])
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'])
Exemplo n.º 5
0
def test_heap_after_free_bug1349():
    """
    Heap used after free because of stale pointer
    after realloc. This wiped out some values
    in name table.
    """
    folder = "bug1349/"
    input_filename = get_input_path(folder + "cidfont.subset")
    output_filename = get_temp_file_path()
    features_filename = get_input_path(folder + "features.VF.HW.J")
    db_filename = get_input_path(folder + "FontMenuNameDB.VF.Mono")
    cmap_filename = get_input_path(folder + "UniSourceHanSansHWJP-UTF32-H")
    lic_name = "ADOBE"
    cmd = CMD + ['-o',
                 'f', f'_{input_filename}',
                 'o', f'_{output_filename}',
                 'shw', 'omitMacNames',
                 'ff', f'_{features_filename}',
                 'mf', f'_{db_filename}',
                 'r', 'nS', 'cs', '1',
                 'ch', f'_{cmap_filename}',
                 'lic', f'_{lic_name}']
    runner(cmd)
    output_dump = generate_ttx_dump(output_filename, ['name'])
    assert differ([output_dump, get_expected_path("bug1349.ttx"),
                   '-s', '<ttFont sfntVersion='])
Exemplo n.º 6
0
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'])
Exemplo n.º 7
0
def test_feature_file(name):
    try:
        input_filename = "fealib/font.pfa"
        feat_filename = f"fealib/{name}.fea"
        ttx_filename = f"fealib/{name}.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}'
        ])

        tables = TEST_FEATURE_FILES_TABLES.get(name, TEST_TABLES)
        actual_ttx = generate_ttx_dump(actual_path, tables)
        expected_ttx = get_expected_path(ttx_filename)
        assert differ([
            expected_ttx, actual_ttx, '-l', '2', '-s',
            '    <checkSumAdjustment value=' + SPLIT_MARKER +
            '    <checkSumAdjustment value=' + SPLIT_MARKER +
            '    <created value=' + SPLIT_MARKER + '    <modified value=',
            '-r', r'^\s+Version.*;hotconv.*;makeotfexe'
        ])
    except Exception:
        if name in TEST_FEATURE_FILES_XFAIL:
            pytest.xfail()
        raise
Exemplo n.º 8
0
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'])
Exemplo n.º 9
0
def test_remove_overlap_otf():
    actual_path = get_temp_file_path()
    copy2(get_input_path('font.otf'), actual_path)
    runner(CMD + ['-f', actual_path, '-o', 'e', 'q'])
    actual_ttx = generate_ttx_dump(actual_path, ['CFF '])
    expected_ttx = get_expected_path('font.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Exemplo n.º 10
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'])
def test_run_cli_with_output_path():
    actual_path = get_temp_file_path()
    runner(CMD + [
        '-o', 'o', f'_{actual_path}', f'_{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'])
Exemplo n.º 12
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'])
Exemplo n.º 13
0
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'])
Exemplo n.º 14
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'])
Exemplo n.º 15
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'])
Exemplo n.º 16
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'])
Exemplo n.º 17
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'])
Exemplo n.º 18
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'])
Exemplo n.º 19
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'])
Exemplo n.º 20
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'])
Exemplo n.º 21
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'])
Exemplo n.º 22
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'])
Exemplo n.º 23
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', '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'])
Exemplo n.º 24
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'])
Exemplo n.º 25
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'])
Exemplo n.º 26
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'])
Exemplo n.º 27
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'])
Exemplo n.º 28
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'])
Exemplo n.º 29
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'])
Exemplo n.º 30
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'])
Exemplo n.º 31
0
def test_bug1040(cmap_filename, cs, expectedOS2):
    out_path = get_temp_file_path()
    cmd = CMD + ['-o', 'f', f'_{get_input_path("bug1040/cidfont.ps")}',
                       'cs', f'_{cs}',
                       'o', f'_{out_path}',
                       'ch', f'_{get_input_path("bug1040/" + cmap_filename)}']
    runner(cmd)

    actual_ttx = generate_ttx_dump(out_path, ["OS/2"])
    expected_ttx = get_expected_path("bug1040/" + expectedOS2)

    assert differ([expected_ttx, actual_ttx, '-l', '2'])
Exemplo n.º 32
0
def test_convert_ttc(filename):
    input_path = get_input_path(f'{filename}.ttc')
    actual_path = get_temp_file_path()
    otf2ttf(['-o', actual_path, input_path])
    actual_ttx = generate_ttx_dump(actual_path)
    expected_ttx = get_expected_path('ttf_ttf.ttx')
    assert differ([
        expected_ttx, actual_ttx, '-s', '<ttCollection ttLibVersion=' +
        SPLIT_MARKER + '      <checkSumAdjustment value=' + SPLIT_MARKER +
        '      <checkSumAdjustment value=' + SPLIT_MARKER +
        '      <created value=' + SPLIT_MARKER + '      <modified value='
    ])
Exemplo n.º 33
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='
    ])
Exemplo n.º 34
0
def test_bug1003_compat():
    """
    Check that file is properly built when '-c' is specified.
    """
    input_dir = get_input_path('bug1003')
    temp_dir = get_temp_dir_path('bug1003cvar')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'bug1003.designspace')
    runner(CMD + ['-o', 'c' 'd', f'_{ds_path}'])
    actual_path = os.path.join(temp_dir, 'bug1003.otf')
    actual_ttx = generate_ttx_dump(actual_path, ['CFF2'])
    expected_ttx = get_expected_path('bug1003.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Exemplo n.º 35
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='])
Exemplo n.º 36
0
def test_check_psname_in_fmndb_bug1171(explicit_fmndb):
    input_path = get_input_path('bug1171/font.ufo')
    fmndb_path = get_input_path('bug1171/FontMenuNameDB')
    expected_ttx = get_expected_path('bug1171.ttx')
    actual_path = get_temp_file_path()
    opts = ['-o', 'f', f'_{input_path}', 'o', f'_{actual_path}']
    if explicit_fmndb is True:
        opts.extend(['mf', f'_{fmndb_path}'])
    runner(CMD + opts)
    actual_ttx = generate_ttx_dump(actual_path, ['name'])
    assert differ([
        expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion', '-r',
        r'^\s+Version.*;hotconv.*;makeotfexe'
    ])
Exemplo n.º 37
0
def test_post_overflow():
    filename = 'blankcid'
    input_path = f'{filename}.otf'
    actual_path = get_temp_file_path()
    msg_path = runner(CMD + [
        '-s', '-e', '-o', 'o', f'_{actual_path}', '=post-format', '_2', '-f',
        input_path
    ])
    actual_ttx = generate_ttx_dump(actual_path, ['post'])
    expected_ttx = get_expected_path(f'{filename}.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
    with open(msg_path, 'rb') as f:
        output = f.read()
    assert (b"WARNING: Dropping glyph names, they do not fit in 'post' "
            b"table.") in output
Exemplo n.º 38
0
def test_input_formats(arg, input_filename, ttx_filename):
    if 'gf' in arg:
        arg.append(f'_{get_input_path("GOADB.txt")}')
    actual_path = get_temp_file_path()
    runner(CMD + [
        '-o', 'f', f'_{get_input_path(input_filename)}', 'o', f'_{actual_path}'
    ] + arg)
    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 +
        '    <created value=' + SPLIT_MARKER + '    <modified value=', '-r',
        r'^\s+Version.*;hotconv.*;makeotfexe'
    ])
Exemplo n.º 39
0
def test_input_formats(arg, input_filename, ttx_filename):
    if 'gf' in arg:
        arg.append('_{}'.format(get_input_path('GOADB.txt')))
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'o', '_{}'.format(actual_path)] + arg)
    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 +
                   '    <created value=' + SPLIT_MARKER +
                   '    <modified value=',
                   '-r', r'^\s+Version.*;hotconv.*;makeotfexe'])
Exemplo n.º 40
0
def test_sparse_cjk_vf():
    # subset fonts to lists in 'SHSansJPVFTest.subset.txt'
    # Check compatibility. Issue is in cid00089.
    # keep PostScript names
    input_dir = get_input_path('CJKSparseVar')
    temp_dir = get_temp_dir_path('CJKSparseVar')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'SHSansJPVFTest.designspace')
    subset_path = os.path.join(temp_dir, 'SHSansJPVFTest.subset.txt')
    runner(CMD + ['-o', 'd', f'_{ds_path}', 'i', f'_{subset_path}', 'c', 'k'])
    actual_path = os.path.join(temp_dir, 'SHSansJPVFTest.otf')
    actual_ttx = generate_ttx_dump(actual_path,
                                   ['CFF2', 'HVAR', 'avar', 'fvar'])
    expected_ttx = get_expected_path('SHSansJPVFTest.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Exemplo n.º 41
0
def test_stat_axis_in_fvar():
    """
    Basic check that fvar axes are defined in STAT
    """
    input_dir = get_input_path('STAT_tests')
    temp_dir = get_temp_dir_path('STAT_tests')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir,
                           'STAT_axis_in_fvar/STAT_axis_in_fvar.designspace')
    runner(CMD + ['-o', 'd', f'_{ds_path}'])
    actual_path = os.path.join(temp_dir,
                               'STAT_axis_in_fvar/STAT_axis_in_fvar.otf')
    actual_ttx = generate_ttx_dump(actual_path, ['STAT'])
    expected_ttx = get_expected_path('STAT_in_fvar.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Exemplo n.º 42
0
def test_bug1006():
    input_filename = 'fealib/font.pfa'
    feat_filename = 'bug1006/feat.fea'
    ttx_filename = 'bug1006.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' + SPLIT_MARKER +
        '    <checkSumAdjustment value=' + SPLIT_MARKER +
        '    <created value=' + SPLIT_MARKER + '    <modified value='
    ])
Exemplo n.º 43
0
def test_mergeFontToCFF_bug570(font_filename, subroutinize):
    # 'dir=TEMP_DIR' is used for guaranteeing that the temp data is on same
    # file system as other data; if it's not, a file rename step made by
    # sfntedit will NOT work.
    actual_path = get_temp_file_path(directory=TEMP_DIR)
    subr_str = 'subr' if subroutinize else 'no_subr'
    ttx_filename = '{}-{}.ttx'.format(font_filename.split('.')[0], subr_str)
    source_path = get_input_path(font_filename)
    output_path = get_input_path('core.otf')
    copy2(output_path, actual_path)

    mergeFontToCFF(source_path, actual_path, subroutinize)

    actual_ttx = generate_ttx_dump(actual_path, ['CFF '])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-l', '2'])
Exemplo n.º 44
0
def test_cid_keyed_cff_bug470(args, font, fontinfo):
    if 'fi' in args:
        fontinfo_file = 'bug470/{}.txt'.format(fontinfo)
        args.append('_{}'.format(get_input_path(fontinfo_file)))
        ttx_file = 'bug470/{}-{}.ttx'.format(font, 'fi')
    else:
        ttx_file = 'bug470/{}.ttx'.format(font)
    font_file = 'bug470/{}.pfa'.format(font)
    # 'dir=TEMP_DIR' is used for guaranteeing that the temp data is on same
    # file system as other data; if it's not, a file rename step made by
    # sfntedit will NOT work.
    actual_path = get_temp_file_path(directory=TEMP_DIR)
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(font_file)),
                        'o', '_{}'.format(actual_path)] + args)
    actual_ttx = generate_ttx_dump(actual_path, ['CFF '])
    expected_ttx = get_expected_path(ttx_file)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Exemplo n.º 45
0
def test_update_cff_bbox_bug617():
    input_filename = "bug617/font.pfa"
    goadb_filename = "bug617/goadb.txt"
    actual_path = get_temp_file_path()
    ttx_filename = "bug617.ttx"
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'gf', '_{}'.format(get_input_path(goadb_filename)),
                        'o', '_{}'.format(actual_path), 'r', 'gs'])
    actual_ttx = generate_ttx_dump(actual_path, ['head', 'CFF '])
    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='])
Exemplo n.º 46
0
def test_recalculate_bbox_bug617(arg):
    input_filename = "bug617/font.pfa"
    goadb_filename = "bug617/goadb.txt"
    ttx_filename = "bug617/{}gs_opt.ttx".format('no_' if not arg else '')
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'gf', '_{}'.format(get_input_path(goadb_filename)),
                        'o', '_{}'.format(actual_path), 'r'] + arg)
    actual_ttx = generate_ttx_dump(actual_path, ['head', 'CFF '])
    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='])
Exemplo n.º 47
0
def test_DFLT_script_with_any_lang_bug438():
    """ The feature file bug438/feat.fea contains languagesystem
    statements for a language other than 'dflt' with the 'DFLT' script
    tag. With the fix, makeotfexe will build an OTF which is identical to
    'bug438.ttx'. Without the fix, it will fail to build an OTF."""
    input_filename = 'bug438/font.pfa'
    feat_filename = 'bug438/feat.fea'
    ttx_filename = 'bug438.ttx'
    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)
    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'])
Exemplo n.º 48
0
def test_GOADB_options_bug497(opts):
    font_path = get_input_path(T1PFA_NAME)
    feat_path = get_input_path('bug497/feat.fea')
    fmndb_path = get_input_path('bug497/fmndb.txt')
    goadb_path = get_input_path('bug497/goadb.txt')
    actual_path = get_temp_file_path()
    ttx_filename = '-'.join(['opts'] + opts) + '.ttx'

    args = []
    for opt in opts:  # order of the opts is important
        if opt == 'r':
            args.append(opt)
        elif opt == 'ga':
            args.append(opt)
        elif opt == 'nga':
            args.append(opt)
        elif opt == 'gf':
            args.extend([opt, '_{}'.format(goadb_path)])
        elif 'bit' in opt:
            bit_num = int(opt[3])
            bit_bol = 'osbOn' if opt[4] == 'y' else 'osbOff'
            args.extend([bit_bol, '_{}'.format(bit_num)])

    runner(CMD + ['-o', 'f', '_{}'.format(font_path),
                        'o', '_{}'.format(actual_path),
                        'ff', '_{}'.format(feat_path),
                        'mf', '_{}'.format(fmndb_path)] + args)
    actual_ttx = generate_ttx_dump(actual_path)
    expected_ttx = get_expected_path('bug497/{}'.format(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'])
Exemplo n.º 49
0
def test_basic_hinting(font_filename, opt):
    arg = []
    expected_filename = font_filename
    if opt:
        if opt == 'fi':
            _copy_fontinfo_file()
        else:
            arg = [opt]
        head, tail = os.path.splitext(font_filename)
        expected_filename = '{}-{}{}'.format(head, opt, tail)

    if 'ufo' in font_filename:
        actual_path = tempfile.mkdtemp()
    else:
        actual_path = get_temp_file_path()

    diff_mode = []
    for font_format in ('.pfb', '.cff', '.ps'):
        if font_filename.endswith(font_format):
            diff_mode = ['-m', 'bin']
            break

    runner(CMD + ['-f', get_input_path(font_filename),
                  '-o', 'o', '_{}'.format(actual_path)] + arg)

    skip = []
    if 'otf' in font_filename:
        fi = ''
        if opt == 'fi':
            fi = '-' + opt
        expected_filename = os.path.splitext(font_filename)[0] + fi + '.ttx'
        actual_path = generate_ttx_dump(actual_path, ['CFF '])
        skip = ['-l', '2']  # <ttFont sfntVersion=

    expected_path = get_expected_path(expected_filename)
    assert differ([expected_path, actual_path] + diff_mode + skip)