summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/spac-ver.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-09-18 21:00:53 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-09-18 21:00:53 +0200
commit1970df23942ba9c944ea62ff51012f4e46a32974 (patch)
tree9ab77bdd4a58619f514823a574f30aca291afc58 /tex/context/base/mkiv/spac-ver.lua
parente7dc9c1fc474fa15a2cbc34d8f543518f5853361 (diff)
downloadcontext-1970df23942ba9c944ea62ff51012f4e46a32974.tar.gz
2020-09-18 20:31:00
Diffstat (limited to 'tex/context/base/mkiv/spac-ver.lua')
-rw-r--r--tex/context/base/mkiv/spac-ver.lua61
1 files changed, 38 insertions, 23 deletions
diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua
index b2d5a3e2d..2f0d54227 100644
--- a/tex/context/base/mkiv/spac-ver.lua
+++ b/tex/context/base/mkiv/spac-ver.lua
@@ -39,6 +39,7 @@ local unpack = unpack or table.unpack
local allocate = utilities.storage.allocate
local todimen = string.todimen
local formatters = string.formatters
+local abs = math.abs
local nodes = nodes
local trackers = trackers
@@ -181,7 +182,6 @@ local gluecodes = nodes.gluecodes
local penalty_code = nodecodes.penalty
local kern_code = nodecodes.kern
local glue_code = nodecodes.glue
-local insert_code = nodecodes.ins
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
local rule_code = nodecodes.rule
@@ -2157,32 +2157,47 @@ do
end
end
- local trace = false
+ local trace = false
+ local last = nil
+ local vmode_code = tex.modelevels.vertical
+ local temp_code = nodecodes.temp
+ local getnest = tex.getnest
+ local getlist = tex.getlist
trackers.register("vspacing.forcestrutdepth",function(v) trace = v end)
- local last = nil
+ -- abs : negative is inner
- -- function vspacing.forcestrutdepth(n,depth,trace_mode,plus)
- -- local box = texgetbox(n)
- -- if box then
- -- box = tonut(box)
- -- local head = getlist(box)
- -- if head then
- -- local tail = find_node_tail(head)
- -- if tail and getid(tail) == hlist_code then
- -- local dp = getdepth(tail)
- -- if dp < depth then
- -- setdepth(tail,depth)
- -- outer.prevdepth = depth
- -- if trace or trace_mode > 0 then
- -- nuts.setvisual(tail,"depth")
- -- end
- -- end
- -- end
- -- end
- -- end
- -- end
+ function vspacing.checkstrutdepth(depth)
+ local nest = getnest()
+ if abs(nest.mode) == vmode_code and nest.head then
+ local tail = nest.tail
+ local id = tail.id
+ if id == hlist_code then
+ if tail.depth < depth then
+ tail.depth = depth
+ end
+ nest.prevdepth = depth
+ elseif id == temp_code and getnest("ptr") == 0 then
+ local head = getlist("page_head")
+ if head then
+ tail = nodes.tail(head)
+ if tail and tail.id == hlist_code then
+ if tail.depth < depth then
+ tail.depth = depth
+ end
+ nest.prevdepth = depth
+ end
+ end
+ end
+ end
+ end
+
+ interfaces.implement {
+ name = "checkstrutdepth",
+ arguments = "dimension",
+ actions = vspacing.checkstrutdepth,
+ }
function vspacing.forcestrutdepth(n,depth,trace_mode,plus)
local box = texgetbox(n)