[comp.text.tex] Kerning

dhosek@sif.claremont.edu (Hosek, Donald A.) (06/03/90)

In article <9702@discus.technion.ac.il>, joel@techunix.BITNET (Yossi (Joel) Hoffman) writes...
>I've considered doing this; but I wonder how the kerning (if I have my
>terms straight) would work.  When "WA" is typeset, the 'W' actually
>ends up partially "over" the 'A.'  Is this an automatic process?  If I
>make a caligraphic 'A' that looks like, say:

> ____________________
>/                   /\
>                   /  \
>                  /    \
>                 /======\
>                /        \
>               /          \
>              /            \

>and put it after a sentence that ends with 'i,' so that I had "i.  A"
>would I automatically get:

> ____________________
>/                   /\
>                   /  \
>   o              /    \
>                 /======\
>   |            /        \
>   |           /          \
>   | o        /            \
> 

>or do I have to specify each case of kerning separately?

There are two ways to handle character "overlap" with TeX fonts.
The first is to have TeX think the character is smaller than it
appears by drawing outside of its bounding box. A very common
case of this occurs in many lower case f's which (with their
bounding box) appear something like this:

+---------+
|    xxxxxxxxxxx
|   xxxxxxxxxxxxx
|  xxx    |    xxx
|  xxx    |
|  xxx    |
|  xxx    |
| xxxxxxx |
| xxxxxxx |
|  xxx    |
|  xxx    |
|  xxx    |
|  xxx    |
|  xxx    |
| xxxxx   |
| xxxxx   |
+---------+

Note that TeX does not maintain any sidebearing information other
than the box sizes (see the TeXbook, pp. 63-67). Thus the above
letter followed by, say, "o" would be typeset as (showing
bounding boxes still).

+---------+
|    xxxxxxxxxxx
|   xxxxxxxxxxxxx
|  xxx    |    xxx
|  xxx    |
|  xxx    |
|  xxx    +---------------+
| xxxxxxx |     xxxxx     |
| xxxxxxx |   xxxxxxxxx   |
|  xxx    | xxxx     xxxx |
|  xxx    | xxxx     xxxx |
|  xxx    | xxxx     xxxx |
|  xxx    | xxxx     xxxx |
|  xxx    | xxxx     xxxx |
| xxxxx   |   xxxxxxxxx   |
| xxxxx   |     xxxxx     |
+---------+---------------+


note the overhang.

The other possibility would be to set up implicit kern pairs.
(this is described in the MFbook, pp. 316-7). You want to do this
only in the cases where only a certain pair of letters should be
brought closer together. Let's spell a word and toss an "x" onto
the end of the above two letters:

+---------+
|    xxxxxxxxxxx
|   xxxxxxxxxxxxx
|  xxx    |    xxx
|  xxx    |
|  xxx    |
|  xxx    +---------------+---------------+
| xxxxxxx |     xxxxx     | xxxx     xxxx |
| xxxxxxx |   xxxxxxxxx   |   xxx   xxx   |
|  xxx    | xxxx     xxxx |    xxx xxx    | 
|  xxx    | xxxx     xxxx |     xxxxx     |
|  xxx    | xxxx     xxxx |      xxx      |
|  xxx    | xxxx     xxxx |     xxxxx     |
|  xxx    | xxxx     xxxx |    xxx xxx    |
| xxxxx   |   xxxxxxxxx   |   xxx   xxx   |
| xxxxx   |     xxxxx     | xxxx     xxxx |
+---------+---------------+---------------+

There's a bit too much space between the "o" and the "x" here.
What we can do is tell TeX to bring those two letters a little
closer together; this will give us something that looks like this
instead (I've removed bounding boxes here to keep things a little
less cluttered. The "x" is now two pixels closer to the "o"):


     xxxxxxxxxxx
    xxxxxxxxxxxxx
   xxx         xxx
   xxx     
   xxx     
   xxx                                     
  xxxxxxx       xxxxx     xxxx     xxxx  
  xxxxxxx     xxxxxxxxx     xxx   xxx    
   xxx      xxxx     xxxx    xxx xxx      
   xxx      xxxx     xxxx     xxxxx      
   xxx      xxxx     xxxx      xxx       
   xxx      xxxx     xxxx     xxxxx      
   xxx      xxxx     xxxx    xxx xxx     
  xxxxx       xxxxxxxxx     xxx   xxx    
  xxxxx         xxxxx     xxxx     xxxx  

MFhackers and MF-wannabe-hackers should have both the MFbook and
volume E of C&T (Computer Modern Typefaces) handy if they want to
really have a good feel for the language and how it works.

-dh


---
Don Hosek                         "When I was younger, I would throw
dhosek@ymir.claremont.edu          spitballs at girls that I liked. Now,
dhosek@ymir.bitnet                 I beg and plead for dates. Frankly, the
uunet!jarthur!ymir                 old way was more satisfying."