google / iconvg

IconVG is a compact, binary format for simple vector graphics: icons, logos, glyphs and emoji.
Apache License 2.0
676 stars 11 forks source link

C implementation allows `T` drawing command to reflect off `C` control point #23

Open Hixie opened 3 years ago

Hixie commented 3 years ago

If I'm reading the code correctly, in the C implementation, a 0xAF opcode (C command) followed by a 0x4F opcode (T command) will result in the T command using the last control point of the first opcode to compute the first control point of the second opcode, but the SVG spec says "if the previous command was not a Q, q, T or t, assume the control point is coincident with the current point".

RazrFalcon commented 3 years ago

Yes, looks like m, T, t and Q, q are implemented incorrectly. Here is a correctly working implementation from resvg.

I would even suggest sticking with just M, L, C, Z (only absolute) for simplicity.