XeTeX and LuaTeX are able to assign optical sizes to fonts when they are provided. In those situations where XeTeX or LuaTex are unable to correctly assign optical sizes I am able to specify them but only for the regular font, not for italics, bold, or bold italics. I'm looking for a way to assign all of them.
The specific example I'm using is for Minion Pro and I know a package exists for it but I'm looking for a general solution I can apply as a regular user whenever something like this comes up again.
Here's the MWE:
\documentclass[openleft,12pt]{memoir}
\usepackage{fontspec}
\setmainfont[ItalicFont={MinionPro-It},BoldFont={MinionPro-Bold},BoldItalicFont={MinionPro-BoldIt}]{Minion Pro}
\begin{document}
Regular\\
\textit{Italic}\\
\textbf{Bold}\\
\textit{\textbf{Bold Italic}}\
{\tiny tiny}\\
{\normalsize normal}\\
{\Large Large}\\
{\LARGE LARGE}\\
{\HUGE HUGE}\\
{\tiny{
\textit{tiny italic} \textbf{tiny bold} \textbf{\textit{tiny bold italic}}}}\\
{\Large{
\textit{Large italic} \textbf{Large bold} \textbf{\textit{Large bold italic}}}}\\
{\HUGE{
\textit{HUGE italic} \textbf{HUGE bold} \textbf{\textit{HUGE bold italic}}}}
\end{document}
Both XeLaTeX and LuaLaTeX need the italic, bold, and bold italic fonts declared. After that XeLaTeX uses all the correct optical sizes for this example. LuaLaTeX does not use any of them (except as before for the regular font).
If you change the \setmainfont
section to look like this:
\setmainfont[ItalicFont={MinionPro-It},BoldFont={MinionPro-Bold},BoldItalicFont={MinionPro-BoldIt},
SizeFeatures={
{Size={-8.4},OpticalSize=8},
{Size={8.4-13},OpticalSize=11},
{Size={13-19.9},OpticalSize=19},
{Size={19.9-},OpticalSize=72}}
]
{Minion Pro}
Then everything still works for XeLaTeX and now the optical sizes (Caption, Regular, SubHeader, Display) work with LuaLaTeX for the regular fonts but not for italics, bold, and bold italics.
I had thought that maybe something like:
\setmainfont[ItalicFont={MinionPro-It},BoldFont={MinionPro-Bold},BoldItalicFont={MinionPro-BoldIt},
SizeFeatures={
{Size={-8.4},OpticalSize=8,ItalicFont={MinionPro-ItCapt},
{Size={8.4-13},OpticalSize=11},
{Size={13-19.9},OpticalSize=19,ItalicFont={MinionPro-ItSubH},
{Size={19.9-},OpticalSize=72,ItalicFont={MinionPro-Disp}}}
]
{Minion Pro}
Would work (obviously filling in the bold and bold italic fonts and the other sizes) but that results in an error. I've tried several variations on that idea and nothing works. I keep reading over the fontspec and luaotfload manuals but can find nothing on how to do this thing specifically (I did find a reference to a "goodies" file for ConTeXt but was unable to figure out how to load it into a LuaLaTeX document).
Update Some more experimentation with Adobe fonts. I just did the same experiment with Garamond Premier Pro (also has optical sizes). And the results are similar. LuaLaTeX will just not load the Caption/Subheading/Display versions of Italic/Bold/Bold Italic though it handles the Regular font without even having to specify the optical sizes (thanks to a fix supplied when I asked a similar question before about Garamond specifically). XeLaTeX will but uses the SemiBoldItalic versions for the different optical sizes instead of just BoldItalic.
luaotfload
bug and you should report it before looking for workarounds. But then I don’t understand why you have to select all font styles manually, something is deeply broken on your side.