Open madig opened 6 years ago
@madig Agree. It should catch both differences in names and index, right now it's a bit too dumb. Any chance you could make a PR for this change?
Looking into it, have to understand https://github.com/robofab-developers/fontParts/blob/master/Lib/fontParts/base/compatibility.py first. Might take a while with my other priorities.
I'd actually like to change the reporting mechanism a bit at some point. I'm writing a Fontbakery check for UFO sources and find it limiting that I can compare only two fonts at a time and then have to scrape the relevant results out like this (can't rely on report.fatal
because it doesn't consider anchor and component diffs fatal):
[...]
for glyph_name in sorted(all_glyphs):
if not all(glyph_name in font for font in fonts):
_compatible = False
yield WARN, f"{family}, glyph {glyph_name} not in all fonts of family."
glyphs_to_check = [font[glyph_name] for font in fonts if glyph_name in font]
compat_reports = [
glyph.isCompatible(glyphs_to_check[(i + 1) % len(glyphs_to_check)])[1]
for i, glyph in enumerate(glyphs_to_check)
]
incompatibilities = []
if any(r.contours or r.contourCountDifference for r in compat_reports):
incompatibilities.append("contours")
if any(
r.componentCountDifference
or r.componentsMissingFromGlyph1
or r.componentsMissingFromGlyph2
for r in compat_reports
):
incompatibilities.append("components")
if any(
r.anchorCountDifference
or r.anchorsMissingFromGlyph1
or r.anchorsMissingFromGlyph2
for r in compat_reports
):
incompatibilities.append("anchors")
if incompatibilities:
_compatible = False
incompatibility_str = ", ".join(incompatibilities)
yield WARN, f"{family}, glyph {glyph_name} isn't compatible across the family due to: {incompatibility_str}."
[...]
[...]
* WARN: Ubuntu Mono (Italics), glyph w isn't compatible across the family due to: contours.
* WARN: Ubuntu Mono (Italics), glyph x isn't compatible across the family due to: contours.
* WARN: Ubuntu Mono (Italics), glyph xi isn't compatible across the family due to: contours.
[...]
Have to come up with something good first, though.
vs.
results in
This should read more like