fonttools / fontbakery

🧁 A font quality assurance tool for everyone
https://fontbakery.readthedocs.io
Apache License 2.0
534 stars 99 forks source link

[com.google.fonts/check/outline_direction] failed with `ZeroDivisionError`: float division by zero #4699

Closed RickyDaMa closed 3 weeks ago

RickyDaMa commented 1 month ago

Observed behaviour

The check errors:

image

Expected behaviour

The check should fail (I think). I'm guessing this exception should be caught and repackaged as the check failing?

Resources and steps needed to reproduce

I'll link this issue on the private repo in question, so you'll see the backlink below if you have access :)

RickyDaMa commented 1 month ago

@simoncozens unsure if the issue here lies in the check code, or in your beziers library, but if you'd be able to take a look, I'd really appreciate it!

The exception is being raised when a QuadraticBezier has a length of zero (all three co-ordinates are the same). We tried looking in the sources for these co-ordinates, and came up empty

simoncozens commented 1 month ago

It's clearly in beziers.py. You won't find a length-zero bezier in your sources; it's probably a bug in how we're sampling them.

simoncozens commented 1 month ago

Should be fixed in beziers 0.6.0, just uploaded.

RickyDaMa commented 1 month ago

Anything breaking in the API, or am I safe to PR for this repo moving to 0.6? We're pinned on 0.5.x currently

https://github.com/fonttools/fontbakery/blob/95d1c4f6f733c2cff6aeac147518f621b6c8fa53/pyproject.toml#L44

felipesanches commented 1 month ago

Should be fixed in beziers 0.6.0, just uploaded.

Even though I see version 0.6.0 at PyPI (https://pypi.org/project/beziers/), I don't see the corresponding commits / git tag for this version at https://github.com/simoncozens/beziers.py

simoncozens commented 3 weeks ago

This should now be fixed.