[tex-k] Length of Computer Modern TFM files

Jonathan Kew jfkthame at gmail.com
Fri Feb 9 14:43:10 CET 2018


On 09/02/2018 12:06, Heiko Theißen wrote:
> It is, however, necessitated by the `eof' check that TeX makes when
> reading a TFM file, according to the following section of tex.web:
> 
> @<Read font parameters@>=
> begin for k:=1 to np do
>    if k=1 then {the |slant| parameter is a pure number}
>      begin fget; sw:=fbyte; if sw>127 then sw:=sw-256;
>      fget; sw:=sw*@'400+fbyte; fget; sw:=sw*@'400+fbyte;
>      fget; font_info[param_base[f]].sc:=
>        (sw*@'20)+(fbyte div@'20);
>      end
>    else store_scaled(font_info[param_base[f]+k-1].sc);
> if eof(tfm_file) then abort; {this abort will be triggered for
> cmfi10.tfm and cmmi5.tfm}
> for k:=np+1 to 7 do font_info[param_base[f]+k-1].sc:=0;
> end

I don't think this is a correct interpretation. TeX reads from the TFM 
file by accessing |fbyte|, which (by default) is defined as tfm_file^, 
i.e. the "current" byte of the file. The file pointer is advanced by 
|fget| _before_ reading each byte; it is not advanced _after_ reading 
the last byte of the file.

Therefore, when the above for-loop finishes reading the last font 
parameter, the file pointer will still be pointing at the last byte of 
the (expected length of the) file; it will _not_ have been advanced past 
that byte. And so |eof(tfm_file)| will be true only if the file was 
actually shorter than expected, not if its length was exactly correct. 
(And as §575 says, no error message is given for files having more than 
|lf| words.)

JK


More information about the tex-k mailing list