Patrick Gundlach wrote:
Hello Luigi, all,

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

I'll wait for Taco to get back from vacation :)

Hi Patrick and Luigi ..

(as i'm not monitoring this list constantly - as it's mostly latex issues - next ask such things on the context list)

The kind of things you're asking for (basically doing tex things at the lua end) are on the agenda but for later once the whoile machinery is opened up and it does not make much sense to run ahead of the agenda

we need to sort out backend issues, directionality, more control over the par and pagebuilder etc and as soon as something is opened up it's likely that there is a function that does similar things at the lua end (hpack is an example); ideally one would like to have expansion and typesetiing at the lua end but we're not yet there

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.

Hans




-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

Reply via email to