# Accessing the Fancy /es/ Ligature Without Lua-/Xe-Latex

This is in LuaLaTeX with fontspec and \setmainfont{EB Garamond}. The first is rendered for \emph{es} and the second separates the letters with \emph{e\mbox{}s}.

I find the former ligature very attractive in text. Now I often use \usepackage{ebgaramond} to use the same font, but it no longer produces this ligature. Is there a way to access this ligature manually?

• I'm not even sure how ebgaramond works. – Simon Kuang Aug 9 '13 at 18:14
• I get the ligature; my ebgaramond.sty is version 2013/05/22. – egreg Aug 9 '13 at 19:20
• @egreg Wow, this is strange. (Maybe I should make a new question for this.) I get the cute ligature when compiling italics with ebgaramond using LuaLaTeX but not with PDFLaTeX. PDFLaTeX still makes the latter rendering. Are there any tricks to get the ligature without Lua/XeLaTeX? – Simon Kuang Aug 9 '13 at 19:25
• I don't think the ligature is accessible with pdflatex. Sorry, I didn't read the question right and tried with XeLaTeX. – egreg Aug 9 '13 at 19:28
• This ligature is automatically applied at the end of words but so far only accessible with the otf or ttf versions of the font. I have no idea how to prepare the font for pdftex to obey such contextual rules. – georgd Aug 10 '13 at 9:39

It is possible to enable the fancy es ligature for use in regular LaTeX/pdfLaTeX but you would need to construct appropriate supporting files. Basically, you'd need to reinstall the font for use with LaTeX (e.g. using a different name for the font to distinguish it from the existing support provided by the official package).

I don't know the font but I gather from the comments that the fancy ligature should replace "es" only when this letter combination occurs at the end of a word. This can be enabled automatically.

The principle is the same as for an end-of-word swash. venturisadf provides an example of how to do this. End-of-word swashes are themselves set up as ligatures in the files defining the font for TeX. In the case of es, you will need to create an ordinary "es" ligature from an "e" followed by an "s". Then you will need another ligature for the combination ordinary-es-ligature followed by end-of-word.

The easiest way to do this is to use fontinst. You can copy and adapt code from venturisadf and from the fontinst package itself. For example, there is code to create an "fi" ligature if this is missing from the font. You can use this to create your ordinary "es" ligature. Note that doing this right requires preserving the kerning information for "e" and "s" and between "e" and "s". The construction of faked ligatures for "fi", "ff", "ffi" in fontinst shows you how to get this right.

The main issue to decide is the encoding to use. You would need 3 free slots to get this to work right. To make an end-of-word swash, you need to leave one slot undefined. You would then need one slot for your end-of-word swash i.e. the fancy ligature es. The third slot is for the ordinary es ligature which you create from the "e" and "s" as mentioned above.

The LY1 encoding has free slots. Otherwise, you can reassign slots in the T1 encoding. What I've usually done (e.g. in venturisadf) is include a regular T1 encoding and then a swash variant which reassigns slots. That ensures support for the fancy stuff and the languages T1 supports (font allowing). For an example of setting up the end-of-word swashes, see t1-venturis.etx which is the encoding I used for the swash variant. Note that

\setrightboundary{bound}


in t1-venturis.etx corresponds to

/.notdef


in t1-venturis.enc. This is the crucial slot for getting the end-of-word ligaturing to work. The end-of-word swash for "a" is then set up as a ligature in t1-venturis.etx:

\setslot{\lc{A}{a}}
\ligature{LIG}{bound}{\lc{A.end}{a.end}}
\comment{The letter {a}'.}
\endsetslot


and a slot is assigned to the end-of-word swash itself:

\setslot{\lc{A.end}{a.end}}
\endsetslot
`

When this is run through TeX, fontinst generates the encoding and sets up the appropriate .tfm and .vf files to support the ligatures you've defined in the encoding files.

If this is just for your own personal use and you know you'll never use certain characters, you can dispense with the standard T1 encoding and just create one version of the font which uses the slots for those characters for the stuff you need.

You can also look to see whether there are characters the font lacks. Sometimes you can free up slots without losing anything because the font doesn't provide certain characters and fontinst can't construct those characters artificially. I've put a comment at the top of t1-venturisold.etx, for example, which notes that I've reassigned 3 slots for just this reason.

If you've never used fontinst before, I suggest working through as much of the documentation as you can. This is in the form of tutorials and will help you get used to the basic concepts. Once you've done that, look at venturisadf or another similar package and adapt the code there to your purposes.