ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Access ConTeXt dimensions in Lua
@ 2016-10-08 20:41 Henning Hraban Ramm
  2016-10-08 20:56 ` Henning Hraban Ramm
  2016-10-09 13:49 ` Hans Hagen
  0 siblings, 2 replies; 3+ messages in thread
From: Henning Hraban Ramm @ 2016-10-08 20:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

I’m trying to write some dimensions to a file, e.g.

\startluacode
io.savedata("settings.txt", context("\\textwidth"))
\stopluacode

But that context() construct is nil.
There’s probably a simple solution... ;)


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)
GPG Key ID 1C9B22FD

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Access ConTeXt dimensions in Lua
  2016-10-08 20:41 Access ConTeXt dimensions in Lua Henning Hraban Ramm
@ 2016-10-08 20:56 ` Henning Hraban Ramm
  2016-10-09 13:49 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Henning Hraban Ramm @ 2016-10-08 20:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> \startluacode
> io.savedata("settings.txt", context("\\textwidth"))
> \stopluacode

Found it myself:
number.todimen(tex.dimen.textwidth)

Sorry for the noise.

But now I need the current font name, even better the current values for rm, ss and tt fonts.
I found p.123 of cld-mkiv.pdf, but don’t know how to address these values.


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)
GPG Key ID 1C9B22FD

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Access ConTeXt dimensions in Lua
  2016-10-08 20:41 Access ConTeXt dimensions in Lua Henning Hraban Ramm
  2016-10-08 20:56 ` Henning Hraban Ramm
@ 2016-10-09 13:49 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2016-10-09 13:49 UTC (permalink / raw)
  To: ntg-context

On 10/8/2016 10:41 PM, Henning Hraban Ramm wrote:
> Hi all,
>
> I’m trying to write some dimensions to a file, e.g.
>
> \startluacode
> io.savedata("settings.txt", context("\\textwidth"))
> \stopluacode
>
> But that context() construct is nil.
> There’s probably a simple solution... ;)

\starttext

\startluacode
     io.savedata("settings.txt", number.topoints(tex.dimen.textwidth))
\stopluacode

\typefile{settings.txt}

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-09 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-08 20:41 Access ConTeXt dimensions in Lua Henning Hraban Ramm
2016-10-08 20:56 ` Henning Hraban Ramm
2016-10-09 13:49 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).