[NTG-context] Getting width of text to be typeset
Gerben Wierda
gerben.wierda at rna.nl
Sat May 23 13:04:12 CEST 2020
> On 23 May 2020, at 01:49, Rik Kabel <ConTeXt at rik.users.panix.com> wrote:
>
> If the OP simply wants the width of a string, one can use \setwidthof#1\to#2.
>
> \define\String{pqrs}
> \setwidthof{\String}\to\Wdth
> \String\ is \Wdth\ wide.
>
> \setwidthof{{\tfb\em\String}}\to\Wdth
> {\tfb\em\String} is \Wdth\ wide.
>
> I do not know if that is different from the width of the same string unboxed from the paragraph. There may be some adjustments made in justification, expansion, and such that are not treated.
Additionally: suppose I am in lua. Would it be possible to get the width (and height) of a string back in lua as a value?
So, in lua something like this:
width = tex.widthofstring(“I have a string with some $\frac{1}2{}$ (math) in it")
G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200523/336eb2e4/attachment.htm>
More information about the ntg-context
mailing list