[XeTeX] Erroneous \lastkern

Ross Moore ross.moore at mq.edu.au
Sat Jun 29 02:50:48 CEST 2019


Hi Ulrike, Jonathan,

On 28 Jun 2019, at 6:59 pm, Jonathan Kew <jfkthame at gmail.com<mailto:jfkthame at gmail.com>> wrote:

On 28/06/2019 08:32, Ulrike Fischer wrote:
> Am Thu, 27 Jun 2019 23:03:09 +0000 schrieb Ross Moore:
>
>>> there is probably something wrong with XeLaTeX, but I cannot find what.
>>
>> The difference between xetex and xelatex is the font:
>>
>> I’m sorry but I don’t understand this as an answer.
>
> It wasn't meant as an answer. I only explained why you get different
> results with plain and latex: because they use different default
> fonts.

OK. But that just emphasises that there is a bug lurking here.

> xetex has a different typesetting engine: it doesn't handle chars
> but words as units.
>
> See page 31 here http://xml.web.cern.ch/XML/lgc2/xetexmain.pdf<https://protect-au.mimecast.com/s/jOdnCWLVn6iDMlXKfxOK2u?domain=xml.web.cern.ch>.
>
> So I'm not really surprised that you get the y, I was more suprised
> that it doesn't happen with legacy fonts - there it seem to switch
> back to the "handle characters" mode.

Yes, the bug arises because of how xetex collects a series of characters
to be "shaped" by an opentype font, rather than the core tex engine
handling each character individually. So at the point when \lastkern is
encountered, the letter A has not yet been appended to the current node
list being built; it is "pending" in the buffer of characters that will
become a whole-word node.

OK, I understand that now.
In fact I was think of surmising that such a mechanism could be in play.

But surely this means that XeTeX's “current list” should be that buffer, not TeX’s usual horizontal list.
So  \lastkern , \lastpenalty  and  \lastskip  should be getting their values from there.

Alternatively, and perhaps equivalently, just set all these to zero whenever we are adding characters
to this “pending” buffer. Only when the words are ready to be put back into the horizontal list,
should these be set back to what is there, if those values are still relevant to any typesetting tasks
at the beginning of that resulting word.


Still, I would regard this as a bug that we ought to fix. I imagine
similar primitives like \lastpenalty or \lastskip probably share the
same buggy behavior.

Yes, I would think so.

BTW, this is relevant to my Tagged PDF work, as it must insert extra literal material via \special  commands.
To ensure the same typesetting as without those tags, it is frequently necessary to transfer that previous
\skip , \kern  or \penalty  to come *after* the \special  and nullify the one before it.

So far this is only developed for pdfTeX, but in future we’ll want it for XeTeX too.
Discovering this difference now, and fixing it, will surely avoid a headache when that time comes.


JK


Cheers,

Ross


Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
http://www.maths.mq.edu.au
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>
<http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/xetex/attachments/20190629/73036a1e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://tug.org/pipermail/xetex/attachments/20190629/73036a1e/attachment-0001.png>


More information about the XeTeX mailing list