# Does XeLaTeX automatically select optical sizes for a given font, if available?

I've been intrigued by a great feature of XeLaTeX (perhaps it was already a feature of (La)TeX) for a long time -- its ability to automatically select the appropriate optical size of a font for a specific part of the text.

At least it seems to me -- when I open a PDF in Adobe Reader, it shows caption, display, regular, even semibold, etc.

So far I haven't come across a clear mention of it, so, does XeLaTeX really automatically select optimal optical sizes, and how?

-

In addition to what ChirsS said relative to \fontspec, this has always been the behavior of (La)TeX for as long as I know, i.e. also before XeLaTeX and fontspec.

You can easily check it yourself. If you compile the following MWE:

\documentclass[12pt]{article}
\begin{document}
\noindent%
{\small      small}\\
{\normalsize normal}\\
{\Large      Large}\\
\end{document}


and inspect the fonts used (with evince on Linux, simply go "Properties" (Alt+Return) > "Fonts" tab), you can see that 3 different Type 1C (sub)fonts are embedded in your pdf:

• CMR10,
• CMR12, and
• CMR17

("CMR" stands for "Computer Modern Roman", the default TeX font; the figure is the optical size).

This works whether you compile the document with pdflatex, xelatex or lualatex.

-
This is not automatic: it's the job of the font definition files to choose optical sizes if available and they must be written out fully. – egreg Apr 28 '13 at 20:52

Yes. As per the manual for the fontspec package (section 8.6, 'Optical font sizes'),

OpenType fonts with optical scaling will exist in several discrete sizes, and these will be selected by XeTeX and LuaTeX automatically determined by the current font size...

-