diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/node-res.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/node-res.lua | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-res.lua b/Master/texmf-dist/tex/context/base/mkiv/node-res.lua index 5b4961683ce..a27f5c4e5ff 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-res.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-res.lua @@ -96,9 +96,10 @@ local setsubtype = nuts.setsubtype local setleader = nuts.setleader local setdata = nuts.setdata +local setruledata = nuts.setruledata local setvalue = nuts.setvalue -local copy_nut = nuts.copy +local copy_nut = nuts.copy_only or nuts.copy local new_nut = nuts.new local flush_nut = nuts.flush @@ -161,8 +162,7 @@ local kern = register_nut(new_nut(kern_code,kerncodes.userkern)) local fontkern = register_nut(new_nut(kern_code,kerncodes.fontkern)) local italickern = register_nut(new_nut(kern_code,kerncodes.italiccorrection)) local penalty = register_nut(new_nut(nodecodes.penalty)) -local glue = register_nut(new_nut(glue_code)) -- glue.spec = nil -local glue_spec = register_nut(new_nut(nodecodes.gluespec)) +local glue = register_nut(new_nut(glue_code)) local glyph = register_nut(new_nut(glyph_code,0)) local textdir = register_nut(new_nut(nodecodes.dir)) @@ -172,7 +172,7 @@ local savepos = register_nut(new_nut(whatsit_code,whatsitcodes.savepos local user_node = new_nut(whatsit_code,whatsitcodes.userdefined) -if CONTEXTLMTXMODE < 2 then +if CONTEXTLMTXMODE == 0 then setfield(user_node,"type",usercodes.number) end @@ -183,6 +183,10 @@ local lineskip = register_nut(new_nut(glue_code,gluecodes.lineskip)) local baselineskip = register_nut(new_nut(glue_code,gluecodes.baselineskip)) local leftskip = register_nut(new_nut(glue_code,gluecodes.leftskip)) local rightskip = register_nut(new_nut(glue_code,gluecodes.rightskip)) +local lefthangskip = register_nut(new_nut(glue_code,gluecodes.lefthangskip)) +local righthangskip = register_nut(new_nut(glue_code,gluecodes.righthangskip)) +local indentskip = register_nut(new_nut(glue_code,gluecodes.indentskip)) +local correctionskip = register_nut(new_nut(glue_code,gluecodes.correctionskip)) local temp = register_nut(new_nut(nodecodes.temp,0)) @@ -272,15 +276,6 @@ function nutpool.italickern(k) return n end -function nutpool.gluespec(width,stretch,shrink,stretch_order,shrink_order) - -- maybe setglue - local s = copy_nut(glue_spec) - if width or stretch or shrink or stretch_order or shrink_order then - setglue(s,width,stretch,shrink,stretch_order,shrink_order) - end - return s -end - local function someskip(skip,width,stretch,shrink,stretch_order,shrink_order) -- maybe setglue local n = copy_nut(skip) @@ -328,6 +323,18 @@ function nutpool.rightskip(width,stretch,shrink,stretch_order,shrink_order) return someskip(rightskip,width,stretch,shrink,stretch_order,shrink_order) end +function nutpool.lefthangskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(lefthangskip,width,stretch,shrink,stretch_order,shrink_order) +end + +function nutpool.righthangskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(righthangskip,width,stretch,shrink,stretch_order,shrink_order) +end + +function nutpool.indentskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(indentskip,width,stretch,shrink,stretch_order,shrink_order) +end + function nutpool.lineskip(width,stretch,shrink,stretch_order,shrink_order) return someskip(lineskip,width,stretch,shrink,stretch_order,shrink_order) end @@ -344,14 +351,6 @@ function nutpool.disc(pre,post,replace) return d end -function nutpool.textdir(dir) -- obsolete ! - local t = copy_nut(textdir) - if dir then - setdir(t,dir) - end - return t -end - function nutpool.direction(dir,swap) local t = copy_nut(textdir) if not dir then @@ -394,7 +393,7 @@ function nutpool.outlinerule(width,height,depth,line) -- w/h/d == nil will let t setwhd(n,width,height,depth) end if line then - if CONTEXTLMTXMODE > 1 then setdata(n,line) else setfield(n,"transform",line) end + setruledata(n,line) end return n end @@ -414,11 +413,16 @@ function nutpool.savepos() return copy_nut(savepos) end -if CONTEXTLMTXMODE > 1 then +if CONTEXTLMTXMODE == 0 then function nutpool.latelua(code) local n = copy_nut(latelua) - nodeproperties[n] = { data = code } + if type(code) == "table" then + local action = code.action + local specification = code.specification or code + code = function() action(specification) end + end + setdata(n,code) return n end @@ -426,12 +430,7 @@ else function nutpool.latelua(code) local n = copy_nut(latelua) - if type(code) == "table" then - local action = code.action - local specification = code.specification or code - code = function() action(specification) end - end - setdata(n,code) + nodeproperties[n] = { data = code } return n end @@ -560,8 +559,7 @@ local function cleanup(nofboxes) -- todo return nr, nl, nofboxes -- can be nil end - -local function usage() +local usage = CONTEXTLMTXMODE > 0 and node.inuse or function() local t = { } for n, tag in gmatch(status.node_mem_usage,"(%d+) ([a-z_]+)") do t[tag] = tonumber(n) or 0 @@ -582,9 +580,13 @@ statistics.register("cleaned up reserved nodes", function() end) -- \topofboxstack statistics.register("node memory usage", function() -- comes after cleanup ! - local usage = status.node_mem_usage - if usage ~= "" then - return usage + local used = usage() + if next(used) then + local t, n = { }, 0 + for k, v in table.sortedhash(used) do + n = n + 1 ; t[n] = format("%s %s",v,k) + end + return table.concat(t,", ") end end) |