[tex-k] Length of Computer Modern TFM files

Heiko Theißen HeikoTheissen at web.de
Fri Feb 9 13:06:02 CET 2018


Dear TeX community,

with the exception of cmfi10.tfm and cmmi5.tfm, all the TFM files in
the Computer Modern distribution (www.ctan.org/fonts/cm/tfm/) have an
extra 0x00 byte at the end, which means they are one byte longer than
claimed by their first two bytes (their `lf' integer).

This seems not warranted by the specification in tex.web and mf.web,
and METAFONT does not output such an extra 0x00, according to the
following section from mf.web:

@ @<Output the extensible character recipes...@>=
for k:=0 to ne-1 do tfm_qqqq(exten[k]);
for k:=1 to np do
  if k=1 then
    if abs(param[1])<fraction_half then tfm_four(param[1]*16)
    else  begin incr(tfm_changed);
      if param[1]>0 then tfm_four(el_gordo)
      else tfm_four(-el_gordo);
      end
  else tfm_four(dimen_out(param[k]));
if tfm_changed>0 then
  begin if tfm_changed=1 then print_nl("(a font metric dimension")
@.a font metric dimension...@>
  else  begin print_nl("("); print_int(tfm_changed);
@.font metric dimensions...@>
    print(" font metric dimensions");
    end;
  print(" had to be decreased)");
  end

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 know how the TFM files in www.ctan.org/fonts/cm/tfm/ were
produced, but overall this is not consistent: The METAFONT definition
and implementation of TFM files omits the final 0x00, whereas the TeX
implementation seems to assume it, at least when the file operations
are implemented as in ISO Pascal: After the final byte of cmmi5.tfm
has been read via `fget', `eof(tfm_file)' will be true if there is no
final 0x00.

(I found this out while trying to compile a customized TeX version
with Free Pascal in ISO mode.)

Best regards, Heiko Theißen

-----

Attachment: TFM lengths and file lengths

cmbsy10.tfm:
  tfmLength: 1116
  fileLength: 1117
cmbx10.tfm:
  tfmLength: 1328
  fileLength: 1329
cmb10.tfm:
  tfmLength: 1336
  fileLength: 1337
cmbx12.tfm:
  tfmLength: 1324
  fileLength: 1325
cmbx6.tfm:
  tfmLength: 1344
  fileLength: 1345
cmbx7.tfm:
  tfmLength: 1336
  fileLength: 1337
cmbx9.tfm:
  tfmLength: 1328
  fileLength: 1329
cmbx5.tfm:
  tfmLength: 1332
  fileLength: 1333
cmbxsl10.tfm:
  tfmLength: 1532
  fileLength: 1533
cmbxti10.tfm:
  tfmLength: 1532
  fileLength: 1533
cmbx8.tfm:
  tfmLength: 1332
  fileLength: 1333
cmcsc10.tfm:
  tfmLength: 1300
  fileLength: 1301
cmdunh10.tfm:
  tfmLength: 1296
  fileLength: 1297
cmex10.tfm:
  tfmLength: 992
  fileLength: 993
cmff10.tfm:
  tfmLength: 1324
  fileLength: 1325
cmfib8.tfm:
  tfmLength: 1280
  fileLength: 1281
cmfi10.tfm:
  tfmLength: 1424
  fileLength: 1424
cminch.tfm:
  tfmLength: 492
  fileLength: 493
cmmi10.tfm:
  tfmLength: 1528
  fileLength: 1529
cmitt10.tfm:
  tfmLength: 768
  fileLength: 769
cmmi5.tfm:
  tfmLength: 1508
  fileLength: 1508
cmmi12.tfm:
  tfmLength: 1524
  fileLength: 1525
cmmi6.tfm:
  tfmLength: 1512
  fileLength: 1513
cmr12.tfm:
  tfmLength: 1288
  fileLength: 1289
cmmi7.tfm:
  tfmLength: 1528
  fileLength: 1529
cmmi8.tfm:
  tfmLength: 1520
  fileLength: 1521
cmmi9.tfm:
  tfmLength: 1524
  fileLength: 1525
cmr5.tfm:
  tfmLength: 1220
  fileLength: 1221
cmmib10.tfm:
  tfmLength: 1524
  fileLength: 1525
cmr10.tfm:
  tfmLength: 1296
  fileLength: 1297
cmsa10.tfm:
  tfmLength: 704
  fileLength: 705
cmr7.tfm:
  tfmLength: 1300
  fileLength: 1301
cmr9.tfm:
  tfmLength: 1292
  fileLength: 1293
cmsl12.tfm:
  tfmLength: 1504
  fileLength: 1505
cmr6.tfm:
  tfmLength: 1300
  fileLength: 1301
cmr8.tfm:
  tfmLength: 1292
  fileLength: 1293
cmsl10.tfm:
  tfmLength: 1508
  fileLength: 1509
cmsltt10.tfm:
  tfmLength: 772
  fileLength: 773
cmsl8.tfm:
  tfmLength: 1504
  fileLength: 1505
cmss12.tfm:
  tfmLength: 1324
  fileLength: 1325
cmss17.tfm:
  tfmLength: 1320
  fileLength: 1321
cmss10.tfm:
  tfmLength: 1316
  fileLength: 1317
cmr17.tfm:
  tfmLength: 1292
  fileLength: 1293
cmsl9.tfm:
  tfmLength: 1504
  fileLength: 1505
cmss8.tfm:
  tfmLength: 1296
  fileLength: 1297
cmss9.tfm:
  tfmLength: 1320
  fileLength: 1321
cmssbx10.tfm:
  tfmLength: 1272
  fileLength: 1273
cmssi12.tfm:
  tfmLength: 1532
  fileLength: 1533
cmssdc10.tfm:
  tfmLength: 1328
  fileLength: 1329
cmssi17.tfm:
  tfmLength: 1528
  fileLength: 1529
cmssi10.tfm:
  tfmLength: 1520
  fileLength: 1521
cmssi8.tfm:
  tfmLength: 1500
  fileLength: 1501
cmssi9.tfm:
  tfmLength: 1524
  fileLength: 1525
cmssq8.tfm:
  tfmLength: 1304
  fileLength: 1305
cmssqi8.tfm:
  tfmLength: 1496
  fileLength: 1497
cmsy10.tfm:
  tfmLength: 1124
  fileLength: 1125
cmsy5.tfm:
  tfmLength: 1112
  fileLength: 1113
cmsy6.tfm:
  tfmLength: 1116
  fileLength: 1117
cmsy9.tfm:
  tfmLength: 1116
  fileLength: 1117
cmsy8.tfm:
  tfmLength: 1120
  fileLength: 1121
cmsy7.tfm:
  tfmLength: 1120
  fileLength: 1121
cmtcsc10.tfm:
  tfmLength: 776
  fileLength: 777
cmtex10.tfm:
  tfmLength: 768
  fileLength: 769
cmtex8.tfm:
  tfmLength: 768
  fileLength: 769
cmtex9.tfm:
  tfmLength: 764
  fileLength: 765
cmti10.tfm:
  tfmLength: 1480
  fileLength: 1481
cmti12.tfm:
  tfmLength: 1484
  fileLength: 1485
cmti7.tfm:
  tfmLength: 1492
  fileLength: 1493
cmti8.tfm:
  tfmLength: 1504
  fileLength: 1505
cmtt10.tfm:
  tfmLength: 768
  fileLength: 769
cmti9.tfm:
  tfmLength: 1476
  fileLength: 1477
cmtt12.tfm:
  tfmLength: 772
  fileLength: 773
cmtt8.tfm:
  tfmLength: 768
  fileLength: 769
cmu10.tfm:
  tfmLength: 1276
  fileLength: 1277
cmvtt10.tfm:
  tfmLength: 1248
  fileLength: 1249
dummy.tfm:
  tfmLength: 1124
  fileLength: 1125
cmtt9.tfm:
  tfmLength: 764
  fileLength: 765
manfnt.tfm:
  tfmLength: 780
  fileLength: 781
old_manfnt.tfm:
  tfmLength: 780
  fileLength: 781



More information about the tex-k mailing list