Re: Clipped svg output
luigi scarso <[email protected]> Wed, 18 Jan 2023 13:04:25 +0100
| Newsgroups | gmane.comp.tex.metapost |
|---|---|
| Message-ID | <CAG5iGsCFqNsCB7chWwJrm7d2HWAe3LuoWakH4dFX9OvZqN5SSw@mail.gmail.com> |
On Wed, 18 Jan 2023 at 12:53, Lutz Haseloff <[email protected]> wrote: > Hi Luigi, > > I tested a bit further. > > MP: > > outputformat := "svg"; > outputtemplate := "%j-%c.%{outputformat}"; > beginfig(19) > fill fullcircle scaled 19 withcolor red ; > endfig; > end > > SVG: > > <?xml version="1.0"?> > <!-- Created by MetaPost 2.02 on 2023.01.18:1229 --> > <svg version="1.1" xmlns="http://www.w3.org/2000/svg" > <http://www.w3.org/2000/svg> xmlns:xlink="http://www.w3.org/1999/xlink" > <http://www.w3.org/1999/xlink> width="19.000000" height="19.000000" > viewBox="0 0 19.000000 19.000000"> > <!-- Original BoundingBox: -9.500000 -9.500000 9.500000 9.500000 --> > <path d="M18.500000 9.000000 (should be 19.0 9.5) ... 11.519557 > -0.500000 (should be 0) ... -0.500000 9.000000 (should be 0) ... ,18.500000 > 9.000000Z" style="fill: rgb(100.000000%,0.000000%,0.000000%);stroke: > none;"></path> > </svg> > > It seems, that the path d is not correctly transformed from the ps hires > boundingbox (-9.5 -9.5 9.5 9.5) to the svg viewbox (0 0 19 19). > > With even sizes ( say 20) it works ok. > > > indeed, I was looking at it ... this evening can check it better -- luigi > Greetings Lutz > > > Am 15.01.2023 um 15:01 schrieb luigi scarso: > > > > On Mon, 9 Jan 2023 at 16:33, Lutz Haseloff <[email protected]> > wrote: > >> Hi all, >> >> the svg output of recent metapost (linux and windows) seems to be clipped >> or the viewbox of the svg is shifted a small amount down and right. >> >> My test.mp is: >> >> outputformat := "svg"; >> outputtemplate := "%j.%{outputformat}"; >> beginfig(1) >> draw fullcircle scaled 20; >> endfig; >> end >> >> The resulting svg included in a context lmtx file: >> >> \starttext >> \startTEXpage >> \externalfigure[test.svg][conversion=mp] >> \stopTEXpage >> \stoptext >> >> eps and png output is ok. >> >> Has it to do with the recent change in the svg clippath? >> Am I doing something wrong? >> >> Greetings >> >> Lutz >> -- >> http://tug.org/metapost/ > > > hm, I think we should consider the pen; fig 1 is almost ok without shift > because the pen is very thin; > fig 2 is ok only if I shift the fullcircle of half pen : > > outputformat := "svg"; > outputtemplate := "%j-%c.%{outputformat}"; > beginfig(1) > pickup pencircle scaled 0.01; > draw fullcircle scaled 20 ; > draw (10,-10)--(10,10)--(-10,10)--(-10,-10)--(10,-10) withpen pencircle > scaled 0.01 withcolor red; > endfig; > beginfig(2) > pickup pencircle scaled 1; > draw fullcircle scaled 20 shifted (0.5,-0.5); > draw (10,-10)--(10,10)--(-10,10)--(-10,-10)--(10,-10) withpen pencircle > scaled 0.01 withcolor red; > endfig; > end > > -- > luigi > > -- > http://tug.org/metapost/ -- http://tug.org/metapost/