The first thing to diagnose for "XeTeX running slowly" problems is to compile the document with xelatex -no-pdf
, and then run xdvipdfmx
manually on the resulting .xdv
file. Timing each one separately will indicate whether it's XeTeX running slowly or xdvipdfmx
.
The next step is to figure out if it's XeTeX or fontspec
at fault. I would be surprised if it were fontspec
that were causing this slowdown. (Not because I have high regard for fontspec
's efficiency, but rather that others haven't reported such terrible performance.) Try compiling the following example instead:
\documentclass{article}
\message{Hello}
\font\x="AlegreyaSC-Regular" at 10pt
\message{How are you?}
\begin{document}
{\x Test}
\end{document}
My hypothesis is that this is also slow for you. (If not, maybe it is my fault after all.)
This method for loading the font (by "font name") is presumably using the Windows equivalent of fc-cache
, which I know very little about. It's possible that you have many many fonts installed in your system, and this is slowing things down. Or that there's something misconfigured that's forcing some sort of database rebuild every time XeTeX queries for a font.
You might be able to get around this problem by loading the font by filename instead:
\setmainfont[Path=...]{AlegreyaSC-Regular.otf}
This will require you to select the bold/italic shapes manually; e.g., something like:
\setmainfont[Path=...,Extension=.otf,
UprightFont=*-Regular,
ItalicFont=*-Italic,...]{AlegreyaSC}
Best Answer
Texstudio understands "magic comments", so you can specify the engine by using
or
If you then call "build & view" texstudio will process your file with the engine you specified in the magic comment.