diff options
author | Marius <mariausol@gmail.com> | 2011-02-20 22:00:14 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-02-20 22:00:14 +0200 |
commit | 3880c6aa8cef3b379b06777c09f9ce3e7e61f493 (patch) | |
tree | bcde92b4216855c15fbd77700423f5cb919c05c9 /tex/context/base/pack-rul.lua | |
parent | 21179ddb493e5c3355211e090959036cc048366b (diff) | |
download | context-3880c6aa8cef3b379b06777c09f9ce3e7e61f493.tar.gz |
beta 2011.02.20 20:34
Diffstat (limited to 'tex/context/base/pack-rul.lua')
-rw-r--r-- | tex/context/base/pack-rul.lua | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/tex/context/base/pack-rul.lua b/tex/context/base/pack-rul.lua index 378167c97..181bff234 100644 --- a/tex/context/base/pack-rul.lua +++ b/tex/context/base/pack-rul.lua @@ -10,16 +10,23 @@ if not modules then modules = { } end modules ['pack-rul'] = { <p>An explanation is given in the history document <t>mk</t>.</p> --ldx]]-- -local texdimen, texcount, texbox = tex.dimen, tex.count, tex.box +local texsetdimen, texsetcount, texbox = tex.setdimen, tex.setcount, tex.box local hpack, free, copy, traverse_id = node.hpack, node.free, node.copy_list, node.traverse_id +local texdimen, texcount = tex.dimen, tex.count + +-- fastrepack function commands.doreshapeframedbox(n) - local noflines, lastlinelength, box = 0, 0, texbox[n] + local box, noflines, firstheight, lastdepth, lastlinelength = texbox[n], 0, nil, nil, 0 if box.width ~= 0 then local list = box.list if list then local width, done = 0, false for h in traverse_id('hlist',list) do -- no dir etc needed + if not firstheight then + firstheight = h.height + end + lastdepth = h.depth local l = h.list if l then done = true @@ -48,6 +55,28 @@ function commands.doreshapeframedbox(n) end end end - texdimen["framedlastlength"] = lastlinelength - texcount["framednoflines"] = noflines +--~ print("reshape", noflines, firstheight or 0, lastdepth or 0) + texsetcount("global","framednoflines", noflines) + texsetdimen("global","framedfirstheight", firstheight or 0) + texsetdimen("global","framedlastdepth", lastdepth or 0) +end + +function commands.doanalyzeframedbox(n) + local box, noflines, firstheight, lastdepth = texbox[n], 0, nil, nil + if box.width ~= 0 then + local list = box.list + if list then + for h in traverse_id('hlist',list) do + if not firstheight then + firstheight = h.height + end + lastdepth = h.depth + noflines = noflines + 1 + end + end + end +--~ print("analyze", noflines, firstheight or 0, lastdepth or 0) + texsetcount("global","framednoflines", noflines) + texsetdimen("global","framedfirstheight", firstheight or 0) + texsetdimen("global","framedlastdepth", lastdepth or 0) end |