def _shape(path_a, path_b, stats, diff_type, font_size, render_path, diff_threshold=0): """Do a shape comparison (glyph area or rendered) and add results to stats. path_a and b refer to binary font files (OTF or TTF). stats should be a list (possibly empty) of <diff, glyph-name, font-name> tuples, for sorting. diff_type and render_path are passed through from the original call to notodiff. """ diff_finder = shape_diff.ShapeDiffFinder(path_a, path_b, stats, ratio_diffs=True, diff_threshold=diff_threshold) if diff_type == 'area': diff_finder.find_area_diffs() elif diff_type == 'shape': diff_finder.find_shape_diffs() elif diff_type == 'area-shape-product': diff_finder.find_area_shape_diff_products() else: diff_finder.find_rendered_diffs(font_size, render_path)
def _shape(path_a, path_b, stats, diff_type, render_path): """Do a shape comparison (glyph area or rendered) and add results to stats. path_a and b refer to binary font files (OTF or TTF). stats should be a list (possibly empty) of <diff, glyph-name, font-name> tuples, for sorting. diff_type and render_path are passed through from the original call to fontdiff. """ cur_stats = [] diff_finder = shape_diff.ShapeDiffFinder( path_a, path_b, output_lines=-1, ratio_diffs=True) if diff_type == 'area': diff_finder.find_area_diffs(stats=cur_stats) else: diff_finder.find_rendered_diffs(stats=cur_stats, render_path=render_path) basename = os.path.basename(path_a) stats.extend(s[0:2] + (basename,) + s[2:] for s in cur_stats)