summaryrefslogtreecommitdiff
path: root/tex/context/base/pack-rul.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2009-06-02 09:30:00 +0200
committerHans Hagen <pragma@wxs.nl>2009-06-02 09:30:00 +0200
commit40e5e0f114c759b17af50cde80677a9612d4d41b (patch)
tree298cb442e1d4f8352e10278ccf7e8b105d98f922 /tex/context/base/pack-rul.lua
parent1d3090326210c6e6f7ec5432799ded25b75bba46 (diff)
downloadcontext-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.lua42
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