Skip to content

What is the right way within a script to measure the content of a node tree? #1599

Answered by alerque
ctrlcctrlv asked this question in Q&A
Discussion options

You must be logged in to vote

If you just have a node, say an hbox or a vbox or something you should just be able to ask it for the measurement you want. All nodes have width and length properties that are measurements and (at least once they are shaped) should tell you about their sizes. An exact use case might shed some light on how/when to grab that info.

You might look at the definition of float() in packages/frametricks.lua for an example that also is an example of an "undo" (see #925):

local hbox = SILE.call("hbox", {}, content)
table.remove(SILE.typesetter.state.nodes) -- steal it back

That typeset a tree of content into an hbox, kept the result in a variable but nuked it from the actual output queue so it wou…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alerque
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Ask for advice or investigate solutions
2 participants
Converted from issue

This discussion was converted from issue #927 on November 09, 2022 11:55.