# [pdftex] auto letter spacing

Hans Hagen pragma at wxs.nl
Mon Dec 11 23:31:54 CET 2006

```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)

Hans

-----------------------------------------------------------------