From edbd5c8a6bd0b15d3b506debbcd8fdea1baedb4a Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 28 Nov 2013 19:20:13 +0200 Subject: beta 2013.11.28 17:55 --- scripts/context/lua/mtxrun.lua | 14 +- scripts/context/stubs/mswin/mtxrun.lua | 14 +- scripts/context/stubs/unix/mtxrun | 14 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4131 -> 4133 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/node-tra.lua | 4 +- tex/context/base/page-mix.lua | 148 +++++++++------------ tex/context/base/page-mix.mkiv | 2 +- tex/context/base/spac-par.mkiv | 36 +++-- tex/context/base/spac-ver.lua | 71 ++++++++-- tex/context/base/spac-ver.mkiv | 10 +- tex/context/base/status-files.pdf | Bin 24718 -> 24686 bytes tex/context/base/status-lua.pdf | Bin 227291 -> 227366 bytes tex/context/base/strc-des.mkvi | 2 +- tex/context/base/strc-mar.lua | 79 ++++++----- tex/context/base/strc-reg.mkiv | 21 +-- tex/context/base/tabl-ntb.mkiv | 2 + tex/context/base/tabl-tbl.mkiv | 8 ++ tex/context/base/util-lib.lua | 10 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 21 files changed, 270 insertions(+), 171 deletions(-) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 769fac104..6b736737a 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -16218,7 +16218,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 11340, stripped down to: 5739 +-- original size: 11549, stripped down to: 5905 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -16372,6 +16372,7 @@ function require(name,version) end end local swiglibs={} +local initializer="core" function swiglib(name,version) local library=swiglibs[name] if not library then @@ -16379,7 +16380,12 @@ function swiglib(name,version) if trace_swiglib then report_swiglib("loading %a",name) end - library=requireswiglib("swiglib."..name,version) + if not find(name,"%."..initializer.."$") then + fullname="swiglib."..name.."."..initializer + else + fullname="swiglib."..name + end + library=requireswiglib(fullname,version) swiglibs[name]=library statistics.stoptiming(swiglibs) end @@ -16635,8 +16641,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 683893 --- stripped bytes : 242080 +-- original bytes : 684102 +-- stripped bytes : 242123 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 769fac104..6b736737a 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -16218,7 +16218,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 11340, stripped down to: 5739 +-- original size: 11549, stripped down to: 5905 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -16372,6 +16372,7 @@ function require(name,version) end end local swiglibs={} +local initializer="core" function swiglib(name,version) local library=swiglibs[name] if not library then @@ -16379,7 +16380,12 @@ function swiglib(name,version) if trace_swiglib then report_swiglib("loading %a",name) end - library=requireswiglib("swiglib."..name,version) + if not find(name,"%."..initializer.."$") then + fullname="swiglib."..name.."."..initializer + else + fullname="swiglib."..name + end + library=requireswiglib(fullname,version) swiglibs[name]=library statistics.stoptiming(swiglibs) end @@ -16635,8 +16641,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 683893 --- stripped bytes : 242080 +-- original bytes : 684102 +-- stripped bytes : 242123 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 769fac104..6b736737a 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -16218,7 +16218,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 11340, stripped down to: 5739 +-- original size: 11549, stripped down to: 5905 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -16372,6 +16372,7 @@ function require(name,version) end end local swiglibs={} +local initializer="core" function swiglib(name,version) local library=swiglibs[name] if not library then @@ -16379,7 +16380,12 @@ function swiglib(name,version) if trace_swiglib then report_swiglib("loading %a",name) end - library=requireswiglib("swiglib."..name,version) + if not find(name,"%."..initializer.."$") then + fullname="swiglib."..name.."."..initializer + else + fullname="swiglib."..name + end + library=requireswiglib(fullname,version) swiglibs[name]=library statistics.stoptiming(swiglibs) end @@ -16635,8 +16641,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 683893 --- stripped bytes : 242080 +-- original bytes : 684102 +-- stripped bytes : 242123 -- end library merge diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 0b586f110..46681c7f4 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.11.26 20:09} +\newcontextversion{2013.11.28 17:55} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 1791aba53..9db754454 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index c6cfb97ba..cc1bfa7a3 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.11.26 20:09} +\edef\contextversion{2013.11.28 17:55} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua index 9fe979e93..9617f7476 100644 --- a/tex/context/base/node-tra.lua +++ b/tex/context/base/node-tra.lua @@ -97,7 +97,7 @@ function nodes.handlers.checkforleaks(sparse) end node.flush_list(q) for k, v in next, l do - write_nl(formatters["%s * %s"](v,k)) + report_nodes("%s * %s",v,k) end end @@ -231,7 +231,7 @@ end local function showsimplelist(h,depth,n) while h do - write_nl(rep(" ",n) .. tostring(h)) + report_nodes("% w%s",n,d_tostring(h)) if not depth or n < depth then local id = h.id if id == hlist_code or id == vlist_code then diff --git a/tex/context/base/page-mix.lua b/tex/context/base/page-mix.lua index 7a97655d2..f8f4c8378 100644 --- a/tex/context/base/page-mix.lua +++ b/tex/context/base/page-mix.lua @@ -149,6 +149,9 @@ local function discardtopglue(current,discarded) break end end + if current then + current.prev = nil + end return current, size end @@ -256,20 +259,44 @@ local function setsplit(specification) -- a rather large function } end - local column = 1 - local line = 0 - local result = results[1] - local lasthead = nil - local rest = nil + local column = 1 + local line = 0 + local result = results[1] + local lasthead = nil + local rest = nil + local lastlocked = nil + local lastcurrent = nil + local backtracked = false if trace_state then report_state("setting collector to column %s",column) end - local lastlocked = nil - local lastcurrent = nil - - local backtracked = false + local function backtrack(start) + local current = start + -- first skip over glue and penalty + while current do + local id = current.id + if id == glue_code or id == penalty_code then + current = current.prev + else + break + end + end + -- then skip over content + while current do + local id = current.id + if id == glue_code or id == penalty_code then + break + else + current = current.prev + end + end + if not current then + current = start + end + return current + end local function gotonext() if lastcurrent then @@ -278,7 +305,7 @@ local function setsplit(specification) -- a rather large function report_state("backtracking to preferred break in column %s",column) end -- todo: also remember height/depth - current = lastcurrent + current = backtrack(lastcurrent) backtracked = true end lastcurrent = nil @@ -360,37 +387,26 @@ local function setsplit(specification) -- a rather large function local function process_skip(current,nxt) local advance = current.spec.width - local prv = current.prev - if prv.id == penalty_code then - local penalty = prv.penalty - if penalty < 4000 then - lastlocked = nil - lastcurrent = nil + if advance ~= 0 then + local state, skipped = checked(advance,"glue") + if trace_state then + report_state("%-7s > column %s, state %a, advance %p, height %p","glue",column,state,advance,height) + if skipped ~= 0 then + report_state("%-7s > column %s, discarded %p","glue",column,skipped) end - elseif current.subtype ~= lineskip_code then - lastlocked = nil - lastcurrent = nil end - if advance ~= 0 then - local state, skipped = checked(advance,"glue") - if trace_state then - report_state("%-7s > column %s, state %a, advance %p, height %p","glue",column,state,advance,height) - if skipped ~= 0 then - report_state("%-7s > column %s, discarded %p","glue",column,skipped) - end - end - if state == "quit" then - return true - end - height = height + depth + skip - depth = 0 - skip = height > 0 and advance or 0 - if trace_state then - report_state("%-7s > column %s, height %p, depth %p, skip %p","glue",column,height,depth,skip) - end - else - -- what else? ignore? treat as valid as usual? + if state == "quit" then + return true + end + height = height + depth + skip + depth = 0 + skip = height > 0 and advance or 0 + if trace_state then + report_state("%-7s > column %s, height %p, depth %p, skip %p","glue",column,height,depth,skip) end + else + -- what else? ignore? treat as valid as usual? + end end local function process_kern(current,nxt) @@ -443,53 +459,6 @@ local function setsplit(specification) -- a rather large function -- become installable -- -- [chapter] [penalty] [section] [penalty] [first line] - -- - -- we need some nice use cases so the next is just for me to play with - - -- todo: presets: - -- - -- fixed : criterium=4000 check=no - -- large : criterium=4000 check=more - -- auto : criterium=0 check=more - - local lockcriterium = 4000 - - local function prevprev(current) - local p = current.prev - return p and p.prev - end - - local function reassess(current,penalty) - if splitmethod == v_fixed then - -- quite ok, a magic number: used as samepage (in sectioning) - if penalty >= lockcriterium then - if not lastlocked then - lastcurrent = prevprev(current) - lastlocked = lastcurrent and penalty - end - return - end - elseif splitmethod == v_more then - -- experiment, might change - if penalty >= lockcriterium then - if not lastlocked or penalty >= lastlocked then - lastcurrent = prevprev(current) - lastlocked = lastcurrent and penalty - end - return - end - elseif splitmethod == v_auto then - if penalty > 0 then - if not lastlocked or penalty > lastlocked then - lastcurrent = prevprev(current) - lastlocked = lastcurrent and penalty - end - return - end - end - lastlocked = nil - lastcurrent = nil - end local function process_penalty(current,nxt) local penalty = current.penalty @@ -520,8 +489,13 @@ local function setsplit(specification) -- a rather large function -- we don't care too much lastlocked = nil lastcurrent = nil - elseif splitmethod then - reassess(current,penalty) + elseif penalty >= 10000 then + if not lastcurrent then + lastcurrent = current + lastlocked = penalty + elseif penalty > lastlocked then + lastlocked = penalty + end else lastlocked = nil lastcurrent = nil diff --git a/tex/context/base/page-mix.mkiv b/tex/context/base/page-mix.mkiv index fe16be23c..897046dea 100644 --- a/tex/context/base/page-mix.mkiv +++ b/tex/context/base/page-mix.mkiv @@ -739,7 +739,7 @@ % \global\setfalse\c_page_floats_room % \else \global\settrue\c_page_floats_room - \fi + \fi\fi \ifdim\floatwidth>\hsize \showmessage\m!columns{11}\empty \global\setfalse\c_page_floats_room diff --git a/tex/context/base/spac-par.mkiv b/tex/context/base/spac-par.mkiv index b6116eb01..da347c5ba 100644 --- a/tex/context/base/spac-par.mkiv +++ b/tex/context/base/spac-par.mkiv @@ -185,23 +185,41 @@ \let\flushpostponednodedata\relax % hook into everypar -\newbox\b_spac_postponed_data +\newbox \b_spac_postponed_data +\newcount\c_spac_postponed_data + +\installcorenamespace {postponednodesstack} + +\initializeboxstack\??postponednodesstack + +\unexpanded\def\pushpostponednodedata + {\global\advance\c_spac_postponed_data\plusone + \savebox\??postponednodesstack{\the\c_spac_postponed_data}{\box\b_spac_postponed_data}} + +\unexpanded\def\poppostponednodedata + {\global\setbox\b_spac_postponed_data\hbox{\foundbox\??postponednodesstack{\the\c_spac_postponed_data}}% + \global\advance\c_spac_postponed_data\minusone + \ifvoid\b_spac_postponed_data\else + \glet\flushpostponednodedata\spac_postponed_data_flush + \fi} \unexpanded\def\flushatnextpar {\begingroup - \glet\flushpostponednodedata\spac_postponed_flush - \dowithnextboxcs\spac_postponed_finish\hbox} + \glet\flushpostponednodedata\spac_postponed_data_flush + \dowithnextboxcs\spac_postponed_data_finish\hbox} -\def\spac_postponed_finish +\def\spac_postponed_data_finish {\global\setbox\b_spac_postponed_data\hbox % to\zeropoint {\box\b_spac_postponed_data\box\nextbox}% \endgroup} -\def\spac_postponed_flush - {\ifvoid\b_spac_postponed_data\else - \hbox{\smashedbox\b_spac_postponed_data}% \box\b_spac_postponed_data - \fi - \glet\flushpostponednodedata\relax} +\def\spac_postponed_data_flush + {%\iftrialtypesetting \else + \ifvoid\b_spac_postponed_data\else + \hbox{\smashedbox\b_spac_postponed_data}% \box\b_spac_postponed_data + \fi + \glet\flushpostponednodedata\relax + }%\fi} \unexpanded\def\doflushatpar {\ifvmode diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 7bca7e8a1..0035c4119 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -34,8 +34,9 @@ local P, C, R, S, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cc local nodes, node, trackers, attributes, context, commands, tex = nodes, node, trackers, attributes, context, commands, tex ------ texlists = tex.lists +local texlists = tex.lists local texgetdimen = tex.getdimen +local texnest = tex.nest local texgetbox = tex.getbox local variables = interfaces.variables @@ -87,6 +88,7 @@ local new_gluespec = nodepool.gluespec local nodecodes = nodes.nodecodes local skipcodes = nodes.skipcodes +local whatsitcodes = nodes.whatsitcodes local penalty_code = nodecodes.penalty local kern_code = nodecodes.kern @@ -95,8 +97,6 @@ local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local whatsit_code = nodecodes.whatsit -local texnest = tex.nest - local vspacing = builders.vspacing or { } builders.vspacing = vspacing @@ -279,7 +279,7 @@ local function snap_hlist(where,current,method,height,depth) -- method.strut is local list = current.list local t = trace_vsnapping and { } if t then - t[#t+1] = formatters["list content: %s"](nodes.toutf(list)) + t[#t+1] = formatters["list content: %s"](listtoutf(list)) t[#t+1] = formatters["parent id: %s"](reference(current)) t[#t+1] = formatters["snap method: %s"](method.name) t[#t+1] = formatters["specification: %s"](method.specification) @@ -788,7 +788,17 @@ end -- I need to figure out how to deal with the prevdepth that crosses pages. In fact, -- prevdepth is often quite interfering (even over a next paragraph) so I need to --- figure out a trick. +-- figure out a trick. Maybe use something other than a rule. If we visualize we'll +-- see the baselineskip in action: +-- +-- \blank[force,5*big] { \baselineskip1cm xxxxxxxxx \par } \page +-- \blank[force,5*big] { \baselineskip1cm xxxxxxxxx \par } \page +-- \blank[force,5*big] { \baselineskip5cm xxxxxxxxx \par } \page + +-- We can register and copy the rule instead. + +local w, h, d = 0, 0, 0 +----- w, h, d = 100*65536, 65536, 65536 local function forced_skip(head,current,width,where,trace) if head == current and head.subtype == baselineskip_code then @@ -797,14 +807,14 @@ local function forced_skip(head,current,width,where,trace) if width == 0 then -- do nothing elseif where == "after" then - head, current = insert_node_after(head,current,new_rule(0,0,0)) + head, current = insert_node_after(head,current,new_rule(w,h,d)) head, current = insert_node_after(head,current,new_kern(width)) - head, current = insert_node_after(head,current,new_rule(0,0,0)) + head, current = insert_node_after(head,current,new_rule(w,h,d)) else local c = current - head, current = insert_node_before(head,current,new_rule(0,0,0)) + head, current = insert_node_before(head,current,new_rule(w,h,d)) head, current = insert_node_before(head,current,new_kern(width)) - head, current = insert_node_before(head,current,new_rule(0,0,0)) + head, current = insert_node_before(head,current,new_rule(w,h,d)) current = c end if trace then @@ -817,6 +827,36 @@ end local discard, largest, force, penalty, add, disable, nowhite, goback, together = 0, 1, 2, 3, 4, 5, 6, 7, 8 -- move into function when upvalue 60 issue +-- [whatsits][hlist][glue][glue][penalty] + +local special_penalty_min = 32250 +local special_penalty_max = 35000 + +local function specialpenalty(start,penalty) + -- nodes.showsimplelist(texlists.page_head,1) + local current = find_node_tail(texlists.page_head) + while current do + local id = current.id + if id == glue_code then + current = current.prev + elseif id == penalty_code then + local p = current.penalty + if p == penalty then + if trace_vspacing then + report_vspacing("overloading penalty %a",p) + end + return current + elseif p >= 10000 then + current = current.prev + else + break + end + else + current = current.prev + end + end +end + local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also pass tail if trace then reset_tracing(head) @@ -921,6 +961,14 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also local so = current[a_skiporder] or 1 -- has 1 default, no unset (yet) local sp = current[a_skippenalty] -- has no default, no unset (yet) if sp and sc == penalty then + +if where == "page" and sp >= special_penalty_min and sp <= special_penalty_max then + local previousspecial = specialpenalty(current,sp) + if previousspecial then + previousspecial.penalty = 0 + sp = 0 + end +end if not penalty_data then penalty_data = sp elseif penalty_order < so then @@ -938,6 +986,7 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also current = current.next else -- not look back across head +-- todo: prev can be whatsit (latelua) local previous = current.prev if previous and previous.id == glue_code and previous.subtype == userskip_code then local ps = previous.spec @@ -1216,12 +1265,16 @@ local function report(message,lst) report_vspacing(message,count_nodes(lst,true),nodeidstostring(lst)) end +-- ugly code: we get partial lists (check if this stack is still okay) ... and we run +-- into temp nodes (sigh) + function vspacing.pagehandler(newhead,where) -- local newhead = texlists.contrib_head if newhead then local newtail = find_node_tail(newhead) -- best pass that tail, known anyway local flush = false stackhack = true -- todo: only when grid snapping once enabled + -- todo: fast check if head = tail for n in traverse_nodes(newhead) do -- we could just look for glue nodes local id = n.id if id ~= glue_code then diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index f535a59f6..afa722cfe 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -1873,8 +1873,14 @@ \definevspacing[\s!default] [\v!white] % was big for a while -\dorecurse{10} % todo: other values < 4000 - {\normalexpanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr4000+250*\recurselevel\relax]}} +% \dorecurse{10} % todo: other values < 4000 +% {\normalexpanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr4000+250*\recurselevel\relax]}} + +\newcount\c_spac_vspacing_special_base \c_spac_vspacing_special_base = 32250 % 4000 +\newcount\c_spac_vspacing_special_step \c_spac_vspacing_special_step = 10 % 250 + +\dorecurse{10} + {\normalexpanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr\c_spac_vspacing_special_base+\c_spac_vspacing_special_step*\recurselevel\relax]}} \definevspacing[\v!default] [\v!big] % todo: needs to adapt to \setupblank \definevspacing[\v!before] [\v!default] % but we need to avoid circular references diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 34c37c3bc..5c49499cd 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 99eb8b909..87fc656bb 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-des.mkvi b/tex/context/base/strc-des.mkvi index 5635ff0df..9c4d3fc6d 100644 --- a/tex/context/base/strc-des.mkvi +++ b/tex/context/base/strc-des.mkvi @@ -239,7 +239,7 @@ \c!style=\v!normal, \c!color=, \c!width=\v!broad, - \c!sample=\hskip4\emwidth, + \c!sample=\kern4\emwidth, % was \hskip but that no longer is okay \c!before=, \c!after=] diff --git a/tex/context/base/strc-mar.lua b/tex/context/base/strc-mar.lua index 02d676fb9..b3a6e8f35 100644 --- a/tex/context/base/strc-mar.lua +++ b/tex/context/base/strc-mar.lua @@ -19,13 +19,12 @@ local commands = commands local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex +local traversenodes = nodes.traverse local nodecodes = nodes.nodecodes local glyph_code = nodecodes.glyph local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist -local traversenodes = nodes.traverse - local texsetattribute = tex.setattribute local texgetbox = tex.getbox @@ -66,6 +65,10 @@ local lists = structures.lists local settings_to_array = utilities.parsers.settings_to_array +local boxes_too = false -- at some point we can also tag boxes or use a zero char + +directives.register("marks.boxestoo", function(v) boxes_too = v end) + marks.data = marks.data or allocate() storage.register("structures/marks/data", marks.data, "structures.marks.data") @@ -114,13 +117,15 @@ local function sweep(head,first,last) last = a end elseif id == hlist_code or id == vlist_code then - local a = n[a_marks] - if not a then - -- next - elseif first == 0 then - first, last = a, a - elseif a > last then - last = a + if boxes_too then + local a = n[a_marks] + if not a then + -- next + elseif first == 0 then + first, last = a, a + elseif a > last then + last = a + end end local list = n.list if list then @@ -528,20 +533,22 @@ local function do_first(name,range,check) report_marks("action %a, name %a, range %a","resolving first",name,range) end local f_value, f_index, f_found = doresolve(name,range,false,0,0,check) - if trace_marks_get then - report_marks("action %a, name %a, range %a","resolving last",name,range) - end - local l_value, l_index, l_found = doresolve(name,range,true ,0,0,check) - if f_found and l_found and l_index > f_index then - local name = parentname(name) - for i=f_index,l_index,1 do - local si = stack[i] - local sn = si[name] - if sn and sn ~= false and sn ~= true and sn ~= "" and sn ~= f_value then - if trace_marks_get then - report_marks("action %a, name %a, range %a, index %a, value %a","resolving",name,range,i,sn) + if f_found then + if trace_marks_get then + report_marks("action %a, name %a, range %a","resolving last",name,range) + end + local l_value, l_index, l_found = doresolve(name,range,true ,0,0,check) + if l_found and l_index > f_index then + local name = parentname(name) + for i=f_index,l_index,1 do + local si = stack[i] + local sn = si[name] + if sn and sn ~= false and sn ~= true and sn ~= "" and sn ~= f_value then + if trace_marks_get then + report_marks("action %a, name %a, range %a, index %a, value %a","resolving",name,range,i,sn) + end + return sn, i, si end - return sn, i, si end end end @@ -552,24 +559,26 @@ local function do_first(name,range,check) end local function do_last(name,range,check) - if trace_marks_get then - report_marks("action %a, name %a, range %a","resolving first",name,range) - end - local f_value, f_index, f_found = doresolve(name,range,false,0,0,check) if trace_marks_get then report_marks("action %a, name %a, range %a","resolving last",name,range) end local l_value, l_index, l_found = doresolve(name,range,true ,0,0,check) - if f_found and l_found and l_index > f_index then - local name = parentname(name) - for i=l_index,f_index,-1 do - local si = stack[i] - local sn = si[name] - if sn and sn ~= false and sn ~= true and sn ~= "" and sn ~= l_value then - if trace_marks_get then - report_marks("action %a, name %a, range %a, index %a, value %a","resolving",name,range,i,sn) + if l_found then + if trace_marks_get then + report_marks("action %a, name %a, range %a","resolving first",name,range) + end + local f_value, f_index, f_found = doresolve(name,range,false,0,0,check) + if f_found and l_index > f_index then + local name = parentname(name) + for i=l_index,f_index,-1 do + local si = stack[i] + local sn = si[name] + if sn and sn ~= false and sn ~= true and sn ~= "" and sn ~= l_value then + if trace_marks_get then + report_marks("action %a, name %a, range %a, index %a, value %a","resolving",name,range,i,sn) + end + return sn, i, si end - return sn, i, si end end end diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index febb4c0b0..2d28114c3 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -773,17 +773,12 @@ \dostoptagged \dostoptagged} -\unexpanded\def\doapplyregisterentrycommand#1#2% processor text - {\dostarttagged\t!registerentry\empty - \ifx\currentregisterseeindex\empty \else - \dontleavehmode - \dosetdirectpagereference{seeindex:\currentregisterseeindex}% maybe some day we will support an area - \fi - \applyprocessor{#1}{\registerparameter\c!textcommand{\limitedregisterentry{\registerparameter\c!deeptextcommand{#2}}}}% - \dostoptagged} +\let\strc_register_injector_process\relax +\let\strc_register_injector_show \relax \unexpanded\def\defaultregisterentry#1#2#3#4% #1:processor #2:internal #3:seeindex #4:word {\def\currentregisterpageindex{#2}% + \strc_register_injector_process \iflocation \def\currentregisterseeindex{#3}% \doifelse{\registerparameter\c!interaction}\v!text @@ -794,6 +789,16 @@ \doapplyregisterentrycommand{#1}{#4}% \fi} +\unexpanded\def\doapplyregisterentrycommand#1#2% processor text + {\dostarttagged\t!registerentry\empty + \ifx\currentregisterseeindex\empty \else + \dontleavehmode + \strc_register_injector_show + \dosetdirectpagereference{seeindex:\currentregisterseeindex}% maybe some day we will support an area + \fi + \applyprocessor{#1}{\registerparameter\c!textcommand{\limitedregisterentry{\registerparameter\c!deeptextcommand{#2}}}}% + \dostoptagged} + \unexpanded\def\doapplyregisterseecommand#1#2% {\ifx\currentregisterseeindex\empty % \dontleavehmode diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv index 2db908f8e..a1ae94712 100644 --- a/tex/context/base/tabl-ntb.mkiv +++ b/tex/context/base/tabl-ntb.mkiv @@ -842,6 +842,7 @@ {\tabl_ntb_table_push % box not here \bgroup + \pushpostponednodedata \t_tabl_ntb_head\emptytoks \t_tabl_ntb_next\emptytoks \t_tabl_ntb_body\emptytoks @@ -952,6 +953,7 @@ % \par}% % \blank % \fi + \poppostponednodedata \egroup \tabl_ntb_table_pop} diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index 7a58182aa..309e71bd0 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -834,6 +834,13 @@ \global\d_tabl_tabulate_splitoff_betweenskip\lastskip \fi}} +\installtexdirective + {tabulate.linenumbers} + {\def\tabl_tabulate_check_linenumbers{\page_postprocessors_linenumbers_deepbox\b_tabl_tabulate}} + {\let\tabl_tabulate_check_linenumbers\relax} + +\let\tabl_tabulate_check_linenumbers\relax + \def\tabl_tabulate_splitoff_box {\dontcomplain \global\setbox\b_tabl_tabulate\vsplit\b_tabl_tabulate_current\c_tabl_tabulate_column to \lineheight % % % global ? % % % @@ -846,6 +853,7 @@ \setbox\b_tabl_tabulate\hbox to \wd\b_tabl_tabulate {\hss\tabl_tabulate_hook_yes{\box\b_tabl_tabulate}\hss}% \tabl_tabulate_normalize_splitline + \tabl_tabulate_check_linenumbers \box\b_tabl_tabulate} \unexpanded\def\tabl_tabulate_hook_nop diff --git a/tex/context/base/util-lib.lua b/tex/context/base/util-lib.lua index 301ef4e9b..2601b2e57 100644 --- a/tex/context/base/util-lib.lua +++ b/tex/context/base/util-lib.lua @@ -255,7 +255,8 @@ recommended loader. ]]-- -local swiglibs = { } +local swiglibs = { } +local initializer = "core" function swiglib(name,version) local library = swiglibs[name] @@ -264,7 +265,12 @@ function swiglib(name,version) if trace_swiglib then report_swiglib("loading %a",name) end - library = requireswiglib("swiglib." .. name,version) + if not find(name,"%." .. initializer .. "$") then + fullname = "swiglib." .. name .. "." .. initializer + else + fullname = "swiglib." .. name + end + library = requireswiglib(fullname,version) swiglibs[name] = library statistics.stoptiming(swiglibs) end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 92f8bc616..60dcdba74 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/26/13 20:09:03 +-- merge date : 11/28/13 17:55:10 do -- begin closure to overcome local limits and interference -- cgit v1.2.3