ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: SVG not rendering correctly with LMTX and conversion=mp
Date: Mon, 18 Oct 2021 22:38:57 +0200	[thread overview]
Message-ID: <2bb08ee2-6a33-b077-603f-f7b72659b1ba@xs4all.nl> (raw)
In-Reply-To: <498c7a1d-1c3f-cd20-6c78-9edc58868461@gmail.com>

On 10/18/2021 5:15 PM, Jason Ross via ntg-context wrote:
> The following MWE fails to render the text in the attached SVG properly:
> 
> 
> \starttext
> \externalfigure[test.svg][conversion=mp]
> \stoptext
> 
> 
> The axis labels, tick labels, and title are all incorrect. This file was
> generated with Matplotlib.
we actually can avoid that by using label remapping (i fixed a scanning 
buglet in the first example:)

\startTEXpage
     \startMPcode
             lmt_remaptext [ label = "here 1", where = "l", text = "\bfa 
let's try this one out" ] ;
             lmt_remaptext [ label = "here 2", where = "r", text = 
"let's try this one out too" ] ;
             lmt_remaptext [ label = "here 3", where = "l", text = "$e = 
mc^2$" ] ;
             lmt_remaptext [ label = "here 5", where = "m", text = "this 
a bit longer label" ] ;
             lmt_remaptext [ label = "here 4", where = "m", text = "!", 
dx = -1pt, dy = -30pt ] ;
             draw lmt_svg [
                 filename  = "labels-003.svg",
             ] ;
     \stopMPcode
\stopTEXpage

one can also have the labels externally

\startluacode
     table.save ( "labels-001.lua", {
         { label = "here 1", where = "l", text = "let's try this one out" },
         { label = "here 2", where = "r", text = "let's try this one out 
too" },
         { label = "here 3", where = "l", text = "$e = mc^2$" },
         { label = "here 5", where = "m", text = "this a bit longer 
label" },
         { label = "here 4", where = "m", text = "!" },
     } )
\stopluacode

\startMPpage
     draw lmt_svg [
         filename  = "labels-003.svg",
         labelfile = "labels-001.lua",
     ] ;
\stopMPpage

the idea is then that in an svg editor one uses symbolic names and when 
including those get property typeset

(should work in in next upload; is independent of reported issue)

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

  parent reply	other threads:[~2021-10-18 20:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 15:15 Jason Ross via ntg-context
2021-10-18 15:38 ` Luis Montgomery via ntg-context
2021-10-18 15:49   ` Jason Ross via ntg-context
2021-10-18 16:16     ` Luis Montgomery via ntg-context
2021-10-18 16:06 ` mf via ntg-context
2021-10-18 16:30   ` Hans Hagen via ntg-context
2021-10-18 16:33     ` mf via ntg-context
2021-10-18 21:20     ` mf via ntg-context
2021-10-18 16:40   ` Hans Hagen via ntg-context
2021-10-18 20:38 ` Hans Hagen via ntg-context [this message]
2021-10-18 20:58 ` Luis Montgomery via ntg-context

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=2bb08ee2-6a33-b077-603f-f7b72659b1ba@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@xs4all.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).