I am running XeLaTeX (distributed as part of MikTeX) on Windows 7 Service Pack 1 64-bit. The following test file takes a long time to compile:
\documentclass{article}
\usepackage{fontspec}
\message{Hello}
\setmainfont{AlegreyaSC-Regular}
\message{How are you?}
\begin{document}
Test
\end{document}
Every time I compile it, it takes 45-50 seconds between the "Hello" and "How are you?" messages being printed to the screen. (Alegreya is an opentype font I want to use in a document. I downloaded it from a web site. Alegreya-SC Regular means the small caps non-bold non-italic version of the font.)
I thought that perhaps XeLaTeX or fontspec might be trying to write a font cache somewhere but getting prevented from doing so because it was not running with administrator permissions; so I tried running XeLaTeX as administrator and manually entering the commands in the file. However, compilation remained slow after doing this.
This question appears similar on the face of it, but mentions that the author found that using the -no-pdf argument to xelatex caused it to run more quickly; this made no difference for me when I tried it.
XeLaTeX's greeting:
This is XeTeX, Version 3.14159265-2.6-0.99991 (MiKTeX 2.9 64-bit)
Edit: A part of the log file
(C:\LaTeX\tex\latex\fontspec\fontspec.cfg))) Hello
\g__file_internal_ior=\read1
.................................................
. fontspec info: "no-scripts"
.
. Font AlegreyaSC-Regular does not contain any OpenType `Script' information.
.................................................
\g__fontspec_family_AlegreyaSC-Regular_int=\count120
.................................................
. fontspec info: "defining-font"
.
. Font family 'AlegreyaSC-Regular(0)' created for font 'AlegreyaSC-Regular'
. with options [Ligatures=TeX].
.
. This font family consists of the following shapes:
.
. * 'normal' with NFSS spec.:
. <->"AlegreyaSC-Regular/OT:mapping=tex-text;"
.
. * 'small caps' with NFSS spec.:
.
. and font adjustment code:
.
.
. * 'bold' with NFSS spec.:
. <->"AlegreyaSC-Regular/B/OT:mapping=tex-text;"
.
. * 'bold small caps' with NFSS spec.:
.
. and font adjustment code:
.
.
. * 'italic' with NFSS spec.:
. <->"AlegreyaSC-Regular/I/OT:mapping=tex-text;"
.
. * 'small caps' with NFSS spec.:
.
. and font adjustment code:
.
.
. * 'bold italic' with NFSS spec.:
. <->"AlegreyaSC-Regular/BI/OT:mapping=tex-text;"
.
. * 'bold small caps' with NFSS spec.:
.
. and font adjustment code:
.
.................................................
How are you? (test.aux)
\usepackage{Alegreya}? Note that the font is included in TeX Live and, I assume, in MikTeX. – cfr Jun 23 '15 at 21:06\usepackage{alegreya}, and ran xelatex on the file. It runs much much faster. – Hammerite Jun 23 '15 at 22:20fontspec? I suspect the problem is that it is spending time trying to figure out which fonts correspond to the other shapes it needs to set things up 'normally'. Because you've fibbed and said that the small-caps i actually the main upright font when it isn't, it takes a long time as there is no solution. Whereas the package sets things up 'normally' and it has all the information it needs. But I'm not sure about this. I don't know much aboutfontspec. – cfr Jun 23 '15 at 22:22Alegreyawith XeLaTeX then, by default, it is usingfontspecto configure the font. So the question is what is different? – cfr Jun 23 '15 at 23:02\scshapeand it does it for the type1 fonts, too - not just the opentype. Odd. – cfr Jun 23 '15 at 23:06\setmainfont{Alegreya}[SmallCapsFont={* SC},ItalicFeatures={SmallCapsFont={Alegreya SC Italic}}]. It compiles quickly on my Debian laptop. But I’ve found Alegreya to be odd and difficult to work with in other respects (e.g., https://tex.stackexchange.com/q/162362/7883). – Thérèse Jun 24 '15 at 00:47