-
I have been working on creating posters for different fonts using SILE and Lua. When I try to calculate the paragraph height after changing the linespacing method to fixed and providing a fixed baselinedistance value, I can not get the correct value. I use the following lines of code to calculate the paragraph height: `
` Here 'subsidiary.height' gives me the standard paragraph height that SILE calculates using vboxes, and 'calcparheight' gives me paragraph height with depth(ascenders & descenders) included after calculations(sum of each line height). Both of them work fine when the linespacing is off but gives incorrect paragraph height when linespacing is on. I change the linespacing method inside Lua as below: `
` I need help on fixing the above code or solving this using any other method or function in Lua or SILE to calculate the paragraph height. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
I think your calculations using the default spacing might be wrong (but by happy accident coming in close). You do realize you cannot know the final height of a paragraph until during the page break routine when all aspects of the height are finalized, right? Anything you try to do in the flow of things like you are is going to be either a guess or you are going to fudge and force some things in the page builder to happen early and hence fix parts of the page before other parts, which can have weird side effects. Do you have a more complete working example I can look at for where you are calculating this and what gets done with it afterwards? |
Beta Was this translation helpful? Give feedback.
-
Your code is hard to guess with uncomplete script, undeclared variables, etc. Here is a working version:
Outputs:
With both giving the same results, which is logical since the loop is (more or less) what the collateVboxes does (wrapping the vboxes in a single vbox, which will evaluate its height (see the implementation of the Note the results are the same with the beginning of the script being:
(I.e. the default TeX linespacing but tried to make "fixed"... At least for this text only input in a single size) Your initial code was testing on |
Beta Was this translation helpful? Give feedback.
Your code is hard to guess with uncomplete script, undeclared variables, etc.
Here is a working version: