[XeTeX] Fontspec bug?
Bruno Voisin
bvoisin at mac.com
Wed May 17 19:17:34 CEST 2006
I just tried to convert a document of mine using bare-bones XeLaTeX
font selection of the form:
> \usepackage[LY1]{fontenc}
> \usepackage[expert,lucidasmallscale]{lucidabr}
>
> \DeclareFontFamily{U}{hoeflertext}{}
> \DeclareFontShape{U}{hoeflertext}{m}{n}
> {<-> "Hoefler\space Text:mapping=tex-text;
> Number\space Case=Upper\space Case\space Numbers
> "}{}
> \DeclareFontShape{U}{hoeflertext}{m}{it}
> {<-> "Hoefler\space Text\space Italic:mapping=tex-text;
> Number\space Case=Uppercase\space Numbers;
> Smart\space Swashes=!Line\space Final\space Swashes,
> !Line\space Initial\space Swashes
> "}{}
> [...]
> \renewcommand{\encodingdefault}{U}
> \renewcommand{\rmdefault}{hoeflertext}
>
> \SetSymbolFont{operators}{normal}{\encodingdefault}{\rmdefault}{m}{n}
> \SetSymbolFont{operators}{bold} {\encodingdefault}{\rmdefault}{b}{n}
> \SetMathAlphabet{\mathrm}{normal}{\encodingdefault}{\rmdefault}{m}{n}
> \SetMathAlphabet{\mathbf}{normal}{\encodingdefault}{\rmdefault}{b}{n}
> \SetMathAlphabet{\mathit}{normal}{\encodingdefault}{\rmdefault}{m}{it}
> \SetMathAlphabet{\mathrm}{bold} {\encodingdefault}{\rmdefault}{b}{n}
> \SetMathAlphabet{\mathit}{bold} {\encodingdefault}{\rmdefault}{b}{it}
to font selection using the fontspec package:
> \usepackage[LY1]{fontenc}
> \usepackage[expert,lucidasmallscale]{lucidabr}
>
> \usepackage{fontspec}
> \defaultfontfeatures{%
> Mapping=tex-text,
> Numbers={Lining},
> Contextuals={NoLineInitial,NoLineFinal}
> }
> \setromanfont{Hoefler Text}
No need to emphasize the convenience of the second approach!
However, looking more closely I noticed numbers in math formulae are
typeset in Hoefler Text as intended in the first case (thanks to the
redefinition of the operators font, see \DeclareMathSymbol{0}
{\mathalpha}{operators}{`0} etc. in /usr/local/teTeX/share/
texmf.tetex/tex/latex/base/fontmath.ltx), but in Computer Modern when
using fontspec (v1.9).
It seems the culprit is line 936 of fontspec.sty, which instead of
\ifzf at math@lucida
should read
\ifzf at math@lucida\else
so that the whole stuff becomes
\def\zf at rmmaths{\rmdefault}
[...]
\@ifpackageloaded{lucbmath}{\zf at math@lucidatrue}{}
\@ifpackageloaded{lucidabr}{\zf at math@lucidatrue}{}
\DeclareSymbolFont{legacymaths}{OT1}{cmr}{m}{n}
[...]
\ifzf at math@euler\else
[...]
\ifzf at math@lucida\else
\DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0}
[...]
\fi
\fi
\DeclareSymbolFont{operators}\zf at enc\zf at rmmaths\mddefault\updefault
\SetSymbolFont{operators}{normal}\zf at enc\zf at rmmaths\mddefault
\updefault
implying that the operators font (by default \zf at rmmaths = \rmdefault
= (here) Hoefler Text) is used for numbers in maths when Lucida is
used and the legacymaths font (i.e. CMR) otherwise.
However, even in this case I'm not quite certain that the use of
Lucida should dictate whether or not the text font (not necessarily
Lucida, for example here) is used for typesetting numbers in maths
mode. I remember the introduction of the legacymaths mechanism in
fontspec resulted from the use of the operators font for some
diacritics in LaTeX by default, but I must admit I don't remember the
whole story.
Bruno Voisin
More information about the XeTeX
mailing list