Making a transition from XeLatex to LuaLatex and I'm struggling with some odd font and loading issues.
My starting point for this question is this answer by https://tex.stackexchange.com/a/234785/15886 by @ulrike-fischer - 5 years ago. 5 years later and using a current version of TexLive and LuaHBTeX, Version 1.12.0 (TeX Live 2020/W32TeX) (format=lualatex 2020.7.28) on Windows 10
I am getting quite slow compilation speeds versus XeLatex
Like Ulrike I find that supposedly switching off the "feature" of fontspec to search for .fontspec files massively speeds compilation by a factor of 3 (for example from 23 seconds to 8 seconds on my current document)
I start with Ulrike's MWE (below) extended to add some font testing routines.
Lines 4--7 of the MWE according to Ulricke do nothing more than prevent an unnecessary search for .fontspec files. This should make no difference to the output of the MWE anyway, because the fonts in the libertine package used here do not seem to have .fontspec files anyway.
Toggling lines 4-7 on/off does indeed massively speed compilation (not demonstrable with this short MWE so clearly not just to do with initial font loading). However the fonts are actually changed, for reasons I don't understand.
The last few lines of the MWE output are for example - without Ulrike's magic lines
and with Ulrike's lines (which supposedly just switch off .fontspec search
So my questions are:
a) Why does preventing the system-killing search for .fontspec change the rendering, particularly when libertine does not use this anyway b) 5 years after the earlier question, what should we be doing in LuaLatex in terms of font loading. If I want to use libertine and Biolinium for example should I be loading them from a package (supposedly LuaLatex "compliant") or directly, with fontspec at all (?), and how should I be dealing with this slowing - which is clearly something to do with fonts, perhaps only on Windows?
MWE Follows:
\documentclass{article}
\usepackage{fontspec}
\usepackage{booktabs}
% \ExplSyntaxOn
% \cs_set:Nn \__fontspec_load_external_fontoptions:Nn
% {}
% \ExplSyntaxOff
\usepackage{libertine}
\begin{document}
\newcommand{\FontCmd}[3]{\PBS\verb!\#1{!\textit{text}\verb!}! \> %
\verb!{\#2 !\textit{text}\verb!}! \> %
\#1{#3}}
\begin{tabular}{lll}
\textit{Command} & \textit{Declaration} & \textit{Effect} \\
\verb!\textrm{!\textit{text}\verb!}! & %
\verb!{\rmfamily !\textit{text}\verb!}! & %
\textrm{Roman family} \\
\verb!\textsf{!\textit{text}\verb!}! & %
\verb!{\sffamily !\textit{text}\verb!}! & %
\textsf{Sans serif family} \\
\verb!\texttt{!\textit{text}\verb!}! & %
\verb!{\ttfamily !\textit{text}\verb!}! & %
\texttt{Typewriter family} \\
\verb!\textmd{!\textit{text}\verb!}! & %
\verb!{\mdseries !\textit{text}\verb!}! & %
\textmd{Medium series} \\
\verb!\textbf{!\textit{text}\verb!}! & %
\verb!{\bfseries !\textit{text}\verb!}! & %
\textbf{Bold series} \\
\verb!\textup{!\textit{text}\verb!}! & %
\verb!{\upshape !\textit{text}\verb!}! & %
\textup{Upright shape} \\
\verb!\textit{!\textit{text}\verb!}! & %
\verb!{\itshape !\textit{text}\verb!}! & %
\textit{Italic shape} \\
\verb!\textsl{!\textit{text}\verb!}! & %
\verb!{\slshape !\textit{text}\verb!}! & %
\textsl{Slanted shape} \\
\verb!\textsc{!\textit{text}\verb!}! & %
\verb!{\scshape !\textit{text}\verb!}! & %
\textsc{Small Caps shape} \\
\verb!\emph{!\textit{text}\verb!}! & %
\verb!{\em !\textit{text}\verb!}! & %
\emph{Emphasized} \\
\verb!\textnormal{!\textit{text}\verb!}! & %
\verb!{\normalfont !\textit{text}\verb!}! & %
\textnormal{Document font} \\
\verb!\underline{!\textit{text}\verb!}! & %
& %
\underline{Underline}
\end{tabular}
\begin{tabbing}
\verb!\footnotesizezzz! \= \kill%sets the tab
\verb!\tiny! \> \tiny{tiny} \\
\verb!\scriptsize! \> \scriptsize{scriptsize} \\
\verb!\footnotesize! \> \footnotesize{footnotesize} \\
\verb!\small! \> \small{small} \\
\verb!\normalsize! \> \normalsize{normalsize} \\
\verb!\large! \> \large{large} \\
\verb!\Large! \> \Large{Large} \\
\verb!\LARGE! \> \LARGE{LARGE} \\
\verb!\huge! \> \huge{huge} \\
\verb!\Huge! \> \Huge{Huge}
\end{tabbing}
\begin{tabular}{@{}ll@{}}
\textit{Environment} & \textit{Declaration} \\
\verb!\begin{center}! & \verb!\centering! \\
\verb!\begin{flushleft}! & \verb!\raggedright! \\
\verb!\begin{flushright}! & \verb!\raggedleft! \\
\end{tabular}
\begin{tabular}{@{}llll@{}}
\textit{Name} & \textit{Source} & \textit{Example} & \textit{Usage} \\
hyphen & \verb!-! & X-ray & In words. \\
en-dash & \verb!--! & 1--5 & Between numbers. \\
em-dash & \verb!---! & Yes---or no? & Punctuation.
\end{tabular}
\textasciitilde
\textasciicircum
\textbackslash
\begin{tabular}{ll}\toprule
\textbf{x} & \textbf{y} \\\midrule
\verb|`|&`\\
\verb|'|&'\\
\verb|``|&``\\
\verb|''|&''\\
\verb|"|&"\\
\verb|,,|&,,\\
\verb|<<|&<<\\
\verb|>>|&>>\\
\verb|--|&--\\
\verb|---|&---\\
\bottomrule
\end{tabular}
\verb|{\Huge\libertineGlyph{uni211A}}| \hfill {\Huge\libertineGlyph{uni211A}} \par\medskip
\verb|{\Huge\libertineGlyph{uni211A}}| \hfill {\Huge\libertineGlyph{uni211A}} \par\medskip
\verb|{\Huge\textbf{\libertineGlyph{uni211A}}}| \hfill{\Huge\textbf{\libertineGlyph{uni211A}}} \par\medskip
\verb|{\Huge\textit{\libertineGlyph{uni211A}}}| \hfill {\Huge\textit{\libertineGlyph{uni211A}}} \par\medskip
\begin{tabbing}
\verb!\footnotesizezzz! \= \kill
\verb!\tiny! \> {\tiny tiny} \\
\verb!\scriptsize! \> {\scriptsize scriptsize} \\
\verb!\footnotesize! \> {\footnotesize footnotesize} \\
\verb!\small! \> {\small small} \\
\verb!\normalsize! \> {\normalsize normalsize} \\
\verb!\large! \> {\large large} \\
\verb!\Large! \> {\Large Large} \\
\verb!\LARGE! \> {\LARGE LARGE } \\
\verb!\huge! \> {\huge huge} \\
\verb!\Huge! \> {\Huge Huge}\\
\end{tabbing}
\par{\Huge\textit{textit text test}}
\bigskip
\par{\sffamily\bfseries\Huge Test Text}
\end{document}
libertine
callsfontspec
in the background. The[nofontspec]
option reverts to Type1, by the looks of it. Is that a factor for the question? There's a pdfmap file involved. In any case, I get Libertine R italic for the serif, and Biolinum R bold for the sans on my system (Miktek, Windows). I'll try the switch. (FYI: 3 seconds xelatex, 8 seconds lualatex)fontspec_load_external_fontoptions
howfontspec
automatically finds bold, italic etc font filenames (expected answer: yes); and (2) doeslibertine
loadfontspec
iffontspec
is already loaded (expected answer: no). Don't have time to research this tonight. Apologies.