svglib icon indicating copy to clipboard operation
svglib copied to clipboard

Investigate implicit line operators in <path>

Open deeplook opened this issue 7 years ago • 4 comments

I've stumbled over a very simply logo that svglib does partly not render (the blueish triangle is missing): https://upload.wikimedia.org/wikipedia/commons/c/c7/HERE_logo.svg. It does appear though when adding l operators to the first path, turning it into:

<path d="m 26.95,66.453001 l -11,11 l -11,-11 l 22,0 z" style="fill:#65c1c2" />

So there seems to be some convention about implicit line operators that is not followed by svglib, yet. This is simply a ticket to investigate this further.

deeplook avatar Dec 25 '17 20:12 deeplook

Ok, this is a good starter: https://www.w3.org/TR/SVG11/paths.html#PathDataMovetoCommands

""" Start a new sub-path at the given (x,y) coordinate. M (uppercase) indicates that absolute coordinates will follow; m (lowercase) indicates that relative coordinates will follow. If a moveto is followed by multiple pairs of coordinates, the subsequent pairs are treated as implicit lineto commands. Hence, implicit lineto commands will be relative if the moveto is relative, and absolute if the moveto is absolute. If a relative moveto (m) appears as the first element of the path, then it is treated as a pair of absolute coordinates. In this case, subsequent pairs of coordinates are treated as relative even though the initial moveto is interpreted as an absolute moveto. """

deeplook avatar Dec 25 '17 20:12 deeplook

Weird, I cannot reproduce the blueish triangle issue locally.

claudep avatar Dec 27 '17 16:12 claudep

Maybe an issue with the rendering application. I think I have used only Apple Preview.app, so far... But nope, just tested with Adobe Reader XI 11.0.0 on MacOS 10.11.6. Same behaivour: missing bluish triangle without additional l operators. Fine, after adding them.

deeplook avatar Dec 27 '17 17:12 deeplook

Here's the PDF I just produced locally with svglib master (blueish triangle visible with Evince): HERE_logo.pdf

claudep avatar Mar 08 '18 21:03 claudep