# Selecting optical sizes for all fonts in a family

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.

-
I don’t have Minion’s opticals but do have opticals for 3 other Adobe fonts by Robert Slimbach, and none requires specifying the italic, etc. I’d be surprised if a general solution exists: when a font has optical sizes but xe/luatex acts as if it didn’t, you’ve encountered a bug, and if the bug is in the font, well, each buggy font is buggy in its own way. So you’d need to inspect the font and find a work-around (perhaps a feature file) for its peculiarities. –  Thérèse Jul 31 '13 at 2:41
There are a couple of Adobe fonts w/ incorrect optical size information --- details should be on the XeTeX mailing list. –  WillAdams Jul 31 '13 at 2:54
I see you've tried nesting the italic fonts inside the size specification; have you tried nesting the size specification inside the ItalicFeatures option? –  ChrisS Jul 31 '13 at 2:57
Indeed, I fail to see how feature files can be of any help here. That is clearly a 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. –  Khaled Hosny Jul 31 '13 at 16:03
You can use the issue tracker. –  Khaled Hosny Jul 31 '13 at 19:31