# Controlling fontspec to use certain font features for different fonts in one document

I'm using the font Fontin to prepare a document and have come across a problem when using the discretionary ligatures. The regular font supports the discretionary ligatures, but the bold and italic variants do not. When I turn the feature on, there will be blank spaces where a bold or italic discretionary ligature should be.

How can I achieve that when using the regular font, discretionary ligatures are used, and when using one of the fonts that do not support them, they aren't used?

I used the following command to turn on the features.

\fontspec[RawFeature={+liga, +dlig, +frac}]{Fontin}

-

I don't have Fontin, but the following seems to work

\fontspec[RawFeature={+liga,+dlig},
ItalicFeatures={RawFeature={-liga,-dlig}},
BoldFeatures={RawFeature={-liga,-dlig}}]{Linux Libertine O}

-
Thanks, that got me started. Any thoughts on the next bit? –  Darling Sep 1 '11 at 17:59
I'm afraid that SmallCapsFeatures is buggy. –  egreg Sep 1 '11 at 18:00
@egreg — I'm quite a bit behind on bug fixing; can you give any examples of bugs in SmallCapsFeatures? Sorry for the trouble. –  Will Robertson Sep 1 '11 at 19:10
@Will: Should \setmainfont[Ligatures=TeX,SmallCapsFont={TeX Gyre Termes}, SmallCapsFeatures={Letters=SmallCaps}]{XITS} work? It doesn't. –  egreg Sep 1 '11 at 22:38

I've now half answered my question by adapting egreg's suggestion. This now prevents the discretionary ligatures for bold and italic fonts. The next part of the problem is for the small caps. The fontin family is a little strange because you have to load the small caps as shown below. This means the SmallCapsFeatures command doesn't work and gaps appear where the discretionary ligatures should be. Any ideas how to control it?

    \fontspec[SmallCapsFont = Fontin SmallCaps,
UprightFeatures={RawFeature={+liga,+dlig}},
ItalicFeatures={RawFeature={-liga,-dlig}},
BoldFeatures={RawFeature={-liga,-dlig}},
SmallCapsFeatures={RawFeature={-liga,-dlig}}]{Fontin}

-

I believe there may be some bugs either in the Fontin font or in the fontspec package's method for loading this font. The following MWE shows that one can't get the "regular" ligated glyphs of Fontin Regular -- fi, fl, and ffi -- to show up properly. Interestingly, there is now such problem with either the "Ligatures=Tex" option or with any of these commands for the Fontin Sans Regular font. (In case this matters: I run TeXLive 2011 on an iMac operating under MacOSX 10.6.8.)

\documentclass{article}
\usepackage{fontspec}

%% ligatures in Fontin Regular: fi, fl, ffi
\newcommand{\ligstringa}{fish fly difficult}
%% additional ligated glyphs in Fontin Sans Regular: ff, ffl, fj
\newcommand{\ligstringb}{baffle shelfful fjord}
%% two common TeX Ligatures: -- (en-dash), --- (em-dash)
\newcommand{\ligstringt}{-- ---}

\begin{document}
\setmainfont [Ligatures = {Common,TeX}] {Fontin Regular}
\ligstringa \ligstringt

\setmainfont [Ligatures = {NoCommon}] {Fontin Regular}
\ligstringa \ligstringt

\setmainfont [Ligatures = {Common,TeX}] {Fontin Sans Regular}
\ligstringa \ligstringt ligstringb

\setmainfont [Ligatures = {NoCommon}] {Fontin Sans Regular}
\ligstringa \ligstringt \ligstringb

\end{document}


Similarly, I can't seem to get ligatures going in the Fontin Italic, Bold, and SmallCaps fonts either.

One more thing: when I open Fontin Regular in Apple's Pages program, I experience no problems getting the glyphs to turn on (and off). This makes me suspect that the problem may lie with xelatex than with the font itself.

-
I think the problem is in the font, because I saw things like “o ice” instead of “office” when I tried using it as the font for my web page. No TeX or fontspec was involved: I wrote the HTML by hand. –  Thérèse Jul 29 '13 at 3:30