# How do I enable a font feature?

I am trying to enable the Historical Ligatures feature in EB Garamond. The guide to the font calls this feature hlig. However, I have no idea how to enable the feature.

I found a question that seems to be related: querying whether a font feature has been activated via a fontspec command. It mentions an \addfontfeatures command, but when I try \addfontfeatures{hlig}, I get an error: "The key 'fontspec/hlig' is unknown and is being ignored."

I haven't been able to find any concrete source about how I enable features. I feel like I'm missing something rather important.

Code:

\documentclass{article}
\usepackage{fontspec}
\usepackage{ebgaramond}

\begin{document}

These words should have ligatures: standard, acta, select.

\end{document}

• fontspec doesn't use the feature codes directly, it has its own names for them. For hlig, you should use \addfontfeatures{Ligatures=Historic}. The complete list is found in the package documentation. If, for some reason, you need to use the feature codes directly, you can set them using the RawFeature key, like this: \addfontfeatures{RawFeature=+hlig}. – Paul Gessler Mar 11 '16 at 1:23
• @Paul Gessler: However, this doesn't produce the  st ligature, which otfinfo mentions. – Bernard Mar 11 '16 at 1:37
• @PaulGessler: I tried \addfontfeatures{Ligatures=Historic} and \addfontfeatures{RawFeature=+hlig}; neither worked, but at least they didn't throw an error. – Soma Mar 11 '16 at 1:39
• @Soma we really need a minimal working example (MWE) in order to help. That command might not be the way to go, depending on how you are loading the font and if you want to use the ligatures in the entire document or only locally. I only posted those examples because you asked about the \addfontfeatures macro. – Paul Gessler Mar 11 '16 at 1:41
• @PaulGessler I added my source. – Soma Mar 11 '16 at 1:45

The ebgaramond package does not currently have an option to enable the historic ligatures feature. This would be the preferred way to select the ligatures.

Using \addfontfeatures in the preamble does not work, because it applies only to the font of the current group. So instead I place the \addfontfeatures command inside \AtBeginDocument, so it takes effect as soon as the document begins:

\documentclass{article}
\usepackage{ebgaramond}