diff options
author | Hans Hagen <pragma@wxs.nl> | 2009-06-02 09:30:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2009-06-02 09:30:00 +0200 |
commit | 40e5e0f114c759b17af50cde80677a9612d4d41b (patch) | |
tree | 298cb442e1d4f8352e10278ccf7e8b105d98f922 /tex/context/base/pack-rul.lua | |
parent | 1d3090326210c6e6f7ec5432799ded25b75bba46 (diff) | |
download | context-40e5e0f114c759b17af50cde80677a9612d4d41b.tar.gz |
beta 2009.06.02 09:30
Diffstat (limited to 'tex/context/base/pack-rul.lua')
-rw-r--r-- | tex/context/base/pack-rul.lua | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tex/context/base/pack-rul.lua b/tex/context/base/pack-rul.lua new file mode 100644 index 000000000..11995bfed --- /dev/null +++ b/tex/context/base/pack-rul.lua @@ -0,0 +1,42 @@ +if not modules then modules = { } end modules ['pack-rul'] = { + version = 1.001, + comment = "companion to pack-rul.tex", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +--[[ldx-- +<p>An explanation is given in <t>mk.pdf</t>.</p> +--ldx]]-- + +function commands.doreshapeframedbox(n) + local noflines, lastlinelength = 0, 0 + if tex.wd[n] ~= 0 then + local hpack, free, copy = node.hpack, node.free, node.copy_list + local noflines, width, done = 0, 0, false + local list = tex.box[n].list + for h in node.traverse_id('hlist',list) do + done = true + local p = hpack(copy(h.list)) + lastlinelength = p.width + if lastlinelength > width then + width = lastlinelength + end + free(p) + end + if done then + if width ~= 0 then + for h in node.traverse_id('hlist',list) do + if h.width ~= width then + h.list = hpack(h.list,width,'exactly') + h.width = width + end + end + end + tex.wd[n] = width + end + end + tex.dimen["framedlastlength"] = lastlinelength + tex.count["framednoflines"] = noflines +end |