5

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}

enter image description here

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?

  • See tex.stackexchange.com/q/61759/7883 – 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
6

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}

output of sample code

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
3

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
\XeTeXcharclass`a\AfterApostropheClass
\XeTeXcharclass`A\AfterApostropheClass
\XeTeXcharclass`à\AfterApostropheClass
\XeTeXcharclass`â\AfterApostropheClass
\XeTeXcharclass`e\AfterApostropheClass
\XeTeXcharclass`E\AfterApostropheClass
\XeTeXcharclass`é\AfterApostropheClass
\XeTeXcharclass`è\AfterApostropheClass
\XeTeXcharclass`ê\AfterApostropheClass
\XeTeXcharclass`i\AfterApostropheClass
\XeTeXcharclass`o\AfterApostropheClass
\XeTeXcharclass`ò\AfterApostropheClass
\XeTeXcharclass`U\AfterApostropheClass
\XeTeXcharclass`u\AfterApostropheClass
\XeTeXcharclass`ù\AfterApostropheClass
\XeTeXcharclass`y\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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.