# [XeTeX] The al-Wāḥid (al-W\=a\d hid) macron kerning problem

Jonathan Kew jonathan_kew at sil.org
Sat Feb 24 17:08:43 CET 2007

On 23 Feb 2007, at 4:26 pm, ITS Mail wrote:

> Hello
>
> I think I have a kerning problem with a Monotype Opentype font, Bembo
> Book MT Pro (let me know if you need to test it). In general I happily
> notice several kerning corrections in comparison with the previous
> Monotype Bembo, but when I want this:
> \textit{al-Wāḥid}
>
> the macron of the ā clashes into the W. I also get exactly the same
> clash in TextEdit.

I suspect they have exactly the same kern pair for "Wā" as for "Wa",
and have not carefully reviewed kerning with all the accented
letters. That's a reasonable starting point, I suppose, but not
always appropriate (as seen in this case).

> I have tried fontspec's kerning options with no success,

I would expect [Kerning=Off] to solve this, by disabling the kerning
altogether, but you probably don't want that as it will make lots of
other things look worse.

> and I have
> done this for the time being:
> \textit{al-W{\kern -.4pt}āḥid}
> but I wonder if a kind TeXnician can give real solution that is not so
> localised. I seem to remember the NFSS has something like declarations
> of pairs of characters whose kerning needs modification, or is this
> wishful remembering?

I don't know about NFSS; I'd be a bit surprised if it had such an
option, but maybe the LaTeX people know....

> I have many such Wā combinations in my document,
> so I would rather have something in the preamble to correct these
> pairs
> automatically.

Provided you don't need the uppercase W in control sequences,
filenames, etc., you should be able to define it as a macro that
checks the next character, and inserts a different kern (or just a
0pt kern, to prevent the automatic OpenType kern being used) when the
next letter is ā:

\catcode\W=\active \defW{\futurelet\next\W}
\def\W{\char\W\ifx\next ā\kern-.4pt\fi}

Note that this could have undesirable interactions with other uses of
W, if it occurs in other contexts than simple running text. There may
be more sophisticated LaTeX-y ways to implement such a thing, but
this is a basic "plain TeX" approach.

> Incidentally, is it worth letting the people at Monotype know about
> this kind of problem?

Yes. It's practically impossible for a font developer to test and
optimize every possible sequence of characters, so they'll surely
concentrate on the pairs/sequences that they expect to show up in
real usage. If they don't hear about a problem like this, they'd be
justified in assuming it doesn't crop up enough to matter. So report it!

JK