PdfPig
PdfPig copied to clipboard
Incorrect parsing of TrueType path (Quadratic and Cubic bezier curves)
There's a bug in the Glyph.CalculatePath() function. On line 185 and 192, the previous point does not always belong to the contour array and is sometime computed.
https://github.com/UglyToad/PdfPig/blob/2073e036ef5a3bd443ada484d269ed6208816e3a/src/UglyToad.PdfPig.Fonts/TrueType/Glyphs/Glyph.cs#LL185C33-L185C33
Getting the previous point was a hack to match the BezierCurveTo() parameters (PdfBox does not have that). It is in fact not necessary as these bezier curves are Quadratic and not Cubic.
In order to fix that we need to properly implement Bezier curves and account for the differences between Quadratic and Cubic curves.