Closed anthrotype closed 2 years ago
not sure if relevant here but I noticed that the fontTools BasePen (the mother of all pens!), while it does handle the variable number of off-curves in the curveTo
method, it has this assertion in the qCurveTo
method that seems to suggest for the quadratic with case zero offcurves are not expected (perhaps intentionally?, if so we should make it explicit)
def qCurveTo(self, *points):
n = len(points) - 1 # 'n' is the number of control points
assert n >= 0
/cc @justvanrossum @typemytype @jenskutilek
EDIT: it totally is expected if you understand the difference between >
and >=
😅
n
seems to be the number of off-curve points, and it's asserted to be zero or greater than zero.
I think this situation should also be interpreted as a straight line
That's for sure the intention.
oops sorry... can't even read python code. Ok then, would be nice to get the spec updated accordingly to mention this explicitly
The current GLIF point types spec currently says about "curve"
https://unifiedfontobject.org/versions/ufo3/glyphs/glif/#point-types
For the "qcurve" quadratic curve segment type, it simply says:
It does not explicitly say what to do in the case of zero offcurve points preceding the oncurve point marked as "qcurve".
I think this situation should also be interpreted as a straight line, which it also appears to be what Robofont does.
Maybe the UFO spec should be updated to mention this explicitly if that's the case.
This issue came up in https://github.com/googlefonts/ufo2ft/issues/468#issuecomment-1311657646