def test_missing_table_delete_bug160(): actual_path = get_temp_file_path() stderr_path = runner( CMD + ['-s', '-e', '-o', 'd', '_xyz,GSUB', '-f', LIGHT, actual_path]) with open(stderr_path, 'rb') as f: output = f.read() assert b'[WARNING]: table missing (xyz )' in output assert font_has_table(get_input_path(LIGHT), 'GSUB') assert not font_has_table(actual_path, 'GSUB')
def test_missing_table_delete_bug160(): actual_path = get_temp_file_path() stderr_path = runner(CMD + ['-s', '-e', '-o', 'd', '_xyz,GSUB', '-f', LIGHT, actual_path]) with open(stderr_path, 'rb') as f: output = f.read() assert b'[WARNING]: table missing (xyz )' in output assert font_has_table(get_input_path(LIGHT), 'GSUB') assert not font_has_table(actual_path, 'GSUB')
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'])
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'])
def test_skip_ufo3_global_guides_bug700(): input_filename = "bug700.ufo" actual_path = get_temp_file_path() runner(CMD + [ '-o', 'f', f'_{get_input_path(input_filename)}', 'o', f'_{actual_path}' ]) assert font_has_table(actual_path, 'CFF ')
def test_font_with_hash_bug239(): input_path = get_input_path('bug239/font.ufo') output_path = get_temp_file_path() runner( CMD + ['-o', 'f', '_{}'.format(input_path), 'o', '_{}'.format(output_path)]) assert font_has_table(output_path, 'CFF ')
def test_skip_ufo3_global_guides_bug700(): input_filename = "bug700/font.ufo" actual_path = get_temp_file_path() runner(CMD + [ '-o', 'f', '_{}'.format(get_input_path(input_filename)), 'o', '_{}'.format(actual_path) ]) assert font_has_table(actual_path, 'CFF ')
def test_feature_includes_ufo_bug164(): input_filename = "bug164/d1/d2/font.ufo" otf_path = get_temp_file_path() runner( CMD + ['-o', 'f', f'_{get_input_path(input_filename)}', 'o', f'_{otf_path}']) assert font_has_table(otf_path, 'head')
def test_feature_includes_ufo_bug164(): input_filename = "bug164/d1/d2/font.ufo" otf_path = get_temp_file_path() runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)), 'o', '_{}'.format(otf_path)]) assert font_has_table(otf_path, 'head')
def test_feature_includes_type1_bug164(feat_filename): input_filename = "bug164/d1/d2/font.pfa" otf_path = get_temp_file_path() runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)), 'ff', '_{}'.format(get_input_path(feat_filename)), 'o', '_{}'.format(otf_path)]) assert font_has_table(otf_path, 'head')
def test_ttf_input_font_bug680(): input_filename = 'bug680/font.ttf' feat_filename = 'bug680/features.fea' ttf_path = get_temp_file_path() runner(CMD + [ '-o', 'r', 'f', f'_{get_input_path(input_filename)}', 'ff', f'_{get_input_path(feat_filename)}', 'o', f'_{ttf_path}' ]) for table_tag in ('head', 'hhea', 'maxp', 'OS/2', 'hmtx', 'cmap', 'fpgm', 'prep', 'cvt ', 'loca', 'glyf', 'name', 'post', 'gasp', 'BASE', 'GDEF', 'GPOS', 'GSUB'): assert font_has_table(ttf_path, table_tag)
def test_ttf_input_font_bug680(): input_filename = 'bug680/font.ttf' feat_filename = 'bug680/features.fea' ttf_path = get_temp_file_path() runner(CMD + ['-o', 'r', 'f', '_{}'.format(get_input_path(input_filename)), 'ff', '_{}'.format(get_input_path(feat_filename)), 'o', '_{}'.format(ttf_path)]) for table_tag in ('head', 'hhea', 'maxp', 'OS/2', 'hmtx', 'cmap', 'fpgm', 'prep', 'cvt ', 'loca', 'glyf', 'name', 'post', 'gasp', 'BASE', 'GDEF', 'GPOS', 'GSUB'): assert font_has_table(ttf_path, table_tag)
def test_overwrite(): in_path = get_input_path('sans.otf') in_head = path.splitext(in_path)[0] out_path1 = f'{in_head}.ttf' out_path2 = f'{in_head}#1.ttf' assert all([path.exists(out_path1), path.exists(out_path2)]) is False otf2ttf([in_path]) # 1st run; creates 'sans.ttf' assert font_has_table(out_path1, 'glyf') timestamp_run1 = path.getmtime(out_path1) sleep(1) otf2ttf(['--overwrite', in_path]) # 2nd run; overwrites 'sans.ttf' timestamp_run2 = path.getmtime(out_path1) assert timestamp_run1 != timestamp_run2 # 'sans.ttf' was modified sleep(1) otf2ttf([in_path]) # 3rd run; doesn't overwrite 'sans.ttf' (default) timestamp_run3 = path.getmtime(out_path1) assert path.exists(out_path2) # 'sans#1.ttf' exists assert timestamp_run2 == timestamp_run3 # 'sans.ttf' was not modified for pth in (out_path1, out_path2): remove(pth)
def test_font_with_hash_bug239(): input_path = get_input_path('bug239/font.ufo') output_path = get_temp_file_path() runner(CMD + ['-o', 'f', '_{}'.format(input_path), 'o', '_{}'.format(output_path)]) assert font_has_table(output_path, 'CFF ')
def test_skip_ufo3_global_guides_bug700(): input_filename = "bug700.ufo" actual_path = get_temp_file_path() runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)), 'o', '_{}'.format(actual_path)]) assert font_has_table(actual_path, 'CFF ')