On Thu, Oct 9, 2014 at 5:38 AM, Daniel Silverstone < dsilv...@netsurf-browser.org> wrote:
> On Wed, Oct 08, 2014 at 21:57:25 -0400, Paul Mecklenburg wrote: > > Let me know if I should explain more about the patch I sent yesterday. > The > > bug happens when are relative command, for example 'm' follows a close > 'z'. > > Without this fix the move is relative to the previous point instead of > the > > final closing point. I noticed that Inkscape generates svg files with > this > > pattern and therefore broken in libsvgtiny. > > I believe you that it's necessary, but we're slightly confused as to why > both > 'M' and 'm' are being handled in the same way. ('we' being the current > maintainers, not the original libsvgtiny author :-) > Both 'M' and 'm' are moves and therefore start a new (sub)path. In either case the location should be cached so that a later 'close path' (z or Z) knows the location it is returning to. The location is not written to 'p', since it is assumed that the client code remembers. If the next move is relative (lowercase), then it's important that last_x, last_y were correctly updated while processing Z/z. The following quota is from the spec. I bolded the important piece. "The current subpath shall be closed by drawing a straight line from the current point to current subpath's initial point, *which then shall become the new current point.* Since the Z and z commands take no parameters, they have an identical effect." http://www.w3.org/TR/SVGTiny12/paths.html > Could you please provide a couple of SVGs which exhibit the issue so we can > compare to satisfy ourselves of the correctness of your patch? > I've attached a simple svg that exhibits this problem. Correctly rendered it looks like an equal sign*. Without may patch the bars do not line up. *I verified with Inkscape and Firefox. > > Sorry to be a bother, but it's hard for us to grok right now and we're all > super-busy so can't really spend the time developing a test case ourselves. > No problem. In fact I realized that my first patch wasn't quite right (it cached each line_to instead of just the first move_to). I'll send a revised version. > > Ideally any example you send us could be included into the svgtiny test > set. > I don't see an svgtiny test set. There's tiger.svg in examples and a program in test that just prints out the raw data and doesn't have any test input. Perhaps I misunderstand your meaning? I can add my file to examples if you like. Hopefully this helps. Paul > > > D. > > -- > Daniel Silverstone http://www.netsurf-browser.org/ > PGP mail accepted and encouraged. Key Id: 3CCE BABE 206C 3B69 > >