ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Max Chernoff via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Max Chernoff <mseven@telus.net>
Subject: Can't manipulate glue added by tex.preparelinebreak
Date: Tue, 26 Jul 2022 00:18:25 -0600	[thread overview]
Message-ID: <2eea499509373e3e57b5a350ac9844bb513c9066.camel@telus.net> (raw)

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2022-07-26  6:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26  6:18 Max Chernoff via ntg-context [this message]
2022-07-26  8:06 ` Hans Hagen via ntg-context
2022-07-28  7:03   ` Max Chernoff via ntg-context
2022-07-28  7:58     ` Hans Hagen via ntg-context
2022-07-27 16:02 ` Hans Hagen via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2eea499509373e3e57b5a350ac9844bb513c9066.camel@telus.net \
    --to=ntg-context@ntg.nl \
    --cc=mseven@telus.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).