[texhax] TFM format question

Reinhard Kotucha reinhard.kotucha at web.de
Wed Apr 20 11:26:36 CEST 2011


On 2011-04-19 at 22:39:47 -0600, Doug McKenna wrote:

 > I've been trying to understand the TFM (TeX Font Metric) file format, 
 > using tftopl to convert to a property list, and also peeking in at the 
 > raw binary data.  I thought I understood things until the following 
 > caught my attention.
 > 
 > The file at
 > 
 >  /usr/local/texlive/2010/texmf-dist/fonts/tfm/public/misc/manfnt.tfm
 > 
 > has a file header that declares (in the big-endian binary, in the first 
 > 24 bytes) the range of character codes in the font to be between bc=33 
 > (begin char) and ec=127 (end char) (decimal).  But when one dumps the 
 > data with tftopl, the initial part is (with my added comments):
 > 
 > (FAMILY MANFNT)
 > [...]
 > (CHARACTER O 0            <-- What is this character?
 >    (CHARWD R 1.388893)
 >    (CHARHT R 0.75)
 >    )
 > ... [etc.]

This question can be answered easily:

  pdftex fontchart

You are asked for a font then.

 > It's declaring characters 0, 1, ... 8 (and there's more), all with 
 > character codes less than 33.
 > 
 > So how can this be?  Are these extra spurious declarations that are
 > forever ignored, because they're out of declared range?  Or am I
 > missing something about the internal consistency of the format?  Is
 > this an ancient vestigial file, built with an older tool with less
 > strict rules?  I've not seen this in other fonts I've dumped, but
 > I've only tried it on a very few TFM files.

These values are calculated automatically when the tfm file is created
but it seems that they are not used by TeX because characters < 33 are
accessible.

I suppose that they were used by TeX2 and Knuth didn't want to remove
them when he switched from 7 to 8 bit fonts, for the sake of
compatibility with older TFM files.

Maybe you have to look into the sources.  Do you get the same results
if you convert the TFM file to PL and then back to TFM?  I get:

 $ cmp manfnt-1.tfm manfnt.tfm 
 manfnt-1.tfm manfnt.tfm differ: byte 93, line 1

This is the only byte which differs, it's 0x00 in the original file
and 0x80 in the converted one, but I don't know its meaning.

For those who want to investigate how pltotf determines the bc/ec
values but don't have the TeX Live sources, I've put the documented
source code here:

  http://ms25.ath.cx/pltotf.pdf

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


More information about the texhax mailing list