コード例 #1
0
def test_get_composites_data():
    ufo, ps_names = get_glyph_names_mapping(_get_test_ufo_path())
    comps_data = get_composites_data(ufo, ps_names)
    comps_name_list = sorted(list(comps_data.keys()))
    comps_comp_list = [comps_data[gname] for gname in comps_name_list]
    assert comps_name_list == ['aacute', 'adieresis', 'atilde', 'uni01CE']
    assert comps_comp_list[0].names == ('a', 'uni0301')
    assert comps_comp_list[3].names == ('a', 'uni030C')
    assert comps_comp_list[0].positions == ((0, 0), (263.35, 0))
    assert comps_comp_list[3].positions == ((0, 0), (263, 0))
コード例 #2
0
def test_get_glyph_names_mapping_names_from_goadb():
    # the test UFO has a 'public.postscriptNames' in its lib;
    # empty the lib temporarily to force the reading of the GOADB
    ufo_path = _get_test_ufo_path()
    lib_path = os.path.join(ufo_path, 'lib.plist')
    lib_data = _read_txt_file(lib_path)
    _write_file(lib_path, EMPTY_LIB)
    result = get_glyph_names_mapping(ufo_path)
    _write_file(lib_path, lib_data)
    assert sorted(result[1].keys()) == DESIGN_NAMES_LIST
    assert sorted(result[1].values()) == PRODCT_NAMES_LIST
コード例 #3
0
def test_get_glyph_names_mapping_names_from_lib():
    result = get_glyph_names_mapping(_get_test_ufo_path())
    assert sorted(result[1].keys()) == DESIGN_NAMES_LIST
    assert sorted(result[1].values()) == PRODCT_NAMES_LIST
コード例 #4
0
def test_get_glyph_names_mapping_invalid_ufo():
    path = _get_test_ttf_path()
    assert get_glyph_names_mapping(path) == (None, None)