ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: seyal zavira <seyal.zavira@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: how to include an an svg file?
Date: Sat, 16 Mar 2024 06:16:22 +0330	[thread overview]
Message-ID: <CADiGc-krtwLNeHZbeeZ7eVaCPJkPn0OSCcScHqBDmNRcwEs4tg@mail.gmail.com> (raw)
In-Reply-To: <bfa2f65c-4674-45d2-affb-f0b56bcbafb5@freedom.nl>


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

Thanks you and harban for all your thorough explanation.

On Fri, 15 Mar 2024, 23:11 Hans Hagen via ntg-context, <ntg-context@ntg.nl>
wrote:

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

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

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

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

  reply	other threads:[~2024-03-16  2:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 13:36 [NTG-context] " seyal.zavira
2024-03-12 13:43 ` [NTG-context] " Jean-Pierre Delange
2024-03-12 13:53   ` seyal zavira
2024-03-12 14:01     ` Henning Hraban Ramm
2024-03-12 14:44       ` Jean-Pierre Delange
2024-03-12 18:21     ` Hans Hagen
2024-03-12 22:59       ` seyal zavira
2024-03-13  8:16         ` Henning Hraban Ramm
2024-03-13 12:14           ` Jean-Pierre Delange
2024-03-13 12:37             ` Henning Hraban Ramm
2024-03-13 12:44               ` Jean-Pierre Delange
2024-03-15 19:39           ` Hans Hagen via ntg-context
2024-03-16  2:46             ` seyal zavira [this message]
2024-03-16 12:21             ` Jean-Pierre Delange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADiGc-krtwLNeHZbeeZ7eVaCPJkPn0OSCcScHqBDmNRcwEs4tg@mail.gmail.com \
    --to=seyal.zavira@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).