Open HinTak opened 7 years ago
How do you get first point off curve for a cubic Bézier considering the explicit form? You mean given first point doesn't correspond to t=0, right?
A while ago there was a discussion on the Opentype list about this sort of thing. It is legal for a curve to consist of entirely off-curve points. Say 4, at the corner of a square. The rasterizer interpolates them. That was the answer from Microsoft people.
So an implied on-curve point is between the first and the last.
I think it can be even more extreme - a contour can be made from 3 off-curve points. Font designers rarely do it, that's all.
Didn't know that. Do you have a pointer to some documentation such that we can add it in the relevant example (where I'm asking to rephrase). It's not the example is not optimal but it is more a partial implementation.
But freetype outline takes care of normalizing the output, no? See https://www.freetype.org/freetype2/docs/glyphs/glyphs-6.html)
Ok, no it doesn't, we have to take care of point tags.
You do interpolate most of the time - just afaic, not the first point; and also always split a 3-order curve into two, with an interpolation in the middle. Difference small but for some glyph, might be visible.
So we better implement the full method.
3rd curves only on postscript fonts. 2nd order is sufficient for truetype.
I hope this is shown side by side - left interpolated 2nd order, right true-3rd order:
and again, with the control points,, which make it clearer:
correct answer from ftgrid:
These are using MinionPro-Regular.otf from adobe acrobat reader.
Hmm, my 'g' is a bit off in the horizonal direction for the MinionPro-Regular.otf
These are the g's from MinionPro-Regular.otf and MinionPro-It.otf, correctly aligned in the horizontal. from the top of https://github.com/rougier/freetype-py/issues/55 .
The examples ignore the 3rd order bezier curve bit and always intepolate between off-curve points. This is strictly speaking only correct for truetype fonts (which only use 2nd order bezier curves). The difference is small but may be important for some glyphs.
Also I think they assume the first point is always on curve. First point being off is less common, but valid.
I'm not going to fix these, but would push a couple of coments in the relevant places. I just think the examples should do the right thing if somebody want to use a different font or a different glyph, or documented not to do so quite correctly...
(cairo don't have 2nd order curves - it is either line or 3rd order; but a 2nd order curve is just a 3rd order with duplicated off points).