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
___________________________________________________________________________________

Reply via email to