[comp.fonts] Types of kerning

avi@dgp.toronto.edu (Avi Naiman) (09/08/90)

In article <4cac478e.20b6d@apollo.HP.COM> laporta@apollo.HP.COM
(John X. Laporta) writes:

>By the way, are you aware that there are three types of kerning:

>    overall kerning - an identical (positive/negative) amount is
>        added to the distance between each pair of characters.
>    track kerning - like overall kerning, but the values differ
>        for different ranges of point sizes within a given font.
>    pairwise/triplet kerning - a lookup table offers kerning
>        increments/decrements for specific pairs of characters
>        and for the pairs in specific triplets. Kerning triplets
>        are often used when the font has no ligatures (e.g. for
>        "ffl").

I'm familiar with at least two other types of kerning:

Sector Kerning.  Each character in a font is split into a number of
horizontal sectors.  In each sector, a penetration value is specified
on each side of the character, indicating to what extent other
characters are allowed to penetrate into its 'space'.  To determine
the kerning for a specific pair of characters, in each sector the
right-hand penetration value of the left-hand character is added to
the left-hand penetration value of the right-hand character.  The
minimum of these sums is the maximum penetration allowed.  Kerning
is a function of this penetration amount, as well as other factors
such as overall kerning, track kerning, and letter spacing.  Note that
nothing requires each sector to be the same height.  For example, more
detail can be placed around the x-height for setting body text.
Furthermore, sector kerning can be used across fonts (assuming the
sector boundaries are the same for the two fonts -- which they need
not be), and the penetration values of more than two characters can be
considered at the same time (e.g., the spacing of a pair of characters
can be sensitive to the other characters in the word).  If the number
of sectors is a multiple of 4 and the penetration values are unsigned
bytes, kerning can be determined quite efficiently with unsigned long
addition (this is the approach taken in a commercial version of troff
which supports sector kerning).

Optical Spacing.  This isn't so much a 'kerning' technique as an overall
character spacing technique developed by David Kindersley, a typographer,
together with Neil Wiseman, a computer scientist.  Their approach is
to position a right-hand character such that the linear distance between
its fourth moment and that of the left-hand character is constant.  For
example, the fourth moment of 'A' is fairly low, while the fourth moment
of 'V' is quite high.  Therefore, the *spacing* for "AVA" will achieve
what others refer to as *kerning*.  Note that characters which are not
symmetric about a vertical axis may have a fourth moment displaced right
or left from the horizontal center of the character.  See the following
references for more details:

%L Kindersley 76
%A David Kindersley
%T Optical Letter Spacing for New Printing Systems
%I Sandstone Press
%C New York
%D 1976

%L Kindersley and Wiseman 79
%A David Kindersley
%A Neil E. Wiseman
%T Computer-Aided Letter Design
%J Printing World
%D October 1979
%P 12-17

Although their approach is far from universally accepted, there are two
important aspects to note.  First, it is EXTREMELY DANGEROUS for those
not trained in the art of typography (and don't think it's a science)
to hack together kerning tables.  [This warning applies to MOST people
found on the net!]  After the basic letterform shapes of a typeface (or
font -- i.e., a typeface's rendition at a specific size realized in a
specific medium) have been designed, a considerable amount of time is
spent tuning, re-tuning, and fine-tuning the spacing (and/or kerning).
To my knowledge, noone has yet found a satisfactory technique to determine
character spacing automatically (including Kindersley).

The second aspect to note is that 'kerning' is basically an exception
handler.  If the character spacing could be computed directly from the
shapes of a pair of characters (or all the characters in a word, line,
or even page), there would be no need to 'kern'.  The question of optimal
(and automated) spacing remains an open research topic, and is best left
to qualified investigators working with competent typographers.
-- 
Avi Naiman
avi@dgp.toronto.edu

xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) (09/08/90)

avi@dgp.toronto.edu (Avi Naiman) writes:
>
>Although their approach is far from universally accepted, there are two
>important aspects to note.  First, it is EXTREMELY DANGEROUS for those
>not trained in the art of typography (and don't think it's a science)
>to hack together kerning tables.

Aw, come on.  It's not like you're going to start a nuclear war if you
don't get it perfect or anything!

>[This warning applies to MOST people
>found on the net!]  After the basic letterform shapes of a typeface (or
>font -- i.e., a typeface's rendition at a specific size realized in a
>specific medium) have been designed, a considerable amount of time is
>spent tuning, re-tuning, and fine-tuning the spacing (and/or kerning).
>To my knowledge, noone has yet found a satisfactory technique to determine
>character spacing automatically (including Kindersley).

Fudging it 'til it looks right is a perfectly satisfactory technique, and
given automated assistance, can be quite effective.

>The second aspect to note is that 'kerning' is basically an exception
>handler.  If the character spacing could be computed directly from the
>shapes of a pair of characters (or all the characters in a word, line,
>or even page), there would be no need to 'kern'.  The question of optimal
>(and automated) spacing remains an open research topic, and is best left
>to qualified investigators working with competent typographers.

But rather than wait around for the millenium, try the following:

1) Rasterize the font at some resolution sufficient to adequately
represent the characters, but coarse enough to allow the rest of
the computation to finish somewhat before the heat death of the
universe.  Since this is a "one time" calculation, be willing to
invest some cpu cycles.

2) Overstrike each pixel in the rasterization of each character
with a disk of pixels the diameter of a nice looking character
spacing.  Call the result a "fattened font"

3) To save computation time, extract the four-connected border of each
character, call the result an "edge font".  You don't need the interior
borders, but it is probably easier to carry them along than figure out
how to get rid of them automatically.

4) For each left-right pair of edge font characters, in a rasterized
universe, starting at some sufficient separation, plot them step by
step closer together on the baseline until at least one pixel double
strikes; back off one pixel.

5) Take the result, + or - from normal spacing, as a first guess at
kerning.  Turn it into a "proportion of the character width" (or maybe
x-height) kern factor.

6) Plot sheets of all possible left right combinations, fudge the kerns
for the ones that still don't look right.

7) Plot sheets at a range of interesting point sizes, fudge the "track
kerning" to separate the small sizes more in proportion to their size,
the big sizes less.  Adjust to taste.  A cubic spline best fit through 
half a dozen hand adjusted cases will probably suffice for a curve for
"all" point sizes.

No incoming missiles?  Then its probably good enough for all but the
most incredibly fine quality work.

Note that there may be a couple of pathological cases where this fails
badly, like getting the hook of a j under the right hand stem of an x,
where a collision might occur but clear up with tighter kerning.  Thus
the hand fudging after the automated first effort is a necessity.

Kent, the man from xanth.
<xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us>

xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) (09/08/90)

avi@dgp.toronto.edu (Avi Naiman) writes:
>
>Although their approach is far from universally accepted, there are two
>important aspects to note.  First, it is EXTREMELY DANGEROUS for those
>not trained in the art of typography (and don't think it's a science)
>to hack together kerning tables.

Aw, come on.  It'c not like you're going to start a nuclear war if you
don't get it perfect or anything!

>[This warning applies to MOST people
>found on the net!]  After the basic letterform shapes of a typeface (or
>font -- i.e., a typeface's rendition at a specific size realized in a
>specific medium) have been designed, a considerable amount of time is
>spent tuning, re-tuning, and fine-tuning the spacing (and/or kerning).
>To my knowledge, noone has yet found a satisfactory technique to determine
>character spacing automatically (including Kindersley).

Fudging it 'til it looks right is a perfectly satisfactory technique, and
given automated assistance, can be quite effective.

>The second aspect to note is that 'kerning' is basically an exception
>handler.  If the character spacing could be computed directly from the
>shapes of a pair of characters (or all the characters in a word, line,
>or even page), there would be no need to 'kern'.  The question of optimal
>(and automated) spacing remains an open research topic, and is best left
>to qualified investigators working with competent typographers.

But rather than wait around for the millenium, try the following:

1) Rasterize the font at some resolution sufficient to adequately
represent the characters, but coarse enough to allow the rest of
the computation to finish somewhat before the heat death of the
universe.  Since this is a "one time" calculation, be willing to
invest some cpu cycles.

2) Overstrike each pixel in the rasterization of each character
with a disk of pixels the diameter of a nice looking character
spacing.  Call the result a "fattened font"

3) To save computation time, extract the four-connected border of each
character, call the result an "edge font".  You don't need the interior
borders, but it is probably easier to carry them along than figure out
how to get rid of them automatically.

4) For each left-right pair of edge font characters, in a rasterized
universe, starting at some sufficient separation, plot them step by
step closer together on the baseline until at least one pixel double
strikes; back off one pixel.

5) Take the result, + or - from normal spacing, as a first guess at
kerning.  Turn it into a "proportion of the character width" (or maybe
x-height) kern factor.

6) Plot sheets of all possible left right combinations, fudge the kerns
for the ones that still don't look right.

7) Plot sheets at a range of interesting point sizes, fudge the "track
kerning" to separate the small sizes more in proportion to their size,
the big sizes less.  Adjust to taste.  A cubic spline best fit through 
half a dozen hand adjusted cases will probably suffice for a curve for
"all" point sizes.

No incoming missiles?  Then its probably good enough for all but the
most incredibly fine quality work.

Note that there may be a couple of pathological cases where this fails
badly, like getting the hook of a j under the right hand stem of an x,
where a collision might occur but clear up with tighter kerning.  Thus
the hand fudging after the automated first effort is a necessity.

Kent, the man from xanth.
<xanthian@Zorch.SF-Bay.OBG> <xanthian@well.sf.ca.us>

tut@cairo.Sun.COM (Bill "Bill" Tuthill) (09/11/90)

avi@dgp.toronto.edu (Avi Naiman) writes:

> (John X. Laporta) writes:
> >By the way, are you aware that there are three types of kerning:
> >    overall kerning - an identical (positive/negative) amount is
> >        added to the distance between each pair of characters.
> >    track kerning - like overall kerning, but the values differ
> >        for different ranges of point sizes within a given font.
> >    pairwise/triplet kerning - a lookup table offers kerning
> >        increments/decrements for specific pairs of characters
> >        and for the pairs in specific triplets. Kerning triplets
> >        are often used when the font has no ligatures (e.g. for
> >        "ffl").
> 
> I'm familiar with at least two other types of kerning:
> Sector Kerning...

Sounds like sector kerning is just a complicated-- and perhaps overly
complicated-- algorithm for pair kerning.  True, it can deal with font
changes, but how often do you change fonts in the middle of a word,
and how important is tight spacing when you do?

> Optical Spacing.  This isn't so much a 'kerning' technique as an overall
> character spacing technique developed by David Kindersley, a typographer,
> together with Neil Wiseman, a computer scientist.

Was this work done in order to earn a graduate degree?  Sounds like it.
Again, this just seems like another complicated algorithm for pair kerning.

Sometimes I think kerning is too important to be left to professionals.
I've seen some typesetting where they really went overboard on the pair
kerning, with Te almost on top of each other, etc.  Just how complicated
does this need to be?  After all, we're only talking about T A V W and
a few other overhanging letters.  Underhangs like the Q squiggly can be
handled easily with side bearings (advance width).

tonyw@microsoft.UUCP (Tony WILLIAMS) (09/21/90)

In article <142132@sun.Eng.Sun.COM> tut@cairo.Sun.COM (Bill "Bill" Tuthill) writes:
>avi@dgp.toronto.edu (Avi Naiman) writes:
  [omitted]

>> Optical Spacing.  This isn't so much a 'kerning' technique as an overall
>> character spacing technique developed by David Kindersley, a typographer,
>> together with Neil Wiseman, a computer scientist.
>
>Was this work done in order to earn a graduate degree?  Sounds like it.
>Again, this just seems like another complicated algorithm for pair kerning.

Well, I waited to see if the original article would appear, but maybe
I just missed it.

I don't know why you make your remark about earning a graduate degree.
That seems to carry connotations of work that has theoretical interest
but no practical value, and I see nothing to imply those.  Some great
work comes out of collaborations between good people of different
disciplines.

In the case in point, optical spacing is based on the optical characteristics
of the letter shapes, and has the advantage that character positioning can
be calculated without referring to tables indexed by pairs of characters.
The spacing is calculated from values stored for each character.

The technique can also automatically produce the appearance of ligatures,
with no special code.  This works since character shapes can be placed
so as to overlap, which is easy with laser beams and ink, but hard with
metal type.

Tony.