# [XeTeX] inconsistant kerning

Jonathan Kew jonathan_kew at sil.org
Thu Sep 21 19:54:57 CEST 2006

On 21 Sep 2006, at 5:41 pm, Florian Grammel wrote:

> Dear list,
>
> a house-font of ours sometimes seemed to forget *some* kerning
> information when typesetting with XeLaTeX. I suspected this to be a
> problem with the font and tried to fiddle around with it, but without
> any results. Then I found out, that some of the other -- professional
> -- fonts sometimes display the same odd behaviour, too.
>
> Some testing came down to the result, that this only happens
> - with punctuation after capital letters (but I haven't tested for
> that thoroughly)
> - in the middle of a paragraph
> - when the font in question is Open Type, True Type based
>
> In the example below the sequence "V." would have proper kerning in
> the beginning of the paragraph, but not in the middle of it. Note
> that all other kerning-pairs seem to be ok (I haven't measured that
> out though).

Your eyes are too sharp! ;)

> I would be very much interested to hear whether any of you can
> reproduce this behaviour

yes...

> and, of course, whether anyone might have an
> idea, what is going wrong

...yes...

> and what I could do about it.

...and yes: nothing, for now. (Unless you want to fix a XeTeX bug.)
My apologies for the poor output you currently get. It's not your
font or your document that is at fault.

Ok, a little more info. This is being caused by a bug in how XeTeX
deals with hyphenation positions when using "platform-native" fonts
(rather than TFM files). I've seen it before in a different context
(related to diacritics in a non-Latin script that didn't have
appropriate \lccode values, leading to breaks in the expected cursive
connection), but that was a pretty obscure case, and easily fixed by
proper \lccode settings.

This manifestation of the problem, though, is harder to deal with. If
you suppress any attempt at hyphenation (e.g., by setting
\tolerance=10000 or \hyphenchar\font=-1 or something like that), or
put the word + punctuation in an \hbox when this occurs, the kerning
should be fine; but of course this is not an acceptable solution in
general.

(Incidentally, the reason you don't see the problem at the start of
the paragraph is that TeX doesn't attempt to hyphenate the first
word. If you add \hskip0pt before the first word, then it becomes
eligible for hyphenation, and the kern will be lost there too.)

So this really needs to be fixed within XeTeX. I'll try to do this
soon, as it has a visible impact on the output you get (and no good
workaround is available). I know exactly why it is happening, so I
just need to correct that piece of code--while trying to make sure I
don't break the rest!

JK