7

Using TexLive 2014 (updated today) on Windows 7 the following code compiles using XeLaTeX and LuaLaTeX:

\documentclass{article}
\usepackage{fontspec}

\setmainfont[
Extension = .otf,
Path=otf/,
UprightFont = {*},
ItalicFont = {*-Italic},
BoldFont = {*-Bold},
BoldItalicFont = {*-Bold-Italic},
UprightFeatures = {%
    SizeFeatures={%
        {Size={-8.9},Font={*-Caption}},
        {Size={8.91-14.9},Font={*}},
        {Size={14.91-22.9},Font={*-Subhead}},
        {Size={22.91-},Font={*-Display}},
    },
},
ItalicFeatures = {%
    SizeFeatures={%
        {Size={-8.9},Font={*-Italic-Caption}},
        {Size={8.91-14.9},Font={*-Italic}},
        {Size={14.91-22.9},Font={*-Italic-Subhead}},
        {Size={22.91-},Font={*-Italic-Display}},
        },
    },
    BoldFeatures = {%
        SizeFeatures={%
            {Size={-8.9},Font={*-Bold-Caption}},
            {Size={8.91-14.9},Font={*-Bold}},
            {Size={14.91-22.9},Font={*-Bold-Subhead}},
            {Size={22.91-},Font={*-Bold-Display}},
        },
    },
    BoldItalicFeatures = {%
        SizeFeatures={%
            {Size={-8.9},Font={*-Bold-Italic-Caption}},
            {Size={8.91-14.9},Font={*-Bold-Italic}},
            {Size={14.91-22.9},Font={*-Bold-Italic-Subhead}},
            {Size={22.91-},Font={*-Bold-Italic-Display}},
        },
    },
]{Garamond-Premier-Pro}

\begin{document}

\section{Embedding Optical Sizes Test}

\tiny
\begin {itemize}
 \item {\rmfamily \upshape Hello World!}
 \item {\rmfamily \upshape \bfseries Hello World!}
 \item {\rmfamily \itshape Hello World!}
 \item {\rmfamily \itshape \bfseries Hello World!}
 \item {\rmfamily \scshape Hello World!}
\end {itemize}

\scriptsize
\begin {itemize}
 \item {\rmfamily \upshape Hello World!}
 \item {\rmfamily \upshape \bfseries Hello World!}
 \item {\rmfamily \itshape Hello World!}
 \item {\rmfamily \itshape \bfseries Hello World!}
 \item {\rmfamily \scshape Hello World!}
\end {itemize}

\small
\begin {itemize}
 \item {\rmfamily \upshape Hello World!}
 \item {\rmfamily \upshape \bfseries Hello World!}
 \item {\rmfamily \itshape Hello World!}
 \item {\rmfamily \itshape \bfseries Hello World!}
 \item {\rmfamily \scshape Hello World!}
\end {itemize}

\normalsize
\begin {itemize}
 \item {\rmfamily \upshape Hello World!}
 \item {\rmfamily \upshape \bfseries Hello World!}
 \item {\rmfamily \itshape Hello World!}
 \item {\rmfamily \itshape \bfseries Hello World!}
 \item {\rmfamily \scshape Hello World!}
\end {itemize}

\large
\begin {itemize}
 \item {\rmfamily \upshape Hello World!}
 \item {\rmfamily \upshape \bfseries Hello World!}
 \item {\rmfamily \itshape Hello World!}
 \item {\rmfamily \itshape \bfseries Hello World!}
 \item {\rmfamily \scshape Hello World!}
\end {itemize}

\Large
\begin {itemize}
 \item {\rmfamily \upshape Hello World!}
 \item {\rmfamily \upshape \bfseries Hello World!}
 \item {\rmfamily \itshape Hello World!}
 \item {\rmfamily \itshape \bfseries Hello World!}
 \item {\rmfamily \scshape Hello World!}
\end {itemize}

\LARGE
\begin {itemize}
 \item {\rmfamily \upshape Hello World!}
 \item {\rmfamily \upshape \bfseries Hello World!}
 \item {\rmfamily \itshape Hello World!}
 \item {\rmfamily \itshape \bfseries Hello World!}
 \item {\rmfamily \scshape Hello World!}
\end {itemize}

\Huge
\begin {itemize}
 \item {\rmfamily \upshape Hello World!}
 \item {\rmfamily \upshape \bfseries Hello World!}
 \item {\rmfamily \itshape Hello World!}
 \item {\rmfamily \itshape \bfseries Hello World!}
 \item {\rmfamily \scshape Hello World!}
\end {itemize}

\end{document}

I use latexmk to compile the above code:

latexmk -outdir=tmp -xelatex <source.tex>

and

latexmk -outdir=tmp -lualatex <source.tex>

Both commands finish successfully. I opened the two pdf files using adobe reader and examined their properties: Each pdf file contains the embedded optical sizes (caption, regular, subhead, ...). If I open the pdf files using adobe acrobat and highlight a letter or a word, the tool column (edit/insert text) shows the highlighted letters' fontname, where the difference gets obvious: The pdf compiled with XeLaTeX shows the correct fontname, including optical sizes. The pdf compiled with LuaLaTeX shows "regular" for all letters.

The pdf resulting from XeLaTeX seems fine. Is it possible that LuaLaTeX just embeds the optical sizes (e.g. updates the pdf-internal font list), but uses only the font's regular size?

Update

The following screenshots should clarify the differences. The first one shows the result using XeLaTeX:

pdf produced by xelatex

The following shows the result using LuaLaTex:

pdf produced by lualatex

Having a look on the properties both pdf files seem to contain the same font set (the list of embedded fonts is identical). But if you have a look on the highlighted "o" Acrobat (Standard Ed.) reports for the XeLaTex-PDF the detailed (correct?) font shape and size ("...-BdItDisp"), where Acrobat (Standard Ed.) reports for the LuaLaTeX-PDF only the basic font ("Garamond Premr Pro") - of course the buttons italic and bold are highlighted, but something seems to be wrong with one of the involved components, my setup, or my usage, ...

Note: I cleaned (removed all files) from the luatex-cache (C:\texlive\2014\texmf-var\luatex-cache), before I produced the above screenshots.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – LaRiFaRi Mar 16 '15 at 11:37
  • 3
    Cannot replicate the behaviour on my system (Win 8.1, with latest TeXLive updates and Acrobat 11.0.10). You can use Preflight in Adobe Acrobat to create a font inventory that shows which characters from each font were actually used in the document. Also, you can just closely examine the designs: you can tell the different optical sizes apart by eye. – Jura Pintar Mar 17 '15 at 00:06
  • 2
    Your MWE needs correcting: 1) since you’re not using KOMA-Script or scrextend, the option is 12pt, not fontsize=12pt, 2) you have an extra \end{itemize}, and 3) the files names of the fonts are wrong, unless you or Adobe have renamed them. When you make the corrections, I think your question will be more or less reducible to the one at https://tex.stackexchange.com/q/114223/7883 If you want optical sizes, install the fonts (and use the much simpler invocation of \setmainfont{} that’s possible when fonts are installed). – Thérèse Mar 17 '15 at 00:13
  • @Thérèse: I've corrected the MWE: Removed the fontsize and the doubled \end{itemize} (which was my error, I'm new to stackexchange and not used to the code-formating). And you are right, I renamed the font files, but I don't think that this is a problem, because xelatex builds fine. Have you tried to reproduce the described behavior? –  Mar 17 '15 at 06:35
  • @Jura Pintar: I just learned, that Acrobat Standard has no preflight feature. I printed both files and examined their differences ... result: They are different. –  Mar 17 '15 at 08:53
  • 1
    Renaming the files isn’t a problem except that anyone who wants to try your MWE must rename his own files accordingly or edit the MWE. I’ve verified that opticals are working when the font is properly installed, and that selecting fonts by file name rather than font name breaks the size feature, as described in the question I linked. I can’t test your observations about Acrobat, since Adobe has made the idiotic decision to abandon GNU/Linux. – Thérèse Mar 17 '15 at 15:10
  • Thanks for your feedback. I don't want to install the fonts system wide: My thought was to keep them locally in the project, for independence/portability. The renaming was a result from my first tests/problems to get them running under XeLaTeX - what probably wasn't necessary. –  Mar 17 '15 at 15:20
  • 1
    This is puzzling. I've now tested with renamed font files in a local directory, with fonts selected by file name (actually without any changes to your fixed MWE) and still get the same result: XeLaTeX and LuaLaTeX produce identical output. – Jura Pintar Mar 18 '15 at 11:29
  • @Jura Pintar: Thank you very much for your efforts! Have you also uninstalled the fonts from your system during your test? –  Mar 19 '15 at 12:29
  • 1
    No, but that wasn't necessary, because 1) the path was explicitly specified within \setmainfont, and 2) the log confirms that the fonts were loaded from the desired location. Furthermore, since the installed fonts haven't been renamed, deleting the path specification leads to a "font-not-found" error. – Jura Pintar Mar 20 '15 at 15:06
  • I've installed the font set into the system for testing purposes: The output (highlighting) of Acrobat's tool/edit drop down menu and icons (Italic and/or Bold) differs not as much as before, but it differs - even between two XeLaTeX runs, where the first uses the system wide installed font set and the second the file name based configuration: Using file names the drop down menu e.g. reports "Garamond Premr Pro It-Caption" (italic button highlighted), with system fonts: "Garamond Premr Pro Caption" (italic button highl). Should I update my question to get these differences cleared first? –  Mar 20 '15 at 19:51
  • Note: Using LuaLaTex with system wide installed fonts \setmainfont{Garamond Premier Pro} results in: "Garamond Premr Pro Capt" (Icon for Bold highlighted) running the same through xelatex Acrobat shows: "Garamond Premr Pro SmBd" (of course icon Bold is not highl.) - yes, it's puzzling. (Do I have to clean caches etc. pp.?) –  Mar 20 '15 at 20:01
  • Sorry: I still can't replicate any aspect of your problem, so it's hard to say anything useful at this point. Can you visually verify that the wrong glyphs are being used in your output? Are you sure the problem is on the TeX end, and not on the Acrobat end? – Jura Pintar Mar 20 '15 at 23:45
  • I updated the question with two screenshots trying to clarify it. BTW: I don't think the bug is located in Acrobat - it seems to me, that both PDFs' internal data structure (at least regarding the embedded fonts) differ. –  Mar 22 '15 at 20:17
  • After I've installed everything (the machine) from scratch - I cannot reproduce the above output anymore. Thanks for your comments that finally led me to this radical step! –  Apr 12 '15 at 10:10
  • 4
    I'm voting to close this question as off-topic because it was solved by a complete reinstall of the computer, after which is was not reproducible. – Torbjørn T. Sep 13 '15 at 22:33

0 Answers0