Updated XP1Dr2SVG
Clive Semmens (2335) 3276 posts |
Dr2SVG converts drawfiles to SVG, mainly to put vector drawings onto websites in a format that can be read on other platforms, or imported into documents on other platforms. Version 1.22 now handles gradients (created using Interpolate) and “thin” lines better, and knows about even/odd windings as well as nonzero ones. https://clive.semmens.org.uk/RISCOS/XP1Dr2SVG.html Thanks due to Cameron Cawley for drawing my attention to these issues. N.B. NetSurf (v.3.10 anyway – apologies if this has been corrected more recently!) doesn’t know about even/odd windings, so if you want holes in path fills to work on NetSurf, make sure the path goes the clockwise around the perimeter, and anticlockwise around the holes or vice-versa – sadly, Acorn Fonts don’t do this in every case, so text converted to paths goes wonky. This doesn’t affect rendering on other platforms, it’s not an issue I’ve seen anywhere but NetSurf. |
Jean-Michel BRUCK (3009) 362 posts |
Thanks Clive For those who are not put off by formulas/equations, I created a special version which allows you to recover and display (draw) svg files containing it.(not displayed with !NetSurf and !Iris) example:https://en.wikipedia.org/wiki/List_of_equations_in_gravitation If you are interested you can visit find the programs here: Sorry for my English, I hope I’m understandable. |
Clive Semmens (2335) 3276 posts |
Yup. The even/odd being rendered as non-zero bug is the first one I’ve bumped into. The new version of XP1Dr2SVG has fixed the issue with gradients – and I’m not aware of any error in discontinuous lines since the previous published version*. I think that in both those respects my SVG is now functionally identical to the original Drawfile. (Apart from the endcaps on discontinuous lines, which draw places on every dash, but which SVG only places on the extreme ends of the line. Emulating the behaviour of Draw in SVG in this respect would be a major undertaking!) |
Jean-Michel BRUCK (3009) 362 posts |
The attached zip file contains 2 Draw files, one decoded by !NetSurf and the other by !Svg2Draw, this is Clive’s Boat4.svg file, I have never seen the original (Draw file)… The attached zip file contains 2 Draw files, one decoded by !NetSurf and the other by !Svg2Draw, this is Clive’s Boat4.svg file, I have never seen the original (Draw). .. |
Clive Semmens (2335) 3276 posts |
Ah – that was converted to SVG by the old version of XP1Dr2SVG. Not the prettiest SVG on gradients! Looks okay on Mac & PC because the thin white lines aren’t rendered there because they’re thin, but they are by NetSurf. In the original draw they were None colour, but the old version of XP1Dr2SVG had a nasty bug that converted None colour outlines to white. (That was one of the bugs that spoiled a file for a user, and alerted me to the issue. The other one is a NetSurf bug, not rendering even/odd windings correctly.) Notable also that your conversion also gets the dashed lines right, as does mine on PC & Mac – but NetSurf then mucks them up. That’s another NetSurf bug, not one of mine. (Possibly corrected post Netsurf 3.10, which is what I’m using.) I should redo the conversion of my samples! Probably before long… 8~) …I’ll let you know when I’ve done it, then you can see the difference. I take my hat off to you for Svg2Draw – SVG is too much of a moving target for me to try to do the conversion in that direction 8~) |
Jean-Michel BRUCK (3009) 362 posts |
Thanks, You should migrate to version 3.11 of !NetSurf (2023). SVG decoding has progressed, previously it did not know how to decode “arcs” |
Clive Semmens (2335) 3276 posts |
I might well do that – but I don’t use NetSurf much, and for my purposes how well it renders SVG is rarely relevant; this is really the first time it’s mattered at all. Noticed another bug in v. 3.10 just now: line widths are wonky, thin lines too wide, and wider lines narrower than they should be. About to redo the SVG conversions of my samples. I’ll put the original Draw files up, too – why not? |
Clive Semmens (2335) 3276 posts |
I see that the only SVG sample on my website that’s affected by the changes to XP1Dr2SVG is actually the boat 8~) and I’ve now put the corrected conversion up 8~) I’ve checked the corrected version on the Mac (Firefox) and it’s a very good match with the original Draw version. Next job is to download NetSurf 3.11 and take a look at it on that 8~) |
Clive Semmens (2335) 3276 posts |
Hmm. I’ve installed NetSurf 3.11, and I can now export DrawFiles, but the rendering bugs seem to be still the same. There’s one bug in Svg2Draw, too, Jean-Michel: line widths are 25% greater in your output than in the original, whereas on Mac they’re correct. NetSurf is much worse. Line widths are smaller than in the original, but not by a consistent ratio: 0.25pt lines become thin (0, rendered as single pixel), 1.5pt lines become 0.4 pt, and 4pt lines become 2pt. Very weird. And discontinuous (dashed) lines are still continuous. |
Jean-Michel BRUCK (3009) 362 posts |
There are still a lot of bugs in Svg2Draw :-( For information. Another very interesting Drawscript file, generated by decoding the SVG file, we must find all the elements which were used in your drawing. It is also useful for debugging. The drawing script is translated by MkDrawf (Gareth McCaughan), 32bit version: Note: I also use MkDrawf in my application!PariGP RISC OS version, to generate the drawings: the principle is simple, by default the program produces scripts for EPS, so you just have to make a syntax adaptation. |