# Xelatex, Minion Pro and Italian apostrophe kerning

I know there are plenty of questions about it but after way too much searching I couldn't find a working fix. Some only work with lualatex, some with \usepackage{MinionPro}, some don't even compile...

Is there a way to fix the ugly apostrophe kerning with Minion Pro and xelatex? It's way too tight and completely wrong for Italian typographic styles. Minion is used extensively, I'm pretty sure I've seen it in several latex-produced-looking Italian documents, so there must be a solution. I'm about to abandon it and go back to the trustworthy Computer Modern where I didn't have to deal with this stuff.

Here's a mwe with an apostrophe rich paragraph, compile it with xelatex.

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{italian}
\usepackage{csquotes}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Minion Pro}

\begin{document}
C'era un'oca con l'ala sinistra fratturata. L'altra ala era anch'essa
malmessa dopo l'estrema fatica del viaggio
d'oltreoceano. Per un po' poteva resistere ma un'operazione era
senz'altro consigliata.
\end{document}


and the same with Computer Modern

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage[babel]{csquotes}

\begin{document}
C'era un'oca con l'ala sinistra fratturata. L'altra ala era anch'essa
malmessa dopo l'estrema fatica del viaggio
d'oltreoceano. Per un po' poteva resistere ma un'operazione era
senz'altro consigliata.
\end{document}


And the results, xelatex + Minion (see e.g. n'o which has no spacing at all)

and, much better, pdflatex + CM

• Jan 24 '18 at 10:06
• @JasperHabicht those look fiddly and hackish and I still didn't understand how to make them (xetexinterchartoks) work for my case. I don't know it seems that such a common issue would have a proper solution by now Jan 24 '18 at 10:17

It is actually not that hacky. Try the following (to be typeset with XeLaTeX):

\documentclass{minimal}

\usepackage{fontspec}

\setmainfont[Ligatures=TeX]{Minion Pro}

\makeatletter
\XeTeXinterchartokenstate=1

\newXeTeXintercharclass\LetterClass
\@tempcnta=\A
\loop\unless\ifnum\@tempcnta>\Z
\XeTeXcharclass \@tempcnta \LetterClass
\repeat
\@tempcnta=\a
\loop\unless\ifnum\@tempcnta>\z
\XeTeXcharclass \@tempcnta \LetterClass
\repeat

\newXeTeXintercharclass\ApostropheClass
\XeTeXcharclass ’ \ApostropheClass
\XeTeXcharclass ' \ApostropheClass
\XeTeXinterchartoks \LetterClass \ApostropheClass = {\kern.1ex }
\XeTeXinterchartoks \ApostropheClass \LetterClass = {\kern.1ex }

\makeatother

\begin{document}

\begingroup\XeTeXinterchartokenstate=0 % Typeset without manual kerning
C'era un'oca con l'ala sinistra fratturata. L'altra ala era anch'essa
malmessa dopo l'estrema fatica del viaggio
d'oltreoceano. Per un po' poteva resistere ma un'operazione era
senz'altro consigliata.
\endgroup

C'era un'oca con l'ala sinistra fratturata. L'altra ala era anch'essa
malmessa dopo l'estrema fatica del viaggio
d'oltreoceano. Per un po' poteva resistere ma un'operazione era
senz'altro consigliata.

\end{document}


Minion Pro is known for its very small apostrophe kerning. LaTeX of course allows for manual kerning, but you want to kern certain glyph pairs every time they show up. Furthermore, you want to kern pairs like [every letter] [apostrophe].

So, we have to tell LaTeX what [every letter] shall be. This is done by assigning every letter from a to z and from A to Z to a certain charclass. An apostrophe is assigned to another charclass. Then, we tell LaTeX to add some kerning between these two classes.

The above code actually puts exactly this. As far as I know, you can only tell fontspec to generally increase or decrease kerning, but not for certain glyphs. If I read the other answers to similar problems on this platform, it seems to me that this is the most straightforward solution. Maybe someone else can provide a simpler one.

• Thank you! way much clearer with your explanation, not sure if it is the best approach but it seems to work (need to carefully check it doesn't mess with other things). I'll keep the question open for a while in case other solutions come up. Jan 24 '18 at 10:45
• OK, found something else on the web: typophile.com/node/35308 . They obviously created a language definition (.ldf) file that contains the kerning information. You have to put it into your working directory and chose this “language”. But it actually seems as hacky as my approach and I didn’t check whether it really works. Jan 24 '18 at 10:49
• Interesting discussion, it looks like a similar approach, I like the xetex based one better though Jan 24 '18 at 11:05
• Just for completeness, I think only the post-apostrophe kerning is needed in italian and a lower value should be enough. \kern.01ex looks good to me, maybe even slightly less Jan 24 '18 at 11:16