Is there a script to flag glyphs with Red Arrows problems?

I want to look through a file with Red Arrows to look for problems. But the file has 11 masters so I’d prefer to not step through all the masters glyph by glyph. Does anybody have a script that flags glyphs with problems?

this doesn’t solve your 11 master problem, but it is possible to at least select all glyphs with problems within a master

You can also access RedArrow from the Macro Panel and run it on any layer. To check all layers of all glyphs:

from redArrow.outlineTestGlyphs import OutlineTest
from redArrow.defaults import default_options, default_tests

ot = OutlineTest(layer=None, options=default_options, run_tests=default_tests)

for g in Glyphs.font.glyphs:
	for layer in g.layers:
		ot.layer = layer
		ot.reset()
		ot.checkLayer()
		if ot.errors:
			print(layer)
			for e in ot.errors:
				print("   ", e)

If you don’t want to run all tests, or customize the options, you can pass dicts like this to options and run_tests:

default_tests = [
    "test_extrema",
    "test_inflections",
    "test_fractional_coords",
    "test_fractional_transform",
    "test_smooth",
    "test_empty_segments",
    "test_collinear",
    "test_semi_hv",
]

default_options = {
    "ignore_warnings": False,
    "extremum_calculate_badness": False,
    "extremum_ignore_badness_below": 0,
    "smooth_connection_max_distance": 4,
    "fractional_ignore_point_zero": True,
    "collinear_vectors_max_distance": 2,
    "grid_length": 1,
    "inflection_min": 0.3,
}
1 Like