[metapost] Clipped svg output

Lutz Haseloff lutz.haseloff at toppkieker.info
Sun Jan 15 20:20:17 CET 2023


Please have a look at this:

outputformat := "svg";
outputtemplate := "%j-%c.%{outputformat}";
for i = 1 upto 10 :
beginfig(i)
pickup pencircle scaled i ;
draw fullcircle scaled 20 ;
endfig;
endfor;
for i = 11 upto 20 :
beginfig(i)
fill fullcircle scaled i ;
endfig;
endfor;
end

No problems with even numbers.
Even without pen.

Greetings Lutz

Am 15. Januar 2023 15:01:16 MEZ schrieb luigi scarso <luigi.scarso at gmail.com>:
>On Mon, 9 Jan 2023 at 16:33, Lutz Haseloff <lutz.haseloff at toppkieker.info>
>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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/metapost/attachments/20230115/c9d353cd/attachment.html>


More information about the metapost mailing list.