Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermediate nodes and markers LOST #145

Closed
cfierrob opened this issue May 15, 2017 · 2 comments
Closed

Intermediate nodes and markers LOST #145

cfierrob opened this issue May 15, 2017 · 2 comments
Labels

Comments

@cfierrob
Copy link

I was sent here from Inkscape--Bugs.

Running last Inkscape version under Windows 7.

  1. Added intermediate nodes to 3 straight lines to put on them intermediate markers
  2. Works fine for Inkscape svg
  3. On the same drawing, saved as Optimized svg, the markers on
  • horizontal straight line
  • vertical straight line
    are lost--preserved only on oblique line.
  1. My own impression, after swift look at the text in the optimized svg file: the conversor tries to be too smart by half, AND DELETES ALL THE INTERMEDIATE NODES ON THE HORIZONTAL AND VERTICAL LINES AS UNNECESSARY--WHICH THEY SURELY ARE ... BUT FOR THE MARKERS!!
  2. Instead, and although the middle markers should be exactly the same on all three paths (I even tried to paste style from one to the other two to ensure this) I get three separate ... two of them unused.
    The system refuses to let me attach my couple of svg files--saved as Inkscape svg and Optimized svg.
    Thanks!
@Ede123
Copy link
Member

Ede123 commented May 15, 2017

Good catch! Will be fixed soon...

Note to self:
It's due to h and v commands being collapsed (doesn't happen with e.g. m commands.), simple check for markers should suffice.
We could obviously collapse those, too, to save a few bytes in such circumstances!

More regression risks / potential issues to keep in mind:
https://bugs.launchpad.net/scour/+bug/734933 (wouldn't this apply to stroke-linecap="square", too?)

@Ede123 Ede123 added the bug label May 15, 2017
Ede123 added a commit to Ede123/scour that referenced this issue May 17, 2017
Ede123 added a commit that referenced this issue May 17, 2017
* Do not collapse straight path segments in paths that have intermediate markers (see #145). The intermediate nodes might be unnecessary for the shape of the path, but their markers would be lost.
* Collapse subpaths of moveto `m` and lineto `l` commands if they have the same direction (before we only collapsed horizontal/vertical `h`/`v` lineto commands)
* Attempt to collapse lineto `l` commands into a preceding moveto `m` command (these are then called "implicit lineto commands")
* Preserve empty path segments if they have `stroke-linecap` set to `round` or `square`. They render no visible line but a tiny dot or square.
@Ede123
Copy link
Member

Ede123 commented May 17, 2017

Fixed in #146 (specifically b7bfb32)

This also spawned a lot of other improvements regarding optimization of consecutive straight path segments, so thanks again for the report!

@Ede123 Ede123 closed this as completed May 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants