From b14f992ef5f4e868c9959b174278c86516d60dbc Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 17 Feb 2017 10:31:56 +0100 Subject: 2017-02-17 10:23:00 --- tex/context/base/mkiv/page-mix.lua | 56 ++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 27 deletions(-) (limited to 'tex/context/base/mkiv/page-mix.lua') diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua index 6bbc434dd..524181c8e 100644 --- a/tex/context/base/mkiv/page-mix.lua +++ b/tex/context/base/mkiv/page-mix.lua @@ -47,14 +47,17 @@ local flushnode = nuts.flush local concatnodes = nuts.concat local slidenodes = nuts.slide -- ok here as we mess with prev links intermediately -local getfield = nuts.getfield local setfield = nuts.setfield local setlink = nuts.setlink local setlist = nuts.setlist local setnext = nuts.setnext local setprev = nuts.setprev local setbox = nuts.setbox +local setwhd = nuts.setwhd +local setheight = nuts.setheight +local setdepth = nuts.setdepth +local getfield = nuts.getfield local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid @@ -63,10 +66,11 @@ local getsubtype = nuts.getsubtype local getbox = nuts.getbox local getattribute = nuts.getattribute local getwhd = nuts.getwhd -local setwhd = nuts.setwhd - -local texgetcount = tex.getcount -local texgetglue = tex.getglue +local getkern = nuts.getkern +local getpenalty = nuts.getpenalty +local getwidth = nuts.getwidth +local getheight = nuts.getheight +local getdepth = nuts.getdepth local theprop = nuts.theprop @@ -119,7 +123,7 @@ local function collectinserts(result,nxt,nxtid) if nxtid == insert_code then i = i + 1 result.i = i - inserttotal = inserttotal + getfield(nxt,"height") -- height includes depth + inserttotal = inserttotal + getheight(nxt) -- height includes depth local s = getsubtype(nxt) local c = inserts[s] if trace_detail then @@ -172,15 +176,15 @@ local function discardtopglue(current,discarded) while current do local id = getid(current) if id == glue_code then - size = size + getfield(current,"width") + size = size + getwidth(current) discarded[#discarded+1] = current current = getnext(current) elseif id == penalty_code then - if getfield(current,"penalty") == forcedbreak then + if getpenalty(current) == forcedbreak then discarded[#discarded+1] = current current = getnext(current) while current and getid(current) == glue_code do - size = size + getfield(current,"width") + size = size + getwidth(current) discarded[#discarded+1] = current current = getnext(current) end @@ -210,7 +214,7 @@ local function stripbottomglue(results,discarded) end local id = getid(t) if id == penalty_code then - if getfield(t,"penalty") == forcedbreak then + if getpenalty(t) == forcedbreak then break else discarded[#discarded+1] = t @@ -219,7 +223,7 @@ local function stripbottomglue(results,discarded) end elseif id == glue_code then discarded[#discarded+1] = t - local width = getfield(t,"width") + local width = getwidth(t) if trace_state then report_state("columns %s, discarded bottom glue %p",i,width) end @@ -256,8 +260,8 @@ local function preparesplit(specification) -- a rather large function slidenodes(head) -- we can have set prev's to nil to prevent backtracking local discarded = { } local originalhead = head - local originalwidth = specification.originalwidth or getfield(list,"width") - local originalheight = specification.originalheight or getfield(list,"height") + local originalwidth = specification.originalwidth or getwidth(list) + local originalheight = specification.originalheight or getheight(list) local current = head local skipped = 0 local height = 0 @@ -480,7 +484,7 @@ local function preparesplit(specification) -- a rather large function head = current local function process_skip(current,nxt) - local advance = getfield(current,"width") + local advance = getwidth(current) if advance ~= 0 then local state, skipped = checked(advance,"glue") if trace_state then @@ -515,7 +519,7 @@ local function preparesplit(specification) -- a rather large function end local function process_kern(current,nxt) - local advance = getfield(current,"kern") + local advance = getkern(current) if advance ~= 0 then local state, skipped = checked(advance,"kern") if trace_state then @@ -538,7 +542,7 @@ local function preparesplit(specification) -- a rather large function local function process_rule(current,nxt) -- simple variant of h|vlist - local advance = getfield(current,"height") -- + getfield(current,"depth") + local advance = getheight(current) -- + getdepth(current) if advance ~= 0 then local state, skipped = checked(advance,"rule") if trace_state then @@ -556,7 +560,7 @@ local function preparesplit(specification) -- a rather large function -- else -- height = height + currentskips -- end - depth = getfield(current,"depth") + depth = getdepth(current) skip = 0 end lastcontent = current @@ -569,7 +573,7 @@ local function preparesplit(specification) -- a rather large function -- [chapter] [penalty] [section] [penalty] [first line] local function process_penalty(current,nxt) - local penalty = getfield(current,"penalty") + local penalty = getpenalty(current) if penalty == 0 then unlock(penalty) elseif penalty == forcedbreak then @@ -783,11 +787,11 @@ local function finalize(result) local l = list[i] local h = new_hlist() t[i] = h - setlist(h,getfield(l,"head")) + setlist(h,getlist(l)) local wd, ht, dp = getwhd(l) -- here ht is still ht + dp ! - setwhd(h,getfield(h,"width"),ht,dp) - setfield(l,"head",nil) + setwhd(h,getwidth(h),ht,dp) + setlist(l) end setprev(t[1]) -- needs checking setnext(t[#t]) -- needs checking @@ -946,9 +950,7 @@ local function getsplit(result,n) dp = result.depth end - setfield(v,"width",wd) - setfield(v,"height",ht) - setfield(v,"depth",dp) + setwhd(v,wd,ht,dp) if trace_state then local id = getid(h) @@ -962,9 +964,9 @@ local function getsplit(result,n) for c, list in next, r.inserts do local l = concatnodes(list) -for i=1,#list-1 do - setfield(list[i],"depth",0) -end + for i=1,#list-1 do + setdepth(list[i],0) + end local b = vpack(l) -- multiple arguments, todo: fastvpack -- setbox("global",c,b) -- cgit v1.2.3