<div dir="ltr">Thanks! <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 8 juil. 2019 à 12:09, Taco Hoekwater <<a href="mailto:taco@elvenkind.com">taco@elvenkind.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On 8 Jul 2019, at 11:41, Maxime Chupin <<a href="mailto:notezik@gmail.com" target="_blank">notezik@gmail.com</a>> wrote:<br>
> <br>
> Hi,<br>
> 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?<br>
<br>
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. <br>
<br>
Either use the boundingbox() method which returns four floats for the boundingbox corners, or set charwd etc. from within metapost code.<br>
<br>
Best wishes,<br>
Taco<br>
<br>
> <br>
> Thanks in advance<br>
> <br>
> Maxime Chupin<br>
> <br>
> local mpkpse = kpse.new('luatex', 'mpost')<br>
> <br>
> local function finder(name, mode, ftype)<br>
>    if mode == "w" then<br>
>   return name<br>
>    else<br>
>   return mpkpse:find_file(name,ftype)<br>
>    end<br>
> end<br>
> <br>
> <br>
> function getpathfrommp(s)<br>
>    local mp = mplib.new({<br>
>          find_file = finder,})<br>
>    mp:execute('input plain ;')<br>
>    local rettable<br>
>    rettable = mp:execute('beginfig(1); draw (0,0)--(2cm,2cm); endfig;')<br>
>    print("\nstatus: ".. rettable.status)<br>
>    print(rettable.log)<br>
>    if rettable.status == 0 then<br>
>       print("height: "..rettable.fig[1]:height())<br>
>    end<br>
> end<br>
> <br>
> getpathfrommp()<br>
> <br>
> <br>
> -- <br>
> Maxime Chupin<br>
> Site personnel : <a href="http://fougeriens.org/~mc/" rel="noreferrer" target="_blank">http://fougeriens.org/~mc/</a><br>
> Site professionnel : <a href="https://www.ceremade.dauphine.fr/~chupin/" rel="noreferrer" target="_blank">https://www.ceremade.dauphine.fr/~chupin/</a><br>
> adresse libre : <a href="mailto:chupin@fougeriens.org" target="_blank">chupin@fougeriens.org</a><br>
> --<br>
> <a href="http://tug.org/metapost/" rel="noreferrer" target="_blank">http://tug.org/metapost/</a><br>
<br>
Taco Hoekwater<br>
Elvenkind BV<br>
<br>
<br>
<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Maxime Chupin<br>Site personnel : <a href="http://fougeriens.org/~mc/" target="_blank">http://fougeriens.org/~mc/</a><br>Site professionnel : <a href="http://www.ceremade.dauphine.fr/~chupin/" target="_blank">https://www.ceremade.dauphine.fr/~chupin/</a><br></div><div>adresse libre : <a href="mailto:chupin@fougeriens.org" target="_blank">chupin@fougeriens.org</a></div></div></div></div></div>