diff options
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-ots.lua | 64 | ||||
-rw-r--r-- | tex/context/base/mkiv/mult-prm.lua | 4 | ||||
-rw-r--r-- | tex/context/base/mkiv/node-fin.lua | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/node-tra.lua | 96 | ||||
-rw-r--r-- | tex/context/base/mkiv/page-inj.mkvi | 10 | ||||
-rw-r--r-- | tex/context/base/mkiv/page-mix.lua | 41 | ||||
-rw-r--r-- | tex/context/base/mkiv/page-one.mkiv | 24 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 24895 -> 24888 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 251457 -> 251989 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/util-prs.lua | 4 |
12 files changed, 177 insertions, 72 deletions
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index e26f62fa3..68a07fb83 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.09.06 11:44} +\newcontextversion{2021.09.13 09:37} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 3ad868f86..159c8ebc7 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.09.06 11:44} +\edef\contextversion{2021.09.13 09:37} %D Kind of special: diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 8e8be6f95..7de108d4c 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -163,6 +163,8 @@ local trace_testruns = false registertracker("otf.testruns", function local forcediscretionaries = false local forcepairadvance = false -- for testing +local repeatablemultiples = context or false + directives.register("otf.forcediscretionaries",function(v) forcediscretionaries = v end) @@ -648,16 +650,52 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop) -- what t insertnodeafter(head,start,n) start = n end - if what == true then - -- we're ok - elseif what > 1 then - local m = multiple[nofmultiples] - for i=2,what do - local n = copy_node(start) -- ignore components - resetinjection(n) - setchar(n,m) - insertnodeafter(head,start,n) - start = n + if what ~= true and repeatablemultiples then + -- This is just some experimental code; we might introduce gsub_extensible + -- some day instead. Beware: when we have a feature that mixes alternates and + -- multiples we need to make sure we don't handle the alternate string values + -- here. This might eventually become an lmtx only feature. + local kind = type(what) + local m, f, l + if kind == "string" then + local what, n = string.match(what,"^repeat(.-)[:=](%d+)$") + if what == "middle" then + m = tonumber(n) + elseif what == "first" then + f = tonumber(n) + elseif what == "last" then + l = tonumber(n) + end + elseif kind == "table" then + -- won't happen because currently we don't split these values + m = what.middle + f = what.first + l = what.last + end + if f or m or l then + if m and m > 1 and nofmultiples == 3 then + local middle = getnext(first) + for i=2,m do + local n = copynode(middle) -- ignore components + resetinjection(n) + insertnodeafter(head,first,n) + end + end + if f and f > 1 then + for i=2,f do + local n = copynode(first) -- ignore components + resetinjection(n) + insertnodeafter(head,first,n) + end + end + if l and l > 1 then + for i=2,l do + local n = copynode(start) -- ignore components + resetinjection(n) + insertnodeafter(head,start,n) + start = n + end + end end end end @@ -1052,7 +1090,7 @@ function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode, end return head, start, true elseif trace_bugs then - -- onetimemessage(currentfont,basechar,"no base anchors",report_fonts) + -- onetimemessage(currentfont,basechar,"no base anchors") logwarning("%s: mark %s is not anchored to %s",pref(dataset,sequence),gref(markchar),gref(basechar)) end elseif trace_bugs then @@ -1118,7 +1156,7 @@ function handlers.gpos_mark2ligature(head,start,dataset,sequence,markanchors,rlm end elseif trace_bugs then -- logwarning("%s: char %s is missing in font",pref(dataset,sequence),gref(basechar)) - onetimemessage(currentfont,basechar,"no base anchors",report_fonts) + onetimemessage(currentfont,basechar,"no base anchors") end elseif trace_bugs then logwarning("%s: prev node is no char, case %i",pref(dataset,sequence),1) @@ -1858,7 +1896,7 @@ function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup, end end elseif trace_bugs then - onetimemessage(currentfont,startchar,"no entry anchors",report_fonts) + onetimemessage(currentfont,startchar,"no entry anchors") end break end diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 28a8f41de..288067563 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -401,6 +401,8 @@ return { "insertmode", "insertmultiplier", "insertprogress", + "insertstorage", + "insertstoring", "insertunbox", "insertuncopy", "insertwidth", @@ -511,6 +513,7 @@ return { "tracingexpressions", "tracingfonts", "tracinghyphenation", + "tracinginserts", "tracingmarks", "tracingmath", "undent", @@ -864,6 +867,7 @@ return { "pageshrink", "pagestretch", "pagetotal", + "pagevsize", "par", "parfillleftskip", "parfillskip", diff --git a/tex/context/base/mkiv/node-fin.lua b/tex/context/base/mkiv/node-fin.lua index 42c24378f..b9ba169dd 100644 --- a/tex/context/base/mkiv/node-fin.lua +++ b/tex/context/base/mkiv/node-fin.lua @@ -203,7 +203,7 @@ local function process(attribute,head,inheritance,default) -- one attribute current = default end elseif current ~= outer then - head = insertnodebefore(head,stack,copy_node(nsdata[c])) + head = insertnodebefore(head,stack,copy_node(nsdata[c])) -- hm, what is c ... bug current = outer end elseif default and inheritance then diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua index d3d35dae0..67435f1c7 100644 --- a/tex/context/base/mkiv/node-tra.lua +++ b/tex/context/base/mkiv/node-tra.lua @@ -77,6 +77,7 @@ local rule_code = nodecodes.rule local dir_code = nodecodes.dir local par_code = nodecodes.par local whatsit_code = nodecodes.whatsit +local passive_code = nodecodes.passive local dimenfactors = number.dimenfactors local formatters = string.formatters @@ -303,57 +304,68 @@ end nodes.showsimplelist = function(h,depth) showsimplelist(h,depth,0) end local function listtoutf(h,joiner,textonly,last,nodisc) - local w = { } - local n = 0 - local g = formatters["<%i>"] - local d = formatters["[%s|%s|%s]"] - while h do - local c, id = isglyph(h) - if c then - n = n + 1 ; w[n] = c >= 0 and utfchar(c) or g(c) - if joiner then - n = n + 1 ; w[n] = joiner - end - elseif id == disc_code then - local pre, pos, rep = getdisc(h) - if not nodisc then - n = n + 1 ; w[n] = d( - pre and listtoutf(pre,joiner,textonly) or "", - pos and listtoutf(pos,joiner,textonly) or "", - rep and listtoutf(rep,joiner,textonly) or "" - ) - elseif rep then - n = n + 1 ; w[n] = listtoutf(rep,joiner,textonly) or "" - end - if joiner then - n = n + 1 ; w[n] = joiner - end - elseif textonly then - if id == glue_code then - if getwidth(h) > 0 then - n = n + 1 ; w[n] = " " + if h then + local w = { } + local n = 0 + local g = formatters["<%i>"] + local d = formatters["[%s|%s|%s]"] + while h do + local c, id = isglyph(h) + if c then + n = n + 1 ; w[n] = c >= 0 and utfchar(c) or g(c) + if joiner then + n = n + 1 ; w[n] = joiner + end + elseif id == disc_code then + local pre, pos, rep = getdisc(h) + if not nodisc then + n = n + 1 ; w[n] = d( + pre and listtoutf(pre,joiner,textonly) or "", + pos and listtoutf(pos,joiner,textonly) or "", + rep and listtoutf(rep,joiner,textonly) or "" + ) + elseif rep then + n = n + 1 ; w[n] = listtoutf(rep,joiner,textonly) or "" + end + if joiner then + n = n + 1 ; w[n] = joiner + end + elseif id == passive_code then + -- smells like a bug in luatex + print("weird: passive node in listtoutf") + return "" + elseif textonly then + if id == glue_code then + if getwidth(h) > 0 then + n = n + 1 ; w[n] = " " + end + elseif id == hlist_code or id == vlist_code then + local l = getlist(h) + n = n + 1 ; w[n] = "[" + if l then + n = n + 1 ; w[n] = listtoutf(l,joiner,textonly,last,nodisc) + end + n = n + 1 ; w[n] = "]" end - elseif id == hlist_code or id == vlist_code then - n = n + 1 ; w[n] = "[" - n = n + 1 ; w[n] = listtoutf(getlist(h),joiner,textonly,last,nodisc) - n = n + 1 ; w[n] = "]" + else + n = n + 1 ; w[n] = "[-]" + end + if h == last then + break + else + h = getnext(h) end - else - n = n + 1 ; w[n] = "[-]" - end - if h == last then - break - else - h = getnext(h) end + return concat(w,"",1,(w[n] == joiner) and (n-1) or n) + else + return "" end - return concat(w,"",1,(w[n] == joiner) and (n-1) or n) end function nodes.listtoutf(h,joiner,textonly,last,nodisc) if h then local joiner = joiner == true and utfchar(0x200C) or joiner -- zwnj - return listtoutf(tonut(h),joiner,textonly,last and tonut(last),nodisc) + return listtoutf(tonut(h),joiner,textonly,last and tonut(last) or nil,nodisc) else return "" end diff --git a/tex/context/base/mkiv/page-inj.mkvi b/tex/context/base/mkiv/page-inj.mkvi index f1b520f5e..0adfca92d 100644 --- a/tex/context/base/mkiv/page-inj.mkvi +++ b/tex/context/base/mkiv/page-inj.mkvi @@ -33,8 +33,14 @@ \let\page_boxes_flush_after \clf_flushpageinjectionsafter \def\page_injections_flush_indeed - {\scrn_canvas_synchronize_set{\pageinjectionparameter\c!width}{\pageinjectionparameter\c!height}% - \invokepagehandler\v!normal{\inheritedpageinjectionframed{\texsetup\p_page_injectionalternative_rederingsetup}}% + {\begingroup + \setbox\scratchbox\normalhpack + {\inheritedpageinjectionframed{\texsetup\p_page_injectionalternative_rederingsetup}}% + \printpaperwidth \wd\scratchbox + \printpaperheight\ht\scratchbox + \scrn_canvas_synchronize_only + \invokepagehandler\v!normal{\box\scratchbox}% + \endgroup \scrn_canvas_synchronize_reset} \def\page_injections_flush_saved#name#parameters% diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua index 7828b7e56..a4e08063d 100644 --- a/tex/context/base/mkiv/page-mix.lua +++ b/tex/context/base/mkiv/page-mix.lua @@ -251,12 +251,19 @@ local function preparesplit(specification) -- a rather large function report_state("fatal error, no list") return end - local head = getlist(list) or specification.originalhead + local head = nil + if getid(list) == hlist_code then + head = list + else + head = getlist(list) or specification.originalhead + end if not head then report_state("fatal error, no head") return end + slidenodes(head) -- we can have set prev's to nil to prevent backtracking + local discarded = { } local originalhead = head local originalwidth = specification.originalwidth or getwidth(list) @@ -441,6 +448,7 @@ local function preparesplit(specification) -- a rather large function if column == nofcolumns then column = 0 -- nicer in trace rest = head +-- rest = nil return false, 0 else local skipped @@ -637,7 +645,6 @@ local function preparesplit(specification) -- a rather large function end local function process_list(current,nxt) --- print(nuts.getpre(current),nuts.getpost(current)) local nxtid = nxt and getid(nxt) line = line + 1 local inserts, insertskips, nextskips, inserttotal = nil, 0, 0, 0 @@ -773,7 +780,6 @@ local function preparesplit(specification) -- a rather large function specification.rest = rest specification.overflow = overflow specification.discarded = discarded - setlist(getbox(specification.box)) return specification @@ -900,6 +906,7 @@ local function getsplit(result,n) end setprev(h) -- move up + local strutht = result.strutht local strutdp = result.strutdp local lineheight = strutht + strutdp @@ -908,6 +915,19 @@ local function getsplit(result,n) local v = new_vlist() setlist(v,h) + -- safeguard ... i need to figure this out some day + + local c = r.head + while c do + if c == result.rest then + report_state("flush, column %s, %s",n,"suspicous rest") + result.rest = nil + break + else + c = getnext(c) + end + end + -- local v = vpack(h,"exactly",height) if isglobal then -- option @@ -1067,7 +1087,10 @@ implement { arguments = "integer", actions = function(n) if result then - context(tonode(getsplit(result,n))) + local list = getsplit(result,n) + if list then + context(tonode(list)) + end end end, } @@ -1085,7 +1108,10 @@ implement { name = "mixflushrest", actions = function() if result then - context(tonode(getrest(result))) + local rest = getrest(result) + if rest then + context(tonode(rest)) + end end end } @@ -1094,7 +1120,10 @@ implement { name = "mixflushlist", actions = function() if result then - context(tonode(getlist(result))) + local list = getlist(result) + if list then + context(tonode(list)) + end end end } diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv index 54e53035f..dbed7429a 100644 --- a/tex/context/base/mkiv/page-one.mkiv +++ b/tex/context/base/mkiv/page-one.mkiv @@ -63,6 +63,22 @@ % \fi % \fi} +% \unexpanded\def\page_one_command_set_vsize +% {\ifgridsnapping +% \ifcase\layoutlines +% \getrawnoflines\textheight +% \else +% \noflines\layoutlines +% \fi +% \global\vsize\noflines\openlineheight +% \else +% \global\vsize\textheight +% \fi +% \global\advance\vsize\d_page_adapts_delta +% % alternatively we could set it in builders.buildpage_filter +% % \ifdim\pagegoal<\maxdimen .. \fi +% \pagegoal\dimexpr\vsize-\d_page_floats_inserted_top-\d_page_floats_inserted_bottom\relax} + \unexpanded\def\page_one_command_set_vsize {\ifgridsnapping \ifcase\layoutlines @@ -75,10 +91,10 @@ \global\vsize\textheight \fi \global\advance\vsize\d_page_adapts_delta - % alternatively we could set it in builders.buildpage_filter - % \ifdim\pagegoal<\maxdimen .. \fi - \pagegoal\dimexpr\vsize-\d_page_floats_inserted_top-\d_page_floats_inserted_bottom\relax} - + % \pagegoal\dimexpr\vsize-\d_page_floats_inserted_top-\d_page_floats_inserted_bottom\relax} + % per 2021/9/9 : otherwise weird notes overlap with side floats + \settotalinsertionheight + \pagegoal\dimexpr\vsize-\totalinsertionheight\relax} % 1 = partial page, 2 = whole page, 3 = partial page diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 9c9066b38..2eaad3b9c 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 3812c41a2..05e942bc1 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/util-prs.lua b/tex/context/base/mkiv/util-prs.lua index 6fcc66082..f74bc3b12 100644 --- a/tex/context/base/mkiv/util-prs.lua +++ b/tex/context/base/mkiv/util-prs.lua @@ -572,9 +572,9 @@ end -- "1","2","3","4" -- "5","6","7","8" -- ]] --- + -- local mycsvsplitter = parsers.csvsplitter { numbers = true } --- + -- local list = mycsvsplitter(crap) inspect(list) -- and this is a slightly patched version of a version posted by Philipp Gesang |