Re: Uninitialized variable sometimes causing malformedTFM files

luigi scarso <[email protected]> Sun, 24 Mar 2019 02:08:52 +0100
Newsgroups gmane.comp.tex.metapost
Message-ID <CAG5iGsDzdtEnmQ31j3qLzvHrzr7_=HnN+pUqyMyqye0i1CCddg@mail.gmail.com>
On Wed, Mar 20, 2019 at 10:19 PM Akira Kakuto <[email protected]> wrote:

> > ! Inconsistent equation (off by 2.77794).
> > <to be read again>
> >                    ;
> > l.230 mm*bpppix_=2.83464;
> >                               pt*bpppix_=0.99626;
> > ?
>
> Confirmed.
>
> The command mfplain seems to work:
>
>
yes , but  we can keep the same mp source as in mplib :
so
$> mpost --ini test.mp

# cat test.mp
input mfplain;mode:=localfont;input cmr10.mf;


and

# luatex test.tex

# cat test.tex
\directlua{
local find_file
do
  local kpse = kpse.new('lualatex', 'mpost')
  find_file = function(name, mode, type)
    return mode == 'w' and name or kpse:find_file(name, type) or (type ==
'mp' and kpse:find_file(name, 'mf'))
  end
end
local mp = mplib.new{
  job_name = 'cmr10',
  find_file = find_file,
  math_mode = 'scaled',
}
local result = mp:execute'input mfplain;mode:=localfont;input cmr10.mf;'
print(result.term)
}
\bye

must give the same result.

I have made a fix that uses calloc instead of malloc, because I have found
that some nodes  can use uninitialized memory.



-- 
luigi

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