summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/trac-jus.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-02-17 10:31:56 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-02-17 10:31:56 +0100
commitb14f992ef5f4e868c9959b174278c86516d60dbc (patch)
tree28587bb46c025ea7b0d27ba93f09c93dcf53c73a /tex/context/base/mkiv/trac-jus.lua
parent95a1799032dc61dbca4a11e495be34b4397c8fec (diff)
downloadcontext-b14f992ef5f4e868c9959b174278c86516d60dbc.tar.gz
2017-02-17 10:23:00
Diffstat (limited to 'tex/context/base/mkiv/trac-jus.lua')
-rw-r--r--tex/context/base/mkiv/trac-jus.lua42
1 files changed, 26 insertions, 16 deletions
diff --git a/tex/context/base/mkiv/trac-jus.lua b/tex/context/base/mkiv/trac-jus.lua
index 76d6438a1..6d00bf19e 100644
--- a/tex/context/base/mkiv/trac-jus.lua
+++ b/tex/context/base/mkiv/trac-jus.lua
@@ -23,11 +23,13 @@ local getlist = nuts.getlist
local getattr = nuts.getattr
local setattr = nuts.setattr
local setlist = nuts.setlist
+local setlink = nuts.setlink
+local getwidth = nuts.getwidth
+local findtail = nuts.tail
local traverse_id = nuts.traverse_id
local list_dimensions = nuts.dimensions
-local linked_nodes = nuts.linked
-local copy_node = nuts.copy
+local copy_list = nuts.copy_list
local tracedrule = nodes.tracers.pool.nuts.rule
@@ -41,12 +43,14 @@ local hlist_code = nodes.nodecodes.hlist
local texsetattribute = tex.setattribute
local unsetvalue = attributes.unsetvalue
+local enableaction = nodes.tasks.enableaction
+
local min_threshold = 0
local max_threshold = 0
local function set(n)
- nodes.tasks.enableaction("mvlbuilders", "typesetters.checkers.handler")
- nodes.tasks.enableaction("vboxbuilders","typesetters.checkers.handler")
+ enableaction("mvlbuilders", "typesetters.checkers.handler")
+ enableaction("vboxbuilders","typesetters.checkers.handler")
texsetattribute(a_justification,n or 1)
function typesetters.checkers.set(n)
texsetattribute(a_justification,n or 1)
@@ -77,7 +81,7 @@ function checkers.handler(head)
for current in traverse_id(hlist_code,tonut(head)) do
if getattr(current,a_justification) == 1 then
setattr(current,a_justification,0) -- kind of reset
- local width = getfield(current,"width")
+ local width = getwidth(current)
if width > 0 then
local list = getlist(current)
if list then
@@ -86,23 +90,29 @@ function checkers.handler(head)
if naturalwidth == 0 or delta == 0 then
-- special box
elseif delta >= max_threshold then
- local rule = tracedrule(delta,naturalheight,naturaldepth,getfield(list,"glue_set") == 1 and "trace:dr" or "trace:db")
- setlist(current,linked_nodes(list,new_hlist(rule)))
+ local rule = new_hlist(tracedrule(delta,naturalheight,naturaldepth,getfield(list,"glue_set") == 1 and "trace:dr" or "trace:db"))
+ setlink(findtail(list),rule)
+ setlist(current,list)
elseif delta <= min_threshold then
local alignstate = getattr(list,a_alignstate)
if alignstate == 1 then
- local rule = tracedrule(-delta,naturalheight,naturaldepth,"trace:dc")
- setlist(current,linked_nodes(new_hlist(rule),list))
+ local rule = new_hlist(tracedrule(-delta,naturalheight,naturaldepth,"trace:dc"))
+ setlink(rule,list)
+ setlist(current,rule)
elseif alignstate == 2 then
- local lrule = tracedrule(-delta/2,naturalheight,naturaldepth,"trace:dy")
- local rrule = copy_node(lrule)
- setlist(current,linked_nodes(new_hlist(lrule),list,new_kern(delta/2),new_hlist(rrule)))
+ local lrule = new_hlist(tracedrule(-delta/2,naturalheight,naturaldepth,"trace:dy"))
+ local rrule = copy_list(lrule)
+ setlink(lrule,list)
+ setlink(findtail(list),new_kern(delta/2),rrule)
+ setlist(current,lrule)
elseif alignstate == 3 then
- local rule = tracedrule(-delta,naturalheight,naturaldepth,"trace:dm")
- setlist(current,linked_nodes(list,new_kern(delta),new_hlist(rule)))
+ local rule = new_hlist(tracedrule(-delta,naturalheight,naturaldepth,"trace:dm"))
+ setlink(findtail(list),new_kern(delta),rule)
+ setlist(current,list)
else
- local rule = tracedrule(-delta,naturalheight,naturaldepth,"trace:dg")
- setlist(current,linked_nodes(list,new_kern(delta),new_hlist(rule)))
+ local rule = new_hlist(tracedrule(-delta,naturalheight,naturaldepth,"trace:dg"))
+ setlink(findtail(list),new_kern(delta),rule)
+ setlist(current,list)
end
end
end