# Substitute a character by another one (Lualatex)

The lowercase figures of Adobe Garamond Pro are very nice, but the 1 can be confusing:

Is this 11 (as it should be) or 2 in Roman?

I would like to replace automatically this lowercase 1 with another character, ideally a scaled version of another font (see the first line in the next picture), or otherwise with a dotless i of the same font (second line, less appropriate but ok):

This request is very similar to this question: Replacing a character with a different one of a different point size but unfortunately it was not answered (I know I'll have the same critics as there, but this lowercase 1 is kind of a problem for some readers).

In math mode, it seems possible rather easily: How do I change the font of a letter? but in text mode it seems to require changing the catcode of 1, which is out of question.

I've tried to do it with fontspec and also with opentype feature files, without success. Is it possible to do at all it with lualatex/fontspec?

Thanks!

• Not sure what you mean by “is not the same in other Garamond fonts”: this kind of lowercase one is found in EB Garamond, Linotype’s Stempel Garamond and Garamond 3, Berthold Garamond, Linotype’s Sabon… Also in many non-Garamond fonts with lowercase numerals. If you think your intended audience won’t be able to figure it out, choose a font like what they’re used to reading. Substituting a dotless i would make for a less accessible document (think of searching, etc.). – Thérèse Jul 26 '15 at 13:02
• Yes you are right, that's my mistake. I was sure to have seen a Garamond with a different lowercase 1... I remove this comment in my question. And good point for accessibility problem with the dotless i. – Sylvain Jul 26 '15 at 13:42
• – user4686 Apr 3 '16 at 12:26

Since I do not have the font Adobe Garamond Pro I have used the font EBGaramond12, available in TeX Live. This font provides an alternate form one.01 for glyph one:

\documentclass{article}
\usepackage{fontspec}
\usepackage{filecontents}
\begin{filecontents*}{ebgaramond12.fea}
languagesystem DFLT dflt;
languagesystem latn dflt;

feature calt {
sub one by one.01;
} calt;
\end{filecontents*}

\newfontfamily\orggaramond{EBGaramond12}
\setmainfont[
FeatureFile=ebgaramond12.fea,
Contextuals=Alternate,
]{EBGaramond12}

\begin{document}
{\orggaramond 0123456789 1992 11 Ii Ll}\par
0123456789 1992 11 Ii Ll
\end{document}


• This does not seem to work with Adobe Garamond Pro, but the two fonts are so close, that's great anyway, thanks! (actually even the substitution A -> B in your fea file does not seem to work with Adobe Garamond Pro, which is strange...) – Sylvain Apr 3 '16 at 8:57
• @Sylvain The A -> B was some left-over from testing. Removed now. – Heiko Oberdiek Apr 3 '16 at 11:48
• @Sylvain Maybe the glyph one.01 is only an addition of EBGaramond12. – Heiko Oberdiek Apr 3 '16 at 11:56
• @Sylvain using otfinfo -g '<filename of font>' | grep one in suitable repertory should help you check if one has an alternate form. For the font discussed in tex.stackexchange.com/questions/282996/… it was one.ss01. – user4686 Apr 3 '16 at 12:33
• @jfbu and Heiko, the font has many variants for 1 (maybe not the correct one though), but actually when using the same piece of code as Heiko's with an existing variant, it does not make any substitution at all (that's what I wanted to emphasize when I wrote that even the simple substitution A -> B was not working with Adobe Garamond Pro)... – Sylvain Apr 3 '16 at 16:44