[metapost] No log neither heigh of the fig (mplib)

Maxime Chupin notezik at gmail.com
Mon Jul 8 12:47:09 CEST 2019


Thanks!

Le lun. 8 juil. 2019 à 12:09, Taco Hoekwater <taco at elvenkind.com> a écrit :

>
>
> > On 8 Jul 2019, at 11:41, Maxime Chupin <notezik at gmail.com> 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 : chupin at fougeriens.org
> > --
> > 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 : chupin at fougeriens.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/metapost/attachments/20190708/bcc39379/attachment.html>


More information about the metapost mailing list