# [XeTeX] Font variant selection in Fontspec/Mathspec options incomplete

Christian Schmidt pinfeng at hotmail.de
Wed Nov 10 09:39:33 CET 2010

Hello everyone,
This is my first post on this mailing list and I felt the need to join, because I think I have discovered something to discuss.
I've been using XeLaTeX for quite a while already to compile my TeX files to PDF. Now, while I was playing around with font selection features of the mathspec package I came across a likely bug or unimplemented feature in the fontspec/mathspec package:
Selecting a font via the extension option/feature from Truetype or Opentype font files and, at the same time, specifying the corresponding font variants through the other options, fontspec/mathspec is not able to set the variant "Bold Italic". It simply seems to ignore the "BoldItalicFont" option that I have set.

Here is my code snippet:
*****\documentclass{article}

\usepackage{amsmath,amsfonts}
\usepackage{mathspec}

\setmainfont[Extension={.ttf},UprightFont={*Rg},BoldFont={*Bd},ItalicFont={*It},BoldItalicFont={*BdIt}]{Aller_}

\defaultfontfeatures{Mapping=tex-text}\usepackage{polyglossia}

\begin{document}

\textbf{\textit{This should be in bold italic x y z,} whereas this is only in bold.}

\end{document}*****

This also leads to the following error during compilation:*****LaTeX Font Warning: Font shape EU1/Aller_(0)/bx/it' undefined
(Font)              using EU1/Aller_(0)/bx/n' instead on input line 13.
*****
However, if one replaces the respective line with the following
\setmainfont[BoldFont={* Bold},ItalicFont={* Italic},BoldItalicFont={* Bold Italic}]{Aller}

and thereby uses the feature to automatically select system fonts for instance, the "Bold Italic" variant is loaded correctly.
Moreover, if one looks more closely at the log file from XeLaTeX it is interesting to note that in both cases (extension based and automatic) fontspec/mathspec even loads the available Small Caps variant in Regular, Italic and Bold Italic form - even though, this is not particularly set so in the options.
*****\g_fontspec_family_Aller__int=\count164
fontspec Info: Defining font family for 'Aller_' with options [Extension={.ttf},
UprightFont={*Rg},BoldFont={*Bd},ItalicFont={*It},BoldItalicFont={*BdIt}].

fontspec Info: Defining shape 'normal' with NFSS specification:
(fontspec)  <->"[Aller_Rg.ttf]/ICU:script=latn;language=DFLT;"

fontspec Info: Defining shape 'small caps' with NFSS specification:
(fontspec)  <->"[Aller_Rg.ttf]/ICU:script=latn;language=DFLT;+smcp;"

fontspec Info: Defining shape 'bold' with NFSS specification:
(fontspec)  <->"[Aller_Bd.ttf]/ICU:script=latn;language=DFLT;"

fontspec Info: Defining shape 'bold small caps' with NFSS specification:
(fontspec)  <->"[Aller_Bd.ttf]/ICU:script=latn;language=DFLT;+smcp;"

fontspec Info: Defining shape 'italic' with NFSS specification:
(fontspec)  <->"[Aller_It.ttf]/ICU:script=latn;language=DFLT;"

fontspec Info: Defining shape 'italic small caps' with NFSS specification:
(fontspec)  <->"[Aller_It.ttf]/ICU:script=latn;language=DFLT;+smcp;"
*****
I suppose, that this is indeed a bug or at least a forgotten feature - as it is already implemented partly but only for automatic font selection.Can anyone please confirm this and maybe give a solution to the problem?
Thank you,Pinfeng