From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/107452 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Gerben Wierda Newsgroups: gmane.comp.tex.context Subject: Re: Getting width of text to be typeset Date: Sat, 23 May 2020 13:04:12 +0200 Message-ID: <020C5B94-2D68-4D45-87A7-3E2A601A6472@rna.nl> References: <1217e4fe7a813a0e714d342b9efec0c4@vivaldi.net> <639ff2c9-65f6-b818-1d8f-9249331a9b8a@xs4all.nl> <357d26e1-2571-b30c-2eb6-c787ed3bbf18@rik.users.panix.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: multipart/mixed; boundary="===============5677106190449481727==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="28329"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat May 23 13:04:31 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jcRx8-0007GY-RX for gctc-ntg-context-518@m.gmane-mx.org; Sat, 23 May 2020 13:04:30 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 90232183EC0; Sat, 23 May 2020 13:04:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aVbLt7um0p2R; Sat, 23 May 2020 13:04:16 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id A398D18441C; Sat, 23 May 2020 13:04:16 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id AA8FB183EC0 for ; Sat, 23 May 2020 13:04:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aA8QkZ2L-8oi for ; Sat, 23 May 2020 13:04:15 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=213.125.118.53; helo=mail.rna.nl; envelope-from=gerben.wierda@rna.nl; receiver= Original-Received: from mail.rna.nl (mail.rna.nl [213.125.118.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 164DD182A3D for ; Sat, 23 May 2020 13:04:14 +0200 (CEST) Original-Received: from hermione.rna.nl (hermione.rna.nl [192.168.2.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.rna.nl (Postfix) with ESMTPSA id 1207C3EF108C for ; Sat, 23 May 2020 13:04:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rna.nl; s=dkim_rsa2048; t=1590231853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=c6HKFwtmCA8yw7jNjmqwZOQGq8/n5ziXHEfHvjEVAsU=; b=DLpY+4uakeUtdlyWaO/QZyUA6YHJxZoJ0uBz6c0XLFQOi1/++Moee1P4JICpFi6yoH3uxW i4QP/N6O3c/uMKrokK7dZ9mGgHQJI35QiYjIa6W1nv0WXCujo+z7oUOU2yMSYYBn0F/Agf wzMKfMFYB8/M5AUGPuScKbCvv0wq/QllRnpEBHiRAodOeoOSHyWNroKU2TKIyKRAARCnHw 75f96/l6YD9COwSw3IFQTI989KxFfVjZGSmHFyiIxE+tTAcVJAPTvSL2SJU4FaehWtLZjq clErWZ8bKCa9RAsKkeeMIy60BSMLFnCTVA3hPRJ5WPJaV6n4zcsihW12tg/ggw== In-Reply-To: <357d26e1-2571-b30c-2eb6-c787ed3bbf18@rik.users.panix.com> X-Mailer: Apple Mail (2.3445.104.14) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:107452 Archived-At: --===============5677106190449481727== Content-Type: multipart/alternative; boundary="Apple-Mail=_6B00CC3C-C79A-4640-B025-222905FF4951" --Apple-Mail=_6B00CC3C-C79A-4640-B025-222905FF4951 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 23 May 2020, at 01:49, Rik Kabel = wrote: >=20 > If the OP simply wants the width of a string, one can use = \setwidthof#1\to#2. >=20 > \define\String{pqrs} > \setwidthof{\String}\to\Wdth > \String\ is \Wdth\ wide. >=20 > \setwidthof{{\tfb\em\String}}\to\Wdth > {\tfb\em\String} is \Wdth\ wide. >=20 > 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 =3D tex.widthofstring(=E2=80=9CI have a string with some = $\frac{1}2{}$ (math) in it") G= --Apple-Mail=_6B00CC3C-C79A-4640-B025-222905FF4951 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 23 May 2020, at 01:49, Rik Kabel <ConTeXt@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= =3D tex.widthofstring(=E2=80=9CI have a string with some $\frac{1}2{}$ = (math) in it")

G
= --Apple-Mail=_6B00CC3C-C79A-4640-B025-222905FF4951-- --===============5677106190449481727== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============5677106190449481727==--