[luatex] lua equivalent of vbox...ht

luigi scarso luigi.scarso at gmail.com
Fri Sep 18 15:26:40 CEST 2009


>
> anyhow, here's an example ...
>
> \starttext
>
> \startluacode
>    function mylist(str,fontid,spacing)
>        local head, prev = nil, nil
>        for s in string.utfvalues(str) do
>            local next
>             if spacing and s == 32 then
>                next = node.new(node.id("glue"))
>                next.spec = node.new(node.id("glue_spec"))
>                next.spec.width = spacing or 64*1024*10
>            else
>                next = node.new(node.id("glyph"))
>                next.char = s
>                next.font = fontid or 1
>            end
>            if not head then
>                head = next
>            else
>                prev.next = next
>                next.prev = prev
>            end
>            prev = next
>        end
>        return head
>    end
>    function myhpack(str,fontid,spacing)
>        return node.hpack(mylist(str,fontid,spacing))
>    end
>    function myvpack(str,fontid,spacing)
>        -- vpack is just a hack, and a proper implentation is on the agenda
>        -- as it needs more info etc than currently available
>    end
>    node.write(myhpack("Hello World!"))
>    node.write(myhpack("Hello World!",1,100*1024*10))
>
> \stopluacode
>
> \stoptext
>
> Don't expect vpack to work before the par builder is opened up (all those
> parameters).
>
> I'll start adding some examples to the context mkiv code base.

Cool...

-- 
luigi


More information about the luatex mailing list