# French spacing with xelatex and Minion Pro

I've just installed the full version of MacTex 2014 on my MacBookpro running OSX 10.8.5, and I'm surprised by the output of this minimal document compiled with xelatex,

\documentclass[]{article}
\usepackage[frenchb]{babel}
\usepackage{fontspec}
\usepackage{xltxtra,xunicode}
\setmainfont{Minion Pro}
\setromanfont[Mapping=tex-text]{Minion Pro}
\setsansfont{Myriad Pro}
\setmonofont{Source Code Pro}
\frenchspacing
\begin{document}
l'étranger, l'équipe
\end{document}


It seems to me that the spacing is wrong (the "l" and the following word are too close), or is it how it's supposed to look like with Minion Pro? Is there an option I've overlooked?

• – Thérèse Dec 17 '14 at 13:45
• If luatex is an option for you, see tex.stackexchange.com/q/3602/7883 on changing the kerning by writing a feature file. – Thérèse Dec 17 '14 at 13:50
• alright, thanks for the pointers. A few different fonts I tried showed kerning problems with xelatex, I settled for Optima which looks OK. I did not try the luatex feature file, it sounds far too involved for a casual user like myself. – baptiste Dec 17 '14 at 15:11
• Can't fontspec modify kerning by itself? – Bernard Dec 17 '14 at 16:19
• @Bernard May be not font spec, but microtype? – Manuel Dec 17 '14 at 16:39

## 2 Answers

This problem affects most Adobe fonts (Adobe, are you listening?). I don’t use xetex enough to know what can be done about it in xetex, but in luatex you can write a feature file to adjust the kerning without editing the font itself. It’s much easier than it sounds. E.g.,

\documentclass[12pt]{article}
\usepackage[french]{babel}
\usepackage{filecontents,fontspec,microtype}
\begin{filecontents*}{minion.fea}
languagesystem DFLT dflt;
languagesystem latn dflt;

feature kern {
pos \quoteright \a 10;
pos \quoteright \eacute 10;
pos \quoteright \o 10;
} kern;
\end{filecontents*}
\setmainfont{Minion Pro}[
FeatureFile={minion.fea}]
\frenchspacing
\begin{document}
l’étranger

d’accord

d’ores et déjà
\end{document}


You just have to keep adding lines like pos \quoteright \e 10; until you’ve listed anything that may come after the apostrophe. You can play with the value until you have it as tight or loose as you like: 1, 10, 20…

If you’re writing a bilingual document and the other language requires tighter kerning (off hand, I don’t know of one), you can specify to which language the features you define should apply. That’s more work, but the technique is explained at tex.stackexchange.com/a/142664/7883.

UPDATE: Since version 2.7 of luaotfload, feature files are no longer supported. See tex.stackexchange.com/a/312160/7883 for a new way to solve this problem.

• Thanks for the effort and worked example. I don't feel comfortable playing with kerning (I'm not a designer), so I'll stay away from those fonts (or french, when I can help it). – baptiste Dec 17 '14 at 16:34

I am currently disabling kerning between an apostrophe and a succeeding letter by using XeTeX's interchartoken mechanism:

\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\ApostropheClass
\XeTeXcharclass'\ApostropheClass
\newXeTeXintercharclass\AfterApostropheClass
\XeTeXcharclassa\AfterApostropheClass
\XeTeXcharclassA\AfterApostropheClass
\XeTeXcharclassà\AfterApostropheClass
\XeTeXcharclassâ\AfterApostropheClass
\XeTeXcharclasse\AfterApostropheClass
\XeTeXcharclassE\AfterApostropheClass
\XeTeXcharclassé\AfterApostropheClass
\XeTeXcharclassè\AfterApostropheClass
\XeTeXcharclassê\AfterApostropheClass
\XeTeXcharclassi\AfterApostropheClass
\XeTeXcharclasso\AfterApostropheClass
\XeTeXcharclassò\AfterApostropheClass
\XeTeXcharclassU\AfterApostropheClass
\XeTeXcharclassu\AfterApostropheClass
\XeTeXcharclassù\AfterApostropheClass
\XeTeXcharclassy\AfterApostropheClass
\XeTeXinterchartoks\ApostropheClass\AfterApostropheClass={\penalty\@M\hskip\z@}
`

I'm inserting glue rather than a kern, in order to avoid disabling hyphenation. The penalty is there to inhibit a line break at the glue position.