ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Issue with rendering arrows in lmtx
@ 2020-03-17 14:51 Jan-Erik Hägglöf
  2020-03-17 15:57 ` mf
  2020-03-17 15:58 ` Taco Hoekwater
  0 siblings, 2 replies; 4+ messages in thread
From: Jan-Erik Hägglöf @ 2020-03-17 14:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4166 bytes --]

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>
  <sodipodi:namedview
     showgrid="false"
     inkscape:document-rotation="0"
     inkscape:current-layer="layer1"
     inkscape:document-units="px"
     inkscape:cy="-33.787703"
     inkscape:cx="722.89047"
     inkscape:zoom="0.35"
     inkscape:pageshadow="2"
     inkscape:pageopacity="0.0"
     borderopacity="1.0"
     bordercolor="#666666"
     pagecolor="#ffffff"
     id="base"
     inkscape:window-width="1440"
     inkscape:window-height="804"
     inkscape:window-x="0"
     inkscape:window-y="23"
     inkscape:window-maximized="0" />
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     id="layer1"
     inkscape:groupmode="layer"
     inkscape:label="Lager 1"
     transform="translate(141.37191,110.50081)">
    <path
       style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:3.565;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m -141.36309,-96.761905 458.10714,2.267858"
       id="path830"
       inkscape:connector-curvature="0" />
  </g>
</svg>


Is there som incompatibility issues with reading those files? 

I’ve tested to open the file in SVGMaker and it renders correct there.

Regards

Janne

[-- Attachment #1.2: Type: text/html, Size: 20692 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Issue with rendering arrows in lmtx
  2020-03-17 14:51 Issue with rendering arrows in lmtx Jan-Erik Hägglöf
@ 2020-03-17 15:57 ` mf
  2020-03-17 15:58 ` Taco Hoekwater
  1 sibling, 0 replies; 4+ messages in thread
From: mf @ 2020-03-17 15:57 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Issue with rendering arrows in lmtx
  2020-03-17 14:51 Issue with rendering arrows in lmtx Jan-Erik Hägglöf
  2020-03-17 15:57 ` mf
@ 2020-03-17 15:58 ` Taco Hoekwater
  2020-03-17 19:43   ` Jan-Erik Hägglöf
  1 sibling, 1 reply; 4+ messages in thread
From: Taco Hoekwater @ 2020-03-17 15:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 17 Mar 2020, at 15:51, Jan-Erik Hägglöf <janerik.hagglof@bahnhof.se> 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Issue with rendering arrows in lmtx
  2020-03-17 15:58 ` Taco Hoekwater
@ 2020-03-17 19:43   ` Jan-Erik Hägglöf
  0 siblings, 0 replies; 4+ messages in thread
From: Jan-Erik Hägglöf @ 2020-03-17 19:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1714 bytes --]

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 <taco@elvenkind.com>:
> 
> 
> 
>> On 17 Mar 2020, at 15:51, Jan-Erik Hägglöf <janerik.hagglof@bahnhof.se> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 19931 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-17 19:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 14:51 Issue with rendering arrows in lmtx Jan-Erik Hägglöf
2020-03-17 15:57 ` mf
2020-03-17 15:58 ` Taco Hoekwater
2020-03-17 19:43   ` Jan-Erik Hägglöf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).