9

Consider the following MWE

\documentclass{article}
\usepackage{lipsum}
\usepackage{fontspec}
\setmainfont{tex Gyre Pagella}
\begin{document}
\lipsum[1]
\end{document} 

If I compile it with LuaLaTeX all is fine.

But, if I compile it with XeLaTeX I get the error

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "tex Gyre Pagella" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.7 \setmainfont{tex Gyre Pagella}

?

This is because I've written tex Gyre Pagella instead of TeX Gyre Pagella in the argument of \setmainfont. If I change it to TeX Gyre Pagella then XeLaTeX compiles it.

Why this behavior? Do LuaLaTeX and XeLaTeX load different fontspec packages or there is something else that I'm missing?

7
  • 7
    Luaotfload normalizes all names supplied by the font. Apart from lowercasing you can also leave out spaces if you wish. – Philipp Gesang Jan 15 '15 at 6:20
  • @phg Thanks for the comment. So it is engine-dependant, nothing to do with fontspec. Can you explain it more extensively in an answer (for example what is luaotfload), detailing the differences between XeLaTeX and LuaLaTeX? – Sterry Jan 15 '15 at 11:48
  • 6
    It is not engine-dependent, just how Luaotfload (and, incidentally, Context) treat things. The rationale is simple: Font names are a horrible mess that will haunt you and your descendants to the fifth generation if you attempt to uncover a system behind them. Since capitalization of identifiers can vary even within a font family, the only sane approach is to eliminate it completely. For info about Luaotfload read texdoc luaotfload and man 1 luaotfload-tool. – Philipp Gesang Jan 15 '15 at 21:17
  • @phg do you want to write an answer for this one? – Paul Gessler Jan 27 '15 at 12:28
  • @Paul Gessler I’ll see to it later, no time right now. Thanks for reminding, though. – Philipp Gesang Feb 12 '15 at 7:08
5

CW from the comments:

luaotfload normalizes all names supplied by the font. Apart from lowercasing you can also leave out spaces if you wish.

So, for XeLaTeX, spacing and casing are significant, while for LuaLaTeX, they are not.

This is not engine-dependent, just how luaotfload (and, incidentally, ConTeXt) treat things. The rationale is simple: Font names are a horrible mess that will haunt you and your descendants to the fifth generation if you attempt to uncover a system behind them. Since capitalization of identifiers can vary even within a font family, the only sane approach is to eliminate it completely. For info about luaotfload read texdoc luaotfload and man 1 luaotfload-tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.