[NTG-pdftex] [pdftex] auto letter spacing

Hans Hagen pragma at wxs.nl
Tue Dec 12 11:17:37 CET 2006

```Thanh Han The wrote:
> 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.
>
>
best would be to have something

\noletterspacekern          (will inhibit the next kern)
\removeletterspacekern  (removes the last kern, a kind of unkern)

so that one can say:

{\fx \noletterspacekern Some Text\removeletterspacekern}

(\[left|right]letterspacekern<charnr> would be handy anyway)

--

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