Adobe Fonts (formerly Typekit), LuaLaTeX, and Optical Sizes

I’ve been having trouble using fonts that make use of Optical Sizes from Adobe Fonts (formerly Typekit) in LuaLaTeX.

As Adobe Fonts uses a clever injection mechanism to inject its font files into font menus (but not into the appropriate system font directories), and, as LuaLaTeX uses its own renderer (in contrast to XeLaTeX’s system font-rendering), it does not recognise Adobe Fonts fonts. This has led me to creating a script that copies all the Adobe Fonts font files into a directory for easy use with fontspec:

\documentclass{article}

\usepackage{blindtext}

\usepackage{fontspec}
\defaultfontfeatures{Path={/Users/you/.local/share/polytextum/fonts/}}
\setmainfont[
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Smbd,
BoldItalicFont=*-SmbdItalic,
]{ArnoPro}

\begin{document}
\blinddocument
\end{document}

This compiles just fine.

2 · Optical Sizes in LuaLaTeX

Here is a MWE of the Optical Size code I thought would work in LuaLaTeX:

\documentclass{article}

\usepackage{blindtext}

\usepackage{fontspec}
\defaultfontfeatures{Path={/Users/you/.local/share/polytextum/fonts/}}
\setmainfont[
UprightFeatures={
SizeFeatures={
{Size={-8.4},     Font=ArnoPro-Caption},
{Size={8.5-10.9}, Font=ArnoPro-SmText},
{Size={11-13.9},  Font=ArnoPro-Regular},
{Size={21.5-},    Font=ArnoPro-Display}
},
},
ItalicFeatures={
SizeFeatures={
{Size={-8.4},     Font=ArnoPro-ItalicCaption},
{Size={8.5-10.9}, Font=ArnoPro-ItalicSmText},
{Size={11-13.9},  Font=ArnoPro-Italic},
{Size={21.5-},    Font=ArnoPro-ItalicDisplay}
},
},
BoldFeatures={
SizeFeatures={
{Size={-8.4},     Font=ArnoPro-SmbdCaption},
{Size={8.5-10.9}, Font=ArnoPro-SmbdSmText},
{Size={11-13.9},  Font=ArnoPro-Smbd},
{Size={21.5-},    Font=ArnoPro-SmbdDisplay}
},
},
BoldItalicFeatures={
SizeFeatures={
{Size={-8.4},     Font=ArnoPro-SmbdItalicCaption},
{Size={8.5-10.9}, Font=ArnoPro-SmbdItalicSmText},
{Size={11-13.9},  Font=ArnoPro-SmbdItalic},
{Size={21.5-},    Font=ArnoPro-SmbdItalicDisplay}
},
}
]{ArnoPro}

\begin{document}
\blinddocument
\end{document}

All this does, however, is give me this error:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "ArnoPro" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.45

?

Then I thought that it was because there is no ArnoPro.otf; there is only ArnoPro-Regular.otf. So I changed the line ]{ArnoPro} to ]{ArnoPro-Regular}, but this did not work either:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "--" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.45

?

This is quite strange, since:

1. There is a file called ArnoPro-Regular.otf in /Users/you/.local/share/polytextum/fonts/
2. Where did -- come from?

I then proceeded to rename ArnoPro-Regular.otf to just ArnoPro.otf (and made all the necessary changes), but the problem persisted. It only went away once I made a copy of ArnoPro.otf and called it --.otf. But why?

I would vastly prefer to not have to do this ‘hack’, and am quite puzzled by the fact that it occurs in the first place.

Is there a way I can use fonts from Adobe Fonts, use LuaLaTeX, and Optical Sizes without having to resort to ‘hacks’?

• You're asking about optical sizes, which will take me a little longer to confirm one way or the other, but as a general place to start, there are three intro concepts to share. (A) xeletex and luatex are picky about font definitions, preferring a "once and only once" defined font. So the "why" may be that there's a competing definition for the font. (B) As addressed here, I've opted to load .otf and .ttf font files directly into the texlive tree. (C) It also helps to use full font filenames.extensions. – Saphar Koshet Oct 20 '18 at 2:53
• @SapharKoshet Would setting Extension=.otf be good for point C? – Aramis Razzaghipour Oct 20 '18 at 4:11
• Are you saying that xelatex can find the fonts in their original location but not lualatex? Where is this location? – Ulrike Fischer Oct 20 '18 at 8:02
• @UlrikeFischer Yes. This location is /Users/you/.local/share/polytextum/fonts/. This is defined by the script I mentioned in my question. – Aramis Razzaghipour Oct 20 '18 at 9:44
• I don't know on which system you are and so don't know which search pathes should work for you. Check the documentation of luaotfload, section 8.2 Search Paths. – Ulrike Fischer Oct 20 '18 at 12:26

Nevermind! With the help of @SapharKoshet ’s help and this answer I have managed to figure out what the problem was: LaTeX doesn’t like duplicate fonts, so it is preferred to define, let’s say, the default italic font first ItalicFont=*-Italic, then, in the SizeFeatures, leave the definition for the regular font blank, like so:

ItalicFeatures={
SizeFeatures={
{Size={-8.4},     Font=ArnoPro-ItalicCaption},
{Size={8.5-10.9}, Font=ArnoPro-ItalicSmText},
% Before
% {Size={11-13.9},  Font=ArnoPro-Italic},
% After
{Size={11-13.9}},
{Size={21.5-},    Font=ArnoPro-ItalicDisplay}
},
},

In the end, here’s what the final MWE looks like (I also added Extension=.otf since this means LaTeX doesn’t have to search for e.g. ArnoPro-Regular.ttf as all the files are .otf):

\documentclass{article}

\usepackage{blindtext}

\usepackage{fontspec}
\defaultfontfeatures{
Path={/Users/you/.local/share/polytextum/fonts/},
Extension={.otf},
}

\setmainfont[
UprightFont=*-Regular,
UprightFeatures={
SizeFeatures={
{Size={-8.4},     Font=*-Caption},
{Size={8.5-10.9}, Font=*-SmText},
{Size={11-13.9}},
{Size={21.5-},    Font=*-Display}
},
},
ItalicFont=*-Italic,
ItalicFeatures={
SizeFeatures={
{Size={-8.4},     Font=*-ItalicCaption},
{Size={8.5-10.9}, Font=*-ItalicSmText},
{Size={11-13.9}},
{Size={21.5-},    Font=*-ItalicDisplay}
},
},
BoldFont=*-Smbd,
BoldFeatures={
SizeFeatures={
{Size={-8.4},     Font=*-SmbdCaption},
{Size={8.5-10.9}, Font=*-SmbdSmText},
{Size={11-13.9}},
{Size={21.5-},    Font=*-SmbdDisplay}
},
},
BoldItalicFont=*-SmbdItalic,
BoldItalicFeatures={
SizeFeatures={
{Size={-8.4},     Font=*-SmbdItalicCaption},
{Size={8.5-10.9}, Font=*-SmbdItalicSmText},
{Size={11-13.9}},