Hi All!
When I invoke this command
\startMPcode
picture p ; p := lmt_svg [ filename ="pil.svg" ];
draw p;
\stopMPcode
I get weird results, the arrowhead points in wrong direction and is very tiny compared to the size it was meant to have.
Here is the .svg code from the saved file (pil.svg) made in Inkscape 0.92 for Mac OS
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:version="1.0beta2 (2b71d25, 2019-12-03)"
id="svg8"
version="1.1"
viewBox="0 0 462.85062 100.67344"
height="100.67344mm"
width="462.85062mm"
sodipodi:docname="pil.svg">
<defs
id="defs2">
<marker
inkscape:stockid="Arrow2Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow2Lend"
style="overflow:visible"
inkscape:isstock="true">
<path
id="path853"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow1Send"
orient="auto"
refY="0"
refX="0"
id="Arrow1Send"
style="overflow:visible"
inkscape:isstock="true">
<path
id="path847"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow1Mstart"
orient="auto"
refY="0"
refX="0"
id="Arrow1Mstart"
style="overflow:visible"
inkscape:isstock="true">
<path
id="path838"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
transform="matrix(0.4,0,0,0.4,4,0)"
inkscape:connector-curvature="0" />
</marker>
</defs>
Il 17/03/20 15:51, Jan-Erik Hägglöf ha scritto:
Hi All!
When I invoke this command
\startMPcode picture p ; p := lmt_svg [ filename ="pil.svg" ]; draw p; \stopMPcode
I get weird results, the arrowhead points in wrong direction and is very tiny compared to the size it was meant to have.
Keep in mind this: - SVG rendering in metapost started as an experiment and it is still under development, even if you can already do some very interesting things with it - inkscape SVG is different from standard SVG, so the first thing you can try is saving as plain SVG - markers are borderline elements, even Inkscape did not support them well for a long time; i.e. i noticed a strange behavior in rectangles with slightly rounded corners - in general, try using the simplest elements: i.e. transform rectangles, ellipses, markers?, etc. into paths - you could experience problems also with text, especially with less common or uninstalled fonts Best wishes, Massi
On 17 Mar 2020, at 15:51, Jan-Erik Hägglöf
wrote: Hi All!
When I invoke this command
\startMPcode picture p ; p := lmt_svg [ filename ="pil.svg" ]; draw p; \stopMPcode
I get weird results, the arrowhead points in wrong direction
That one is because lmt_svg does not properly consider the
orient=“auto"
in the marker definition. I played with setting it to actual angles, and then the output is ok.
and is very tiny compared to the size it was meant to have.
The path in the marker has its own transform, and that seems to be ignored by lmt_svg. (I do not see how a scale of (-1.1,-1.1) would make it that much bigger, but I know that manually altering the values does nothing, so I guess that must be it). No solution, but I hope this helps Hans somewhat... Best wishes, Taco
Ok, thanks for your advice. It seems that it is better to do framework in MetaFun and use svg picture as a component instead of opposite. Best wishes to you all Janne
17 mars 2020 kl. 16:58 skrev Taco Hoekwater
: On 17 Mar 2020, at 15:51, Jan-Erik Hägglöf
wrote: Hi All!
When I invoke this command
\startMPcode picture p ; p := lmt_svg [ filename ="pil.svg" ]; draw p; \stopMPcode
I get weird results, the arrowhead points in wrong direction
That one is because lmt_svg does not properly consider the
orient=“auto"
in the marker definition. I played with setting it to actual angles, and then the output is ok.
and is very tiny compared to the size it was meant to have.
The path in the marker has its own transform, and that seems to be ignored by lmt_svg. (I do not see how a scale of (-1.1,-1.1) would make it that much bigger, but I know that manually altering the values does nothing, so I guess that must be it).
No solution, but I hope this helps Hans somewhat...
Best wishes, Taco
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
participants (3)
-
Jan-Erik Hägglöf
-
mf
-
Taco Hoekwater