8

With the exception of cmfi10.tfm and cmmi5.tfm, all the TFM files in the Computer Modern distribution have an extra 0x00 byte at the end, which makes them one byte longer than claimed by their first two bytes (their lf integer). Incidentally(?), the two exceptions are newer files (they date from 1996-07-08 rather than 1992-08-10).

Why is this? Were the newer files generated by a different version of Metafont? The TFM specification in the tex.web and mf.web source code does not mention the extra 0x00.

When I compiled a version of TeX with ISO Pascal, I had to omit some end-of-file checks from the original WEB program, because they worked only if the extra 0x00 byte was present. Therefore my change file contains the following

@x
if eof(tfm_file) then abort;
for k:=np+1 to 7 do font_info[param_base[f]+k-1].sc:=0;
@y
{|eof(tfm_file)| is true after the last byte has been read}
for k:=np+1 to 7 do font_info[param_base[f]+k-1].sc:=0;
@z

Has any version of TeX had a problem with the extra 0x00 or its absence? I assume that every version has system-dependent changes in the file system interface anyway.

6
  • 1
    Welcome to TeX.SE!
    – Mensch
    Commented Oct 23, 2021 at 13:20
  • 2
    If I do hexdump on cmr10.tfm, I don't see a 00 final byte. How are you looking at the file?
    – egreg
    Commented Oct 23, 2021 at 13:31
  • 1
    I wrote a Node.js program to fetch the files from the CTAN archive and looked at the byte stream in the response. I learned from the tex-k mailing list that the TeX Live distribution doesn't have the extra 0x00. Commented Oct 23, 2021 at 13:34
  • 1
    Serious question: Why and in what context does that matter?
    – Ingmar
    Commented Oct 23, 2021 at 13:54
  • 3
    It matters for the end-of-file checks in the TeX program. Without my change file, ISO Pascal detected eof(fmt_file) and reported "bad format" when reading the cmfi10.tfm file. I would like to know whether to adapt the TFM file or the reading routine. Commented Oct 23, 2021 at 14:22

1 Answer 1

4

The TFM files have been updated in the CTAN archive and now have the length that is claimed by their lf integer. In other words: A superfluous final 0x00 has been removed. Thanks to all involved!

For my ISO Pascal change file this means that statements like

if eof(tfm_file) then abort;

must continue to be commented out, because of the way I read files with ISO Pascal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .