Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Where in most font files do they store information such as "If character %1 is followed by character %2, decrease the spacing by x points"? Are all the (%1,%2, resulting_kerning) tuples in a central location by themselves, or would the section of the font file describing %2 have a section identifying %1 as a kerning pair (or a table of (%1, resulting_kerning) tuples if %2 had multiple possible kerning results for different preceding characters)? Or something different? How is it actually architected in most font file formats?

%1 and %2 were just used as symbol placeholders in my question here.

share|improve this question

2 Answers 2

up vote 18 down vote accepted

For Classic TeX using tfm files the kerning and ligature information is in the ligtable in the tfm file. That is a binary file but there is a human readable version of it "property list" format, and a tftopl utility to convert the file:

On the command line (texlive version, other implementations may vary slightly)

tftopl cmr10.tfm

Produces a long list of font metric information which you might want to direct to a file. The bit you are interested in is

(LIGTABLE
   (LABEL O 40)
   (KRN C l R -0.277779)
   (KRN C L R -0.319446)
   (STOP)

where you can find for example

   (LABEL C F)
   (LABEL C V)
   (LABEL C W)
   (KRN C o R -0.083334)
   (KRN C e R -0.083334)
   (KRN C u R -0.083334)
   (KRN C r R -0.083334)
   (KRN C a R -0.083334)
   (KRN C A R -0.111112)

which information is repeated as a comment in the characters main entry:

(CHARACTER C V
   (CHARWD R 0.750002)
   (CHARHT R 0.683332)
   (CHARIC R 0.013888)
   (COMMENT
      (KRN C o R -0.083334)
      (KRN C e R -0.083334)
      (KRN C u R -0.083334)
      (KRN C r R -0.083334)
      (KRN C a R -0.083334)
      (KRN C A R -0.111112)
      (KRN C O R -0.027779)
      (KRN C C R -0.027779)
      (KRN C G R -0.027779)
      (KRN C Q R -0.027779)
      )

Which tells you the height width and italic correction of a capital V and the fact that it has a negative kern of -0.111112 *10pt if followed by A.

share|improve this answer
1  
Thanks very much. Now I'm interested to find documentation for Property List format to know what words/things all those codes such as 'O', 'C', and 'R' are supposed to represent. –  Pete Apr 24 '13 at 14:00
    
They'll be in the metafont book (not free) you can use texdoc tftopl but that's the documented source of the program and a bit opaque:-) C is character O is octal R is a real number (a length in pt usually) –  David Carlisle Apr 24 '13 at 14:34
    
@DavidCarlisle Actually SPACE R 0.333334 means "0.333334" times the design size, which is in points. So for cmr10 the space is 3.333334pt because the design size is 10 (this is in points). –  egreg Apr 24 '13 at 18:04
    
@egreg Oh yes, that makes more sense:-) –  David Carlisle Apr 24 '13 at 18:11
    
I had too many 3's the last time. :) I'd like to note that for Postscript fonts, the TFM files are usually derived from AFM files with fontinst. –  egreg Apr 24 '13 at 20:08

In Computer Modern family (METAFONT) such information is described in *.mf (METAFONT) files and used via *.tfm (Table of Font Metric) files.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.