On 19/09/2010, at 8:57 PM, Ulrike Fischer wrote:
> I have tracked it a bit down. The source is 1. that \slshape use sub
> in \DeclareFontShape and 2. that the "font declaration" is stored in
> a command.
None of this makes sense to me. I've tried playing with your example; see
attached.
Even the order of which font comes first seems to break things; uncomment the
\reverse line to see (if our results are the same, anyway); when uncommented,
the output looks correct; when commented, the garbage appears again -- for both
instances of \selectfont.
Also, \fontdesc is expanded before \DeclareFontShape, so that doesn't seem to
be the (main) source of the problem.
Surrounding the font strings with braces instead of quotes also kills things (I
suspect due to a LaTeX limitation).
Stumped.
-- Will
\documentclass{article}
\usepackage{luaotfload}
\DeclareFontEncoding{EU2}{}{}
\DeclareErrorFont{EU2}{lmr}{m}{n}{10}
\DeclareFontSubstitution{EU2}{lmr}{m}{n}
\newcommand\fontdesc{<->"name:XITS Math:mode=node;script=latn;language=DFLT;"}
\DeclareFontFamily{EU2}{testfam}{}
\edef\x{\noexpand\DeclareFontShape {EU2}{testfam}{m}{n}{\fontdesc}{}}
\x
\DeclareFontShape {EU2}{testfam}{m}{it}{<->sub*testfam/m/n}{}
\DeclareFontFamily{EU2}{testfamb}{}
\DeclareFontShape {EU2}{testfamb}{m}{n}{<->"name:XITS
Math:mode=node;language=DFLT;script=latn;"}{}
\DeclareFontShape {EU2}{testfamb}{m}{it}{<->sub*testfamb/m/n}{}
\begin{document}
\fontencoding{EU2}
\def\reverse#1#2{#2#1}
\reverse % comment for the problem
{\fontfamily{testfam}[\selectfont] fam\\
\fontshape{it}[\selectfont] abc\\}
{\fontfamily{testfamb}[\selectfont] famb\\
\fontshape{it}[\selectfont] abc\\}
\end{document}