How should fontspec be set up to exploit the best features of Pro fonts?

Answer to my question occurred to be rather simple. There is no need to invent sophisticated font loading procedure. fontspec package occurred to be smart enough to select correct font shape for every size. To check that one need to run the following simple test:

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{Arno Pro}

\begin{document}%
\newcommand{\MyText}{No offence meant, I even upvoted your answer.}

\verb|\tiny|=\tiny\MyText\par
\verb|\scriptsize|=\scriptsize\MyText\par
\verb|\footnotesize|=\footnotesize\MyText\par
\verb|\normalsize|=\normalsize\MyText\par
\verb|\large|=\large\MyText\par
\verb|\Large|=\Large\MyText\par
\verb|\LARGE|=\LARGE\MyText\par
\verb|\huge|=\huge\MyText\par
\verb|\Huge|=\Huge\MyText\par

\end{document}

Then I exported the compiled PDF to MS World and saw that \tiny \scriptsize and \footnotesize are typed by Arno Pro Caption as it should be, and \normalsize is typed by Arno Pro SmText as expected, e.c.t.

Great!

Unfortunately, LuaLaTeX on my computer [Version beta-0.70.1-2011052811 (rev 4277) (format=lualatex 2011.6.23)] did not manage to compile that short example, but XeLaTeX have that done very quickly.


it also works with lualatex but it takes a lot of time for luatex to create the cache for the font files:

...
(load: /home/voss/.texlive2011/texmf-var/luatex-cache/generic/fonts/otf/temp-ar
nopro-display.lua)(save: /home/voss/.texlive2011/texmf-var/luatex-cache/generic
/fonts/otf/temp-arnopro-display.lua)
Overfull \hbox (15.88963pt too wide) in paragraph at lines 17--17
[][][]\EU2/lmtt/m/n/20.74 \Huge\EU2/ArnoPro(0)/m/n/20.74 =\EU2/ArnoPro(0)/m/n/2
4.88 No of-fence meant, I even up-voted
[1{/usr/local/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./latex6.aux) )
 275 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 3 attribute, 40 glue_spec, 3 attribute_lis
t, 1 write nodes
   avail lists: 2:1551,3:13,4:158,5:179,6:470,7:2,9:34,10:27
</home/voss/.fonts/ArnoPro/ArnoPro-Display.otf></home/voss/.fonts/ArnoPro/ArnoP
ro-Subhead.otf></usr/local/texlive/2011/texmf-dist/fonts/opentype/public/lm/lmm
ono12-regular.otf></home/voss/.fonts/ArnoPro/ArnoPro-Regular.otf></usr/local/te
xlive/2011/texmf-dist/fonts/opentype/public/lm/lmmono8-regular.otf></home/voss/
.fonts/ArnoPro/ArnoPro-Caption.otf></home/voss/.fonts/ArnoPro/ArnoPro-SmText.ot
f></usr/local/texlive/2011/texmf-dist/fonts/opentype/public/lm/lmmono10-regular
.otf>
Output written on latex6.pdf (1 page, 33812 bytes).

Transcript written on latex6.log.

I used current TeXLive2011 pretest:

voss@shania:~/Documents> lualatex -v
This is LuaTeX, Version beta-0.70.1-2011061410 (rev 4277)

enter image description here


I've used the approach of simply inserting \setmainfont{Arno Pro}[Numbers={Lowercase,Proportional}] for years to load Arno Pro, and it almost always works perfectly. But I've been using Overleaf lately, which requires loading fonts from a local project, plus I wanted to use the Light weights for especially large text in a particular document, so I came up with this to specify the exact ranges and names of the optical sizes. Here, the optical sizes are taken from the Adobe specimen book for Arno Pro, but using the Light Display weight for type above 36pt is my judgement:

\setmainfont{ArnoPro}[
  % Path = {./fonts/}, % use to load from a `fonts` folder in your project
  Extension = {.otf},
  UprightFont = {*-Regular},
  ItalicFont = {*-Italic},
  BoldFont = {*-Smbd},
  BoldItalicFont = {*-SmbdItalic},
  Numbers={Lowercase,Proportional},
  UprightFeatures={
    SizeFeatures={
      {Size={-8.5},      Font=*-Caption},
      {Size={8.6-10.99}, Font=*-SmText},
      {Size={11-14},     Font=*-Regular},
      {Size={14.1-21.59},Font=*-Subhead},
      {Size={21.6-35.99},Font=*-Display},
      {Size={36-},       Font=*-LightDisplay}
    },
  },
  ItalicFeatures={
    SizeFeatures={
      {Size={-8.5},      Font=*-ItalicCaption},
      {Size={8.6-10.99}, Font=*-ItalicSmText},
      {Size={11-14},     Font=*-Italic},
      {Size={14.1-21.59},Font=*-ItalicSubhead},
      {Size={21.6-35.99},Font=*-ItalicDisplay},
      {Size={36-},       Font=*-LightItalicDisplay}
    },
  },
  BoldFeatures={
    SizeFeatures={
      {Size={-8.5},      Font=*-SmbdCaption},
      {Size={8.6-10.99}, Font=*-SmbdSmText},
      {Size={11-14},     Font=*-Smbd},
      {Size={14.1-21.59},Font=*-SmbdSubhead},
      {Size={21.6-},     Font=*-SmbdDisplay}
    },
  },
  BoldItalicFeatures={
    SizeFeatures={
      {Size={-8.5},      Font=*-SmbdItalicCaption},
      {Size={8.6-10.99}, Font=*-SmbdItalicSmText},
      {Size={11-14},     Font=*-SmbdItalic},
      {Size={14.1-21.59},Font=*-SmbdItalicSubhead},
      {Size={21.6-},     Font=*-SmbdItalicDisplay}
    },
  }
]