Thanks you and harban for all your thorough explanation.
On Fri, 15 Mar 2024, 23:11 Hans Hagen via ntg-context,
On 3/13/2024 9:16 AM, Henning Hraban Ramm wrote:
Am 12.03.24 um 23:59 schrieb seyal zavira:
You are correct. when i convert this svg to pdf via inkscape it works like a charm.
But what is standard way of including an svg file with context if we want to inkscape render the images?
\externalfigure[smile]
without any other settings, but inkscape must be callable on the command line (which doesn’t work for me on MacOS any more, must investigate…). \startMPcode draw lmt_svg [ filename = "smile.svg"] \stopMPcode
Now gives the attached but it took me a while to figure out what works. An inkscape export adds for instance something (globally applied) that is not in the svg file (which actually derived from tiger.svg as mentioned in the file).
To be honest this is a horrible file and a good example of making things more complex than needed (probably common in wysiwyg applications), although we already had the machinery in the mp/pdf converter.
The biggest issue here is that one has to put some constrants in place order to make it work in e.g. sumatra (mypdf) and acrobat (which here actually does weird erratic things when I play with another test).
As with much complex svg, browsers also differ in interpretation o fsome features so it's hard to figure out what to do when there are conflicting demands. (Pointing to something that works tomorrow doesn't mean it worked when we tried to implement something yesterday.)
For Hraben - who mentioned it - i also added support for group opacity and transformed shades.
In the process I tried a few inkscape options (pdf export) but some produce faulty files (with missing stuff) so i guess we have a complex situation in general. That said, as long as one sticks to reliable and clean code (plain svg) it should mostly work out.
Text is another matter because svg dropped glyph support so now everything has to go through font features which in turn means that if one uses svg as output format one has to specify every character with possible abuse of a substitution feature that accesses it. So that is no longer a real interesting option, unless of course one exports all text as curves, just to be sure.
(I will extend general text suport but it will always be suboptimal but then, svg is not a long term archival format anyway.)
No upload yet as i also want to do some cleanup,
ps. For metapost lovers, here is some of the trickery used:
\startMPpage[offset=1ts]
draw image ( fill (unitsquare xscaled 10cm yscaled 4cm) withcolor svgcolor(0.5,0,0) ;
registerluminositygroup ("test") ( fill (unitsquare scaled 2cm) shifted (1cm,1cm) withshademethod "circular" withshadecolors (.6,.1) ) ;
applyluminositygroup ("test") ( fill (unitsquare scaled 2cm) shifted (1cm,1cm) withshademethod "circular" ) ;
draw luminositygroup ( fill (unitsquare scaled 2cm) shifted (4cm,1cm) withshademethod "circular" withshadecolors (.6,.1) ) ( fill (unitsquare scaled 2cm) shifted (4cm,1cm) withshademethod "circular" ) ;
draw luminosityshade ( (unitsquare scaled 2cm) shifted (7cm,1cm) ) ( withshademethod "circular" withshadecolors (.6,.1) ) ( withshademethod "circular" ) ; ) ;
\stopMPpage
Not that intuitive and a bit ugly deep down but it works (there was no need to extend mp btw as we already have graphic grouping in the engine).
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________