# Why is \setmainfont case sensitive with XelateX but not with LuaLaTeX?

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?

• Luaotfload normalizes all names supplied by the font. Apart from lowercasing you can also leave out spaces if you wish. Jan 15, 2015 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? Jan 15, 2015 at 11:48
• 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. Jan 15, 2015 at 21:17
• @phg do you want to write an answer for this one? Jan 27, 2015 at 12:28
• @Paul Gessler I’ll see to it later, no time right now. Thanks for reminding, though. Feb 12, 2015 at 7:08

luaotfload normalizes all names supplied by the font. Apart from lowercasing you can also leave out spaces if you wish.
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.