Re: No log neither heigh of the fig (mplib)

Maxime Chupin <[email protected]> Mon, 8 Jul 2019 12:47:09 +0200
Newsgroups gmane.comp.tex.metapost
Message-ID <CAJPNWxCQKjQYV04PKp5hVjq+W276Z-dh+6X0KqTCFfOMNbeK_Q@mail.gmail.com>
Thanks!

Le lun. 8 juil. 2019 à 12:09, Taco Hoekwater <[email protected]> a écrit :

>
>
> > On 8 Jul 2019, at 11:41, Maxime Chupin <[email protected]> wrote:
> >
> > Hi,
> > I do not understand why the following code does not produce a log and a
> height (or width) for the fig. Any help to find out what I do not do right?
>
> The height(), depth(), width() and italcorr() methods return the value you
> have set for charht, chardp, charwd, charit in metapost. Since you do not
> set any of those, the functions return 0.0.
>
> Either use the boundingbox() method which returns four floats for the
> boundingbox corners, or set charwd etc. from within metapost code.
>
> Best wishes,
> Taco
>
> >
> > Thanks in advance
> >
> > Maxime Chupin
> >
> > local mpkpse = kpse.new('luatex', 'mpost')
> >
> > local function finder(name, mode, ftype)
> >    if mode == "w" then
> >   return name
> >    else
> >   return mpkpse:find_file(name,ftype)
> >    end
> > end
> >
> >
> > function getpathfrommp(s)
> >    local mp = mplib.new({
> >          find_file = finder,})
> >    mp:execute('input plain ;')
> >    local rettable
> >    rettable = mp:execute('beginfig(1); draw (0,0)--(2cm,2cm); endfig;')
> >    print("\nstatus: ".. rettable.status)
> >    print(rettable.log)
> >    if rettable.status == 0 then
> >       print("height: "..rettable.fig[1]:height())
> >    end
> > end
> >
> > getpathfrommp()
> >
> >
> > --
> > Maxime Chupin
> > Site personnel : http://fougeriens.org/~mc/
> > Site professionnel : https://www.ceremade.dauphine.fr/~chupin/
> > adresse libre : [email protected]
> > --
> > http://tug.org/metapost/
>
> Taco Hoekwater
> Elvenkind BV
>
>
>
>
>

-- 
Maxime Chupin
Site personnel : http://fougeriens.org/~mc/
Site professionnel : https://www.ceremade.dauphine.fr/~chupin/
<http://www.ceremade.dauphine.fr/~chupin/>
adresse libre : [email protected]

--
http://tug.org/metapost/