[NTG-context] Can't manipulate glue added by tex.preparelinebreak
Max Chernoff
mseven at telus.net
Tue Jul 26 08:18:25 CEST 2022
Hi Hans,
The new tex.preparelinebreak is great (thanks again), but I can't seem
to figure out how to manipulate the parfillskip nodes that it adds.
MWE:
\newbox\testbox
\startluacode
function test(head)
if head.id ~= node.id "par" then
return head
end
new_head = node.copylist(head)
tex.preparelinebreak(new_head)
local parfillskip = node.tail(new_head)
inspect(parfillskip) -- Confirm that this really is a parfillskip
parfillskip.stretchorder = 0
parfillskip.stretch = 0
local broken = tex.linebreak(new_head)
tex.setbox("global", "testbox", broken)
return head
end
\stopluacode
\starttext
{\dorecurse{209}{Hello }\par}\page
{\parfillskip=0pt\dorecurse{209}{Hello }\par}\page
{\ctxlua{nodes.tasks.appendaction("processors", "after", "test")}
\dorecurse{209}{Hello }\par}\page
\box\testbox
\stoptext
I would expect that pages 1 and 3 would be identical, and that pages 2
and 4 would be identical. However, page 4 is the same as pages 1 and 3,
which isn't what I'd expect. I can do a similar idea in LuaTeX/MkIV and
get the expected results, so I'm not too sure what I'm doing wrong here.
I'm probably just missing something obvious, but I'm not too sure what.
Any ideas?
Thanks,
-- Max
More information about the ntg-context
mailing list