[NTG-context] How to calculate the height of text of a certain width?
Rudolf Bahr
quasi at quasi.de
Tue Mar 24 19:04:52 CET 2020
On Tue, Mar 24, 2020 at 04:43:17PM +0100, Wolfgang Schuster wrote:
> > \setbox0=\vbox{... somehow flushed text ...} wount work, i.e \wd0 or \ht0
> > will both result in 0. With "unflushed" text this means will work perfectly.
>
> I have no idea where you get 0 (0pt?).
Nor do I, in the meantime. Sorry for my noise, I don't know what sort of
mistakes I did to get "0.0pt".
Corona? :-)
This is my test, which is essentially the same what Aditya suggests:
-----------------------------------------
\starttext
\setbox0=\vbox{\hsize=300pt\input ward }
\copy0
wd0=\the\wd0, ht0=\the\ht0
\vskip12pt
\startalign[flushleft]
\setbox1=\vbox{\hsize=300pt\input ward }
\stopalign
\copy1
wd1=\the\wd1, ht1=\the\ht1
\stoptext
-----------------------------------------
The .pdf-file is appended
Now to your proposal, Wolfgang:
>
> \starttexdefinition NextboxDimension
> \starttabulate
> \NC Width \EQ \the\nextboxwd \NC\NR
> \NC Height \NC \the\nextboxht \NC\NR
> \stoptabulate
> \stoptexdefinition
>
> \starttext
>
> \dowithnextboxcs
> \NextboxDimension
> \vbox
> {\samplefile{ward}}
>
> \dowithnextboxcs
> \NextboxDimension
> \vbox
> {\setupalign[flushright]
> \samplefile{ward}}
>
> \dowithnextboxcs
> \NextboxDimension
> \vbox
> {\hsize=200pt
> \samplefile{ward}}
>
> \dowithnextboxcs
> \NextboxDimension
> \vbox
> {\hsize=200pt
> \setupalign[flushright]
> \samplefile{ward}}
>
> \stoptext
Up to now I cannot say anything about it, because there are some
commands which are new to me. I have to study them first.
Thank you for your effort!
Rudolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setbox---2.pdf
Type: application/pdf
Size: 8736 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200324/87478505/attachment-0001.pdf>
More information about the ntg-context
mailing list