6

I'm using Cabin font with XeLaTeX. The apostrophe is not render properly.

As you can see on the following screenshot, there is not enough space betweend L and a.

enter image description here

On this screenshot (with the default LaTeX font), there is no problem:

enter image description here

Is it possible to fix this?

MWE (use XeLaTeX):

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{Cabin}
\begin{document}
L'apostrophe
\end{document}
ppr
  • 8,994
  • 3
    If I check L’apost L'apost on fontsquirrel.com, I'll get the same output for and a little more space for '. This seems to be a problem related to the font itself. – Qrrbrbirlbel Jun 14 '15 at 17:45
  • Related: https://tex.stackexchange.com/q/218415/7883 and https://tex.stackexchange.com/q/61759/7883. Not a few fonts look OK for English text but bad with French. – Thérèse Jun 14 '15 at 23:59

1 Answers1

7

enter image description here

It seems that it is very tightly spaced to following lowercase letters (1). You can prevent the kerning with \mbox (2). I assume a word space is too much (3) or you could use the xetex inter-character token class to add an extra kern, here I set up a class for ' and a class for lower case ascii letters and inject a small kern if ' is followed immediately by a letter.

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{Cabin}

\begin{document}
L'apostrophe

L\mbox{'}apostrophe

L' apostrophe

\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\aposclass
\newXeTeXintercharclass\letterclass
\XeTeXcharclass`\'=\aposclass
\count0=`a
\loop
\XeTeXcharclass\count0=\letterclass
\advance\count0 1
\ifnum\count0<`z
\repeat
\count0=1

\XeTeXinterchartoks\aposclass\letterclass{\kern.1em}

L'apostrophe

\end{document}
David Carlisle
  • 757,742
  • Thanks. The solution 3 is interesting. However, there are still little differences between a apostrophe with the normal font and with cabin and your code. For example the ' is too close to the L. So a font who renders properly French should be prefered. – ppr Jun 15 '15 at 07:48
  • 1
    @ppr I think it's essentially a bug in the font and the fix was only intended to be font-specific just to be enabled where cabin is being used. – David Carlisle Jun 15 '15 at 08:14