[NTG-pdftex] \ifx equality of expanded fonts

Robert w.m.l at gmx.net
Tue Feb 22 01:03:45 CET 2022


Hi,

I don't know whether this qualifies as a bug or not, and whether
anything can or even should be done about it, but at least to me the
following behaviour seems somewhat unexpected:

\ifx\directlua\undefined\else
\def\pdffontexpand#1autoexpand{\expandglyphsinfont#1}
\fi
\def\test#1#2{\relax0#1 expanded, 1#2 expanded:
   \ifx\0\1equal\else different\fi\par}
\font\0=cmr10
\font\1=cmr10
\test{ not}{ not}
\pdffontexpand\1 20 20 1 autoexpand
\test{ not}{}
\pdffontexpand\0 20 20 1 autoexpand
\font\1=cmr10
\test{}{ not}
\pdffontexpand\1 20 20 1 autoexpand
\test{}{}
\edef\x{\meaning\0} \edef\y{\meaning\1}
meaning \ifx\x\y for both: \x\else different\fi
\bye

As you see, the font definitions are equal (in terms of \ifx) if the
first font has not been expanded before the second one is defined, but
are different if the first one has been expanded first (in both cases
regardless of whether the second font is expanded or not).

(The real-world example is this:
https://tex.stackexchange.com/questions/633441/, where Spanish babel
tests whether a small caps font exists by comparing it with the upright
font, which gives a wrong result if the upright font has been expanded.)

(Second parenthesis: with luatex, all of the above \ifx comparisons
yield unequality, but that's of course outside the scope of this list.)

Best regards,
--
  Robert


More information about the ntg-pdftex mailing list