[XeTeX] fontspec v1.7
Bruno Voisin
bvoisin at mac.com
Mon Jun 20 09:59:07 CEST 2005
Le 20 juin 05 à 02:02, Jonathan Kew a écrit :
> If someone would be able to put together a minimal example that
> makes it fail, without getting into fontspec and math mode and so
> on, that would be really helpful. Can you crash it by just
> selecting a certain font in plain TeX, and trying to render a
> certain character using \char? If so, I'd love to have such a test
> case, to see if there's some way to figure out why it fails and
> make it more reliable.
I think I was wrong, when telling this was caused by encoding issues,
and not by an incompatibility between XeTeX, ATSUI and LaTeX's
\DeclareMathAccent. Given Will's patch should get the encoding issue
right, but doesn't remove the xdv2pdf crash, the problem must lie
within \DeclareMathAccent itself.
Looking more closely at \DeclareMathAccent and \DeclareMathSymbol in
latex.ltx, there is indeed a fundamental difference between the two:
\DeclareMathSymbol uses \set at mathsymbol which is
\def\set at mathsymbol#1#2#3#4{%
\global\mathchardef#2"\mathchar at type#3\hexnumber@#1#4\relax}
and hence involves \mathchardef, while \DeclareMathAccent uses
\set at mathaccent which is
\def\set at mathaccent#1#2#3#4{%
\xdef#2{\mathaccent"\mathchar at type#3\hexnumber@#1#4\relax}}
and hence involves \mathaccent. \mathchar at type seems to convert the
mathtype (\mathord etc.) into plain TeX's class number (0 etc.).
Very briefly, looking at how \set at mathsymbol and \set at mathaccent are
invoked, it seems the commands work informally as follows:
- \DeclareMathSymbol{\natural}{\mathord}{letters}{"5C} amounts to
\global\mathchardef\natural="\mathord-letters-5C
- \DeclareMathAccent{\grave}{\mathalpha}{operators}{"12} amounts to
\xdef\grave{\mathaccent"\mathalpha-operators-12}
letters and operators are invoked in the form \csname sym-letters
\endcsname and \csname sym-operators\endcsname, while the character
positions such as "5C and "12 are stored in hexadecimal form as two
digits in two counters \count0 and \count2.
What I've observed is that, when a math accent is taken from an ATSUI
font (like Optima), even in those cases when the accent doesn't crash
xvd2pdf, then it doesn't come out as expected (ie. the accent doesn't
show up, or it does show up but isn't the expected glyph).
What could happen is that the redefinition, in XeTeX, of the standard
TeX primitives \mathaccent and/or \xdef is such the sophisticated
usage of \expandafter \noexpand \csname \endcsname inside the
definition of \DeclareMathAccent implies that the glyph position, in
the form {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}, isn't
passed on properly to the XeTeX stomach.
I hope this is low-level TeX enough to allow further debugging by
others. Sorry I can't investigate TeX issues more consistently, I
don't have much time left for them any longer.
Bruno
More information about the XeTeX
mailing list