# [pdftex] auto letter spacing

Thanh Han The hanthethanh at gmail.com
Tue Dec 12 10:30:57 CET 2006

```On Mon, Dec 11, 2006 at 11:31:54PM +0100, Hans Hagen wrote:
> Thanh Han The wrote:
> >Hi all,
> >
> >I am working on a primitive \letterspacefont that generates
> >a letter-spaced font from another font like this:
> >
> >,--------
> >| \font\f=cmr10
> >| \letterspacefont\fx=\f 100 % letterspace \f by a factor 100/1000
> >| \fx This is a text in letter-spaced cmr10
> >`--------
> >
> >the above example creates \fx as a virtual font, in which
> >each charater is taken from \f, and have a kern of
> >50*quad(f)/1000 at each side. All this happens in pdftex
> >memory.
> >
> >However I am not sure the "more right" way to do this is that
> >each character c should have a kern of 5*width_of_c/1000 at
> >each side, ie the kern inserted around each character is
> >proportional to its width, instead of having a fixed global
> >value for all characters. This is more closed to the way font
> >expansion is done, but is different from what fontinst does
> >for letter-spacing.
> >
> >How do you see it?
> >
> Is there a way to prevent the kern before or after a char? Say that we have
> a section title, in that case one does not want the margin to be spoiled
> (the first char needs to align then)

I don't know of an easy way. But it's possible to have
another primitive that returns the kern at the left resp.
right side of a char from such a font.

Thanh
```