[Dev-luatex] lastnodetype, again

Robert w.m.l at gmx.net
Sun Aug 22 01:17:50 CEST 2021

On 19.08.21 18:30, Hans Hagen wrote:
> On 8/19/2021 5:00 PM, Robert wrote:
>> Hans has replied off-list, saying that this is basically expected
>> behaviour and that checking for ligatures by means of \lastnodetype is
>> inherently unreliable in luatex. In that case I would suggest to change
>> the wording in the manual, which quite unequivocally claims the opposite:
>>
>> | The \lastnodetype primitive is 𝜀-TEX compliant. The valid range is
>> | still [−1, 15] and glyph nodes (formerly known as char nodes) have
>> | number 0 while ligature nodes are mapped to 7. That way macro packages
>> | can use the same symbolic names as in traditional 𝜀-TEX.
>> (p.123)
>
> this is correct .. it doesn't say that the nodelist is the same and in
> fact luatex does report the right node in etex speak ..

Hm, just saying, numbers are in the same range, but they actually may be
totally different, is not really what I would call "compliant"...

> in the case of
> luatex there is no ligature node because the nodelist isn't processed
> and even then it could as well be a disc node

Well yes, something comparable (I guess) happens in etex/pdftex: without
the \relax after the ligature, they also just report a glyph node --
with the \relax, however, they do report a ligature (or disc) node. But
with luatex it doesn't make a difference whether there's a \relax after
the ligature or not. That's kind of the crux of my report, I suppose.

Also, luatex does get the node type right when the ligature is wrapped
in a box first:
\setbox0\hbox{--}
\unhbox0 \the\lastnodetype % OK

So deep down luatex seems to know better...

> just don't assume that luatex, pdftex, xetex produce the same node lists

Not even if there's no opentype font involved? And just for the record,
xetex does report the same as pdftex.

> and don't assume that f + i is a ligature in each font (or script /
> language) either because it can as wel be some kerning between f (either
> or not substituted) and i (either or not substituted)

I have no idea why you would think that I assume that f+i is a ligature
in every font (I don't), and furthermore, I have no idea what this has
to do with \lastnodetype not returning the expected value (my example
didn't even contain "fi").

> in luatex when you want to mess around at that level you have to use a
> callback (or preprocess the input)

Not quite sure how preprocessing the /input/ could tell me whether a
/font/ has a specific ligature. Also I'm a bit baffled that expecting a
luatex command to be compatible with etex/pdftex (as per the manual)
should be tantamount to "messing around".

Best,
--
Robert