[Q] TFM files headers

Tomas Rokicki rokicki at gmail.com
Fri Sep 13 18:19:20 CEST 2019


Oh, dang, looks like the TFM file format does not require bc <= ec.
The amsfonts/dummy example is loaded by TeX and also accepted
by tftopl.  It does require however that bc <= ec+1 and that ec<256.

The tftopl check reads as follows:

if (bc>ec+1)or(ec>255) then abort('The character code range ',

In TeX we see:

if (bc>ec+1)or(ec>255) then abort;
if bc>255 then {|bc=256| and |ec=255|}
  begin bc:=1; ec:=0;
  end;

That second part is interesting and unexpected; I believe it's there just so
a tfm file that is empty but using bc=256/ec=255 to indicate that, can still
work in an environment where bc and ec are stored in 8-bit bytes.

TeX also explicitly ignores extra stuff at the end:

@ We check to see that the \.{TFM} file doesn't end prematurely; but
no error message is given for files having more than |lf| words.


-tom


On Fri, Sep 13, 2019 at 9:04 AM Tomas Rokicki <rokicki at gmail.com> wrote:

> I also noticed the tfm files with the wrong length (extra stuff on the
> end).
> While this is moderately unfortunate it's also not critical since all the
> TFM parsers appear to read the TFM files front to back and just ignore
> the junk.
>
> I confirm (with my own TFM parser) that there are 2060 "tfm" files in the
> distribution with bc > ec.  They are in the following directories (with
> counts
> of the "bad" files).  These files may also have other issues (like bad
> header lengths).  My suspicion is nobody has ever (successfully) used
> any of these fonts.  A cursory test appears to show that TeX cannot load
> these fonts either.
>
>   24 /usr/local/texlive/2019/texmf-dist/fonts/tfm/ptex-fonts/standard
>
>   12 /usr/local/texlive/2019/texmf-dist/fonts/tfm/ptex-fonts/nmin-ngoth
>
>    8 /usr/local/texlive/2019/texmf-dist/fonts/tfm/ptex-fonts/jis
>
>    4 /usr/local/texlive/2019/texmf-dist/fonts/tfm/ptex-fonts/dvips
>
> 1080 /usr/local/texlive/2019/texmf-dist/fonts/tfm/public/japanese-otf
>
>  522
> /usr/local/texlive/2019/texmf-dist/fonts/tfm/public/japanese-otf-uptex
>
>   40 /usr/local/texlive/2019/texmf-dist/fonts/tfm/public/jlreq
>
>    1 /usr/local/texlive/2019/texmf-dist/fonts/tfm/public/amsfonts/dummy
>
>   24 /usr/local/texlive/2019/texmf-dist/fonts/tfm/public/zhmetrics-uptex
>
>  260 /usr/local/texlive/2019/texmf-dist/fonts/tfm/public/pxufont
>
>   12 /usr/local/texlive/2019/texmf-dist/fonts/tfm/public/hfoldsty
>
>   25 /usr/local/texlive/2019/texmf-dist/fonts/tfm/public/morisawa
>
>   40 /usr/local/texlive/2019/texmf-dist/fonts/tfm/uptex-fonts/jis
>
>    8 /usr/local/texlive/2019/texmf-dist/fonts/tfm/uptex-fonts/min
>
> On Fri, Sep 13, 2019 at 4:13 AM Didier Verna <didier at didierverna.net>
> wrote:
>
>> "Taylor, P" <P.Taylor at rhul.ac.uk> wrote:
>>
>> > What (if anything) does TFtoPL have to say about the files that your
>> > parser identifies as being non-compliant ? Philip Taylor
>>
>>   It agrees with me :-D
>>
>> --
>> Resistance is futile. You will be jazzimilated.
>>
>> Lisp, Jazz, Aïkido: http://www.didierverna.info
>>
>>
>
> --
> --  http://cube20.org/  --  http://golly.sf.net/  --
>


-- 
--  http://cube20.org/  --  http://golly.sf.net/  --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20190913/2f168838/attachment.html>


More information about the texhax mailing list