[luatex] vpack filter question

Patrick Gundlach patrick at gundla.ch
Wed Dec 8 15:35:33 CET 2010


Hi,

with the document below I get the hboxes correct, but the vboxes seem a bit strange to me. Can someone explain the dimensions of the vbox? Or are they just not calculated yet, so I can't use node.dimensions( <head's glue specs>, vlist) at that time?


Patrick

-------------------------------------------------------------------------------------------------------------------
\directlua{
function add_box( head,groupcode,size,packtype,direction )
  while head do
    if head.id == 0 then
      if head.list then
        local _w, _h, _d = node.dimensions(head.glue_set, head.glue_sign, head.glue_order, head.list)
        local b = node.new("whatsit","pdf_literal")
        b.data = string.format("0.2 w q 0.5 G 0 \%g \%g \%g re S Q", -_d / 65782 , _w / 65782, ( _h + _d )  / 65782 )
        b.mode = 0
        b.next = head.list
        head.list.prev = b
        head.list = b
        add_box(head.list)
      end
    elseif head.id == 1 then
      if head.list then
        local _w, _h, _d = node.dimensions(head.glue_set, head.glue_sign, head.glue_order, head.list)
        local b = node.new("whatsit","pdf_literal")
        b.data = string.format("0.2 w q 1 0 0 RG 0 \%g \%g \%g re S Q", -_d / 65782 , _w / 65782, ( _h + _d )  / 65782 )
        b.mode = 0
        b.next = head.list
        head.list.prev = b
        head.list = b
        add_box(head.list)
      end
      add_box(head.list)
    end
  head = head.next
  end
  return true
end

callback.register("vpack_filter",add_box)
}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse
molestie, lorem nec tempor condimentum, enim pede sollicitudin ante,
non mollis est lectus et ligula. Integer at libero. Fusce sagittis
magna vel libero. Sed ut quam. Sed faucibus purus in sem. Phasellus ut
nulla a neque commodo imperdiet. Morbi tempus, tortor vitae sagittis
adipiscing, magna nisl dignissim ipsum, ut sollicitudin ante ipsum non
mi. Duis quam pede, sollicitudin sit amet, auctor id, bibendum sit
amet, felis. Cum sociis natoque penatibus et magnis dis parturient
montes, nascetur ridiculus mus. Sed tortor. Aenean tincidunt, libero
et mattis posuere, magna nibh scelerisque dolor, non pharetra ligula
mi eu metus. Suspendisse et elit ac tortor porta congue. Fusce
lobortis est sit amet quam. Nam dapibus. Nam sit amet lectus. Lorem
ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur
facilisis congue elit.

\bye
-------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 21875 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20101208/dfd9123e/attachment-0001.pdf>


More information about the luatex mailing list