[luatex] lua equivalent of vbox...ht

luigi scarso luigi.scarso at gmail.com
Mon Sep 14 14:48:04 CEST 2009


On Sun, Sep 13, 2009 at 9:21 PM, Patrick Gundlach <patrick at gundla.ch> wrote:
> Hello all,
>
>>> what would be the lua equivalent of
>>>
>>> \setbox0\vbox{hello world}
>>> \the\ht0
>>>
>>> ? That is, what would I write inside \directlua{ ... } to get the same
>>> effect?
>>>
>>> Pseudo code appreciated.

\starttext
\directlua{
% create to glyph nodes
T=node.new(37)
T.char=84
T.font=1

E=node.new(37)
E.char=69
E.font=1

X=node.new(37)
X.char=88
X.font=1


space=node.new(37)
space.char=32
space.font=1


head=node.hpack(T)
head.dir = 'TLT'
h,n=node.insert_after(head,T,E)
h,n=node.insert_after(head,E,X)
head.width = 1451240

tex.setbox(0,head)

texio.write_nl(tex.wd[0])
}

\framed{\box0}
\stoptext

It's not correct -- I must set head.width = 1451240 by try and error

-- 
luigi


More information about the luatex mailing list