# XeLaTeX exhibiting strange behaviour surrounding new pages and text shapes

I'm working on a XeLaTeX document using memoir with custom fonts. I have been experiencing strange behavior where, upon insertion of a page break (manually or by TeX), an undefined text shape is referenced - TU/(0)/m/it. The document should, theoretically, be using TU/[Cantarell-Regular.otf](0)/m/it in situations where that series and shape are desired. The shape is not referenced until a break within the first chapter. Breaks prior to this point, such as those which separate the title page and table of contents do not exhibit this behavior.

For reference, here is the preamble to the document itself.

\documentclass{memoir}

\usepackage[svgnames]{xcolor}

\usepackage[section]{placeins}

\usepackage{fontspec}
\usepackage{xltxtra}

\setmainfont[
BoldFont={[Cantarell-Bold.otf]},
ItalicFont={[Cantarell-Oblique.otf]},
BoldItalicFont={[Cantarell-BoldOblique.otf]}
]{[Cantarell-Regular.otf]}

\setsansfont[
BoldFont={[Cantarell-Bold.otf]},
ItalicFont={[Cantarell-Oblique.otf]},
BoldItalicFont={[Cantarell-BoldOblique.otf]}
]{[Cantarell-Regular.otf]}

\usepackage{hyperref}
\hypersetup{
}

\usepackage{tabularx}

\newcolumntype{Z}{>{\ttfamily} X}
\newcolumntype{V}{>{\raggedleft\ttfamily} X}
\newcolumntype{L}{>{\ttfamily} l}
\newcolumntype{R}{>{\ttfamily} r}
\newcolumntype{C}{>{\ttfamily} c}


And additionally, the error message produced by XeLaTeX

[2] [3]
! No declaration for shape TU/(0)/m/it.
sub@sfcnt ...e forspace shapespace mandatory@arg }
error@fontshape else #1{Fo...
l.134 \end{document}

?
! Emergency stop.
sub@sfcnt ...e forspace shapespace mandatory@arg }
error@fontshape else #1{Fo...
l.134 \end{document}


I have tested, and reproduced, this with no packages other than those which facilitate use of \setmainfont. As you can imagine, I am quite confused as to what the problem is. Perhaps if I knew what the actual cause of the problem was I could resolve it, but it appears to arise from the document class. My first guess as to the culprit would be the page headers from memoir.

• I’m experiencing the same issue. AFAIK, fontspec does not support square brackets notations well. For my custom files, I had to remove all the square brackets around the font names to complie. Please try something like \setmainfont[ BoldFont=Cantarell-Bold.otf ]{Cantarell-Regular.otf} – Ruixi Zhang May 25 at 20:54