diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-06-09 00:47:45 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-06-09 00:47:45 +0200 |
commit | 3d8b4fe968e7b195ef57a952108b3632ecbf10b4 (patch) | |
tree | ec69b7261a79bf5874c68d3c7b364ecb97120649 | |
parent | 4a4cabe9005295cfa349269ccb6e0ffa5f9d4fb3 (diff) | |
download | context-3d8b4fe968e7b195ef57a952108b3632ecbf10b4.tar.gz |
2021-06-09 00:13:00
24 files changed, 468 insertions, 314 deletions
diff --git a/doc/context/documents/general/manuals/luametatex.pdf b/doc/context/documents/general/manuals/luametatex.pdf Binary files differindex 380e07035..3028a188f 100644 --- a/doc/context/documents/general/manuals/luametatex.pdf +++ b/doc/context/documents/general/manuals/luametatex.pdf diff --git a/scripts/context/lua/mtx-synctex.lua b/scripts/context/lua/mtx-synctex.lua index b12757240..f94a9605f 100644 --- a/scripts/context/lua/mtx-synctex.lua +++ b/scripts/context/lua/mtx-synctex.lua @@ -12,6 +12,7 @@ if not modules then modules = { } end modules ['mtx-synctex'] = { local tonumber = tonumber local find, match, gsub, formatters = string.find, string.match, string.gsub, string.formatters local isfile = lfs.isfile +local max = math.max local longtostring = string.longtostring local helpinfo = [[ @@ -27,8 +28,8 @@ local helpinfo = [[ <subcategory> <flag name="edit"><short>open file at line: --line=.. --editor=.. sourcefile</short></flag> <flag name="list"><short>show all areas: synctexfile</short></flag> - <flag name="goto"><short>open file at position: --page=.. --x=.. --y=.. --editor=.. synctexfile</short></flag> - <flag name="report"><short>show (tex) file and line: [--direct] --page=.. --x=.. --y=.. --console synctexfile</short></flag> + <flag name="goto"><short>open file at position: --page=.. --x=.. --y=.. [--tolerance=] --editor=.. synctexfile</short></flag> + <flag name="report"><short>show (tex) file and line: [--direct] --page=.. --x=.. --y=.. [--tolerance=] --console synctexfile</short></flag> <flag name="find"><short>find (pdf) page and box: [--direct] --file=.. --line=.. synctexfile</short></flag> </subcategory> </category> @@ -45,7 +46,7 @@ local application = logs.application { local report = application.report local template_show = "page=%i llx=%r lly=%r urx=%r ury=%r" -local template_goto = "filename=%a linenumber=%a" +local template_goto = "filename=%a linenumber=%a tolerance=%a" local function reportdirect(template,...) print(formatters[template](...)) @@ -53,7 +54,7 @@ end local editors = { console = function(specification) - print(string.formatters["%q %i"](specification.filename,specification.linenumber or 1)) + print(string.formatters["%q %i %i"](specification.filename,specification.linenumber or 1,specification.tolerance)) end, scite = sandbox.registerrunner { name = "scite", @@ -77,7 +78,7 @@ local function validfile(filename) end end -local function editfile(filename,line,editor) +local function editfile(filename,line,tolerance,editor) if not validfile(filename) then return end @@ -85,6 +86,7 @@ local function editfile(filename,line,editor) runner { filename = filename, linenumber = tonumber(line) or 1, + tolerance = tolerance, } end @@ -192,6 +194,125 @@ local function findlocation(filename,page,xpos,ypos) end end +local function findlocation(filename,page,xpos,ypos,tolerance) + if not validfile(filename) then + return + elseif not page then + page = 1 + elseif not xpos or not ypos then + report("provide x and y coordinates (unit: basepoints)") + return + end + local files = { } + local found = false + local skip = false + local fi = 0 + local ln = 0 + local tl = 0 + local lines = { } + for line in io.lines(filename) do + if found then + if find(line,"^}") then + local function locate(x,y) + local dx = false + local dy = false + local px = (xpos + x) / factor + local py = (ypos + y) / factor + for i=1,#lines do + local line = lines[i] + -- we only look at positive cases + local f, l, x, y, w, h, d = match(line,"^h(.-),(.-):(.-),(.-):(.-),(.-),(.-)$") + if f and f ~= 0 then +-- print(x,y,f) + x = tonumber(x) + if px >= x then + w = tonumber(w) + if px <= x + w then + y = tonumber(y) + d = tonumber(d) + if py >= y - d then + h = tonumber(h) + if py <= y + h then + if quit then + -- we have no overlapping boxes + fi = f + ln = l + return + else + local lx = px - x + local rx = x + w - px + local by = py - y + d + local ty = y + h - py + mx = lx < rx and lx or rx + my = by < ty and by or ty + if not dx then + dx = mx + dy = my + fi = f + ln = l + else + if mx < dx then + dx = mx + di = f + ln = l + end + if my < dy then + dy = my + fi = f + ln = l + end + end + end + end + end + end + end + end + end + end + locate(0,0) + if fi ~= 0 then + return files[fi], ln, 0 + end + if not tolerance then + tolerance = 10 + end + for s=1,tolerance,max(tolerance//10,1) do + locate( s, 0) if fi ~= 0 then tl = s ; goto done end + locate(-s, 0) if fi ~= 0 then tl = s ; goto done end + locate( s, s) if fi ~= 0 then tl = s ; goto done end + locate( s,-s) if fi ~= 0 then tl = s ; goto done end + locate(-s, s) if fi ~= 0 then tl = s ; goto done end + locate(-s,-s) if fi ~= 0 then tl = s ; goto done end + end + break + else + lines[#lines+1] = line + end + elseif skip then + if find(line,"^}") then + skip = false + end + elseif find(line,"^{(%d+)") then + local p = tonumber(match(line,"^{(%d+)")) + if p == page then + found = true + else + skip = true + end + elseif find(line,"^Input:") then + local id, name = match(line,"^Input:(.-):(.-)$") + if id then + files[id] = name + end + end + end + ::done:: + if fi ~= 0 then + return files[fi], ln, tl + end +end + local function showlocation(filename,sourcename,linenumber,direct) if not validfile(filename) then return @@ -244,14 +365,14 @@ local function showlocation(filename,sourcename,linenumber,direct) end end -local function gotolocation(filename,page,xpos,ypos,editor,direct) +local function gotolocation(filename,page,xpos,ypos,editor,direct,tolerance) if filename then - local target, line = findlocation(filename,tonumber(page),tonumber(xpos),tonumber(ypos)) + local target, line, t = findlocation(filename,tonumber(page),tonumber(xpos),tonumber(ypos),tonumber(tolerance)) if target and line then if editor then - editfile(target,line,editor) + editfile(target,line,t,editor) else - (direct and reportdirect or report)(template_goto,target,line) + (direct and reportdirect or report)(template_goto,target,line,t) end end end @@ -268,9 +389,9 @@ local filename = environment.files[1] if argument("edit") then editfile(filename,argument("line"),argument("editor")) elseif argument("goto") then - gotolocation(filename,argument("page"),argument("x"),argument("y"),argument("editor"),argument("direct")) + gotolocation(filename,argument("page"),argument("x"),argument("y"),argument("editor"),argument("direct"),argument("tolerance")) elseif argument("report") then - gotolocation(filename,argument("page"),argument("x"),argument("y"),"console",argument("direct")) + gotolocation(filename,argument("page"),argument("x"),argument("y"),"console",argument("direct"),argument("tolerance")) elseif argument("list") then showlocation(filename) elseif argument("find") then diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 150c7b604..e9fcb123e 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.06.07 20:01} +\newcontextversion{2021.06.09 00:11} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 27a43b3ec..65be067b4 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.06.07 20:01} +\edef\contextversion{2021.06.09 00:11} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 85b195e06..c3ae7c13e 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.06.07 20:01} +\newcontextversion{2021.06.09 00:11} %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 458df82f8..fbde307f9 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.06.07 20:01} +\edef\contextversion{2021.06.09 00:11} %D Kind of special: diff --git a/tex/context/base/mkiv/luat-cnf.lua b/tex/context/base/mkiv/luat-cnf.lua index f0b18675c..550fa5892 100644 --- a/tex/context/base/mkiv/luat-cnf.lua +++ b/tex/context/base/mkiv/luat-cnf.lua @@ -180,7 +180,7 @@ function texconfig.init() -- local b = callbytecode(i) local e, b = pcall(callbytecode,i) if not e then - print(string.format("\nfatal error : unable to load bytecode register %%i, maybe wipe the cache first\n",i)) + print(string.format("fatal error : unable to load bytecode register %%i, maybe wipe the cache first\n",i)) os.exit() end if b then diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex ccfc1e97d..383ebf0cb 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 87961ecff..998d9f26b 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 9b6307fa6..d100f8292 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.06.07 20:01} +\newcontextversion{2021.06.09 00:11} %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/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 8f5fc4d21..01d03a936 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.06.07 20:01} +\immutable\edef\contextversion{2021.06.09 00:11} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/lang-ini.lmt b/tex/context/base/mkxl/lang-ini.lmt index 5bfc9e1bb..be1b8f651 100644 --- a/tex/context/base/mkxl/lang-ini.lmt +++ b/tex/context/base/mkxl/lang-ini.lmt @@ -22,7 +22,7 @@ if not modules then modules = { } end modules ['lang-ini'] = { local type, tonumber, next = type, tonumber, next local utfbyte, utflength = utf.byte, utf.length local format, gsub, gmatch, find = string.format, string.gsub, string.gmatch, string.find -local concat, sortedkeys, sortedpairs, keys, insert, tohash = table.concat, table.sortedkeys, table.sortedpairs, table.keys, table.insert, table.tohash +local concat, sortedkeys, sortedhash, keys, insert, tohash = table.concat, table.sortedkeys, table.sortedhash, table.keys, table.insert, table.tohash local setmetatableindex = table.setmetatableindex local utfvalues, strip, utfcharacters = string.utfvalues, string.strip, utf.characters @@ -768,11 +768,12 @@ do end) local function checkglyphproperties(options) - for word, list in next, options do + -- we sort, just to be sure + for word, list in sortedhash(options) do if type(list) == "string" then options[word] = options[list] else - for index, option in next, list do + for index, option in sortedhash(list) do if type(option) == "string" then list[index] = cache[option] end @@ -1425,7 +1426,7 @@ languages.logger = languages.logger or { } function languages.logger.report() local result, r = { }, 0 - for tag, l in sortedpairs(registered) do + for tag, l in sortedhash(registered) do if l.loaded then r = r + 1 result[r] = format("%s:%s:%s",tag,l.parent,l.number) diff --git a/tex/context/base/mkxl/luat-cnf.lmt b/tex/context/base/mkxl/luat-cnf.lmt index 72e76fb23..081f2462f 100644 --- a/tex/context/base/mkxl/luat-cnf.lmt +++ b/tex/context/base/mkxl/luat-cnf.lmt @@ -144,7 +144,7 @@ function texconfig.init() -- local b = callbytecode(i) local e, b = pcall(callbytecode,i) if not e then - print(string.format("\nfatal error : unable to load bytecode register %%i, maybe wipe the cache first\n",i)) + print(string.format("fatal error : unable to load bytecode register %%i, maybe wipe the cache first\n",i)) os.exit() end if b then @@ -192,7 +192,7 @@ local keys = { } local function makestub() - name = name or (environment.jobname .. ".lui") + local name = environment.jobname .. ".lui" report("creating stub file %a using directives:",name) report() firsttable = firsttable or lua.firstbytecode diff --git a/tex/context/base/mkxl/mult-aux.mkxl b/tex/context/base/mkxl/mult-aux.mkxl index 017aa9d6b..ba0572d15 100644 --- a/tex/context/base/mkxl/mult-aux.mkxl +++ b/tex/context/base/mkxl/mult-aux.mkxl @@ -336,7 +336,7 @@ % \startinterface english \protected\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% {\frozen\protected\def#3##1{\defcsname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) - \frozen\protected\def#4##1{\edefcsname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) + \frozen\protected\def#4##1{\edefcsname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) \frozen\protected\def#5##1{\letcsname#1#2:##1\endcsname}% ##1 ##2 \frozen\protected\def#6##1{\letcsname#1#2:##1\endcsname\empty}}% ##1 % \stopinterface diff --git a/tex/context/base/mkxl/node-syn.lmt b/tex/context/base/mkxl/node-syn.lmt index 1842da5c4..df3abe3db 100644 --- a/tex/context/base/mkxl/node-syn.lmt +++ b/tex/context/base/mkxl/node-syn.lmt @@ -125,7 +125,7 @@ if not modules then modules = { } end modules ['node-syn'] = { -- Some generic (more clever code) has been removed as I don't see things change -- that much. -local type, rawset = type, rawset +local type, rawset, rawget = type, rawset, rawget local concat = table.concat local formatters = string.formatters local replacesuffix, suffixonly, nameonly, collapsepath = file.replacesuffix, file.suffix, file.nameonly, file.collapsepath @@ -227,8 +227,8 @@ local blockedsuffixes = { -- lfg = true, } -local sttags = table.setmetatableindex(function(t,name) - name = collapsepath(name) +local sttags = table.setmetatableindex(function(t,fullname) + local name = collapsepath(fullname) if blockedsuffixes[suffixonly(name)] then -- Just so that I don't get the ones on my development tree. nofblocked = nofblocked + 1 @@ -244,6 +244,9 @@ local sttags = table.setmetatableindex(function(t,name) else noftags = noftags + 1 t[name] = noftags + if name ~= fullname then + t[fullname] = noftags + end stnums[noftags] = name return noftags end @@ -476,85 +479,44 @@ local function inject(head,first,last,tag,line) return head end --- local function collect_min(head) --- local current = head --- while current do --- local id = getid(current) --- if id == glyph_code then --- local first = current --- local last = current --- local tag = 0 --- local line = 0 --- while true do --- if id == glyph_code then --- local tc, lc = getsynctexfields(current) --- if tc and tc > 0 then --- tag = tc --- line = lc --- end --- last = current --- elseif id == disc_code or (id == kern_code and getsubtype(current) == fontkern_code) then --- last = current --- else --- if tag > 0 then --- head = inject(head,first,last,tag,line) --- end --- break --- end --- current = getnext(current) --- if current then --- id = getid(current) --- else --- if tag > 0 then --- head = inject(head,first,last,tag,line) --- end --- return head --- end --- end --- end --- -- pick up (as id can have changed) --- if id == hlist_code or id == vlist_code then --- local list = getlist(current) --- if list then --- local l = collect(list) --- if l ~= list then --- setlist(current,l) --- end --- end --- end --- current = getnext(current) --- end --- return head --- end - local function collect_min(head) - local first = false - local last = false - local tag = 0 - local line = 0 - for current, id, subtype in nextnode, head do + local current = head + while current do + local id = getid(current) if id == glyph_code then - local tc, lc = getsynctexfields(current) - if tc and tc > 0 then - if tag == 0 then - first = current + local first = current + local last = current + local tag = 0 + local line = 0 + while true do + if id == glyph_code then + local tc, lc = getsynctexfields(current) + if tc and tc > 0 then + tag = tc + line = lc + end + last = current + elseif id == disc_code or (id == kern_code and getsubtype(current) == fontkern_code) then + last = current + else + if tag > 0 then + head = inject(head,first,last,tag,line) + end + break + end + current = getnext(current) + if current then + id = getid(current) + else + if tag > 0 then + head = inject(head,first,last,tag,line) + end + return head end - tag = tc - line = lc - last = current - elseif tag > 0 then - head = inject(head,first,last,tag,line) - tag = 0 - end - elseif id == disc_code then - last = current - elseif id == kern_code and subtype == fontkern_code then - last = current - elseif id == hlist_code or id == vlist_code then - if tag > 0 then - head = inject(head,first,last,tag,line) - tag = 0 end + end + -- pick up (as id can have changed) + if id == hlist_code or id == vlist_code then local list = getlist(current) if list then local l = collect(list) @@ -562,17 +524,58 @@ local function collect_min(head) setlist(current,l) end end - elseif tag > 0 then - head = inject(head,first,last,tag,line) - tag = 0 end - end - if tag > 0 then - head = inject(head,first,last,tag,line) + current = getnext(current) end return head end +-- local function collect_min(head) +-- local first = false +-- local last = false +-- local tag = 0 +-- local line = 0 +-- for current, id, subtype in nextnode, head do +-- if id == glyph_code then +-- local tc, lc = getsynctexfields(current) +-- if tc and tc > 0 then +-- if tag == 0 then +-- first = current +-- end +-- tag = tc +-- line = lc +-- last = current +-- elseif tag > 0 then +-- head = inject(head,first,last,tag,line) +-- tag = 0 +-- end +-- elseif id == disc_code then +-- last = current +-- elseif id == kern_code and subtype == fontkern_code then +-- last = current +-- elseif id == hlist_code or id == vlist_code then +-- if tag > 0 then +-- head = inject(head,first,last,tag,line) +-- tag = 0 +-- end +-- local list = getlist(current) +-- if list then +-- local l = collect(list) +-- if l ~= list then +-- setlist(current,l) +-- end +-- end +-- elseif tag > 0 then +-- head = inject(head,first,last,tag,line) +-- tag = 0 +-- end +-- end +-- if tag > 0 then +-- head = inject(head,first,last,tag,line) +-- end +-- return head +-- end + local function inject(parent,head,first,last,tag,line) local w, h, d = getrangedimensions(parent,first,getnext(last)) if h < height then @@ -589,153 +592,93 @@ local function inject(parent,head,first,last,tag,line) return head end --- local function collect_max(head,parent) --- local current = head --- while current do --- local id = getid(current) --- if id == glyph_code then --- local first = current --- local last = current --- local tag = 0 --- local line = 0 --- while true do --- if id == glyph_code then --- local tc, lc = getsynctexfields(current) --- if tc and tc > 0 then --- if tag > 0 and (tag ~= tc or line ~= lc) then --- head = inject(parent,head,first,last,tag,line) --- first = current --- end --- tag = tc --- line = lc --- last = current --- else --- if tag > 0 then --- head = inject(parent,head,first,last,tag,line) --- tag = 0 --- end --- first = nil --- last = nil --- end --- elseif id == disc_code then --- if not first then --- first = current --- end --- last = current --- elseif id == kern_code and getsubtype(current) == fontkern_code then --- if first then --- last = current --- end --- elseif id == glue_code then --- if tag > 0 then --- local tc, lc = getsynctexfields(current) --- if tc and tc > 0 then --- if tag ~= tc or line ~= lc then --- head = inject(parent,head,first,last,tag,line) --- tag = 0 --- break --- end --- else --- head = inject(parent,head,first,last,tag,line) --- tag = 0 --- break --- end --- else --- tag = 0 --- break --- end --- id = nil -- so no test later on --- elseif id == penalty_code then --- -- go on (and be nice for math) --- else --- if tag > 0 then --- head = inject(parent,head,first,last,tag,line) --- tag = 0 --- end --- break --- end --- current = getnext(current) --- if current then --- id = getid(current) --- else --- if tag > 0 then --- head = inject(parent,head,first,last,tag,line) --- end --- return head --- end --- end --- end --- -- pick up (as id can have changed) --- if id == hlist_code or id == vlist_code then --- local list = getlist(current) --- if list then --- local l = collect(list,current) --- if l and l ~= list then --- setlist(current,l) --- end --- end --- end --- current = getnext(current) --- end --- return head --- end - local function collect_max(head,parent) - local first = false - local last = false - local tag = 0 - local line = 0 - for current, id, subtype in nextnode, head do + local current = head + while current do + local id = getid(current) if id == glyph_code then - local tc, lc = getsynctexfields(current) - if tc and tc > 0 then - if tag == 0 then - first = current - end - tag = tc - line = lc - last = current - elseif tag > 0 then - head = inject(parent,head,first,last,tag,line) - tag = 0 - end - elseif id == disc_code then - last = current - elseif id == kern_code and subtype == fontkern_code then - last = current - elseif id == glue_code then -- in addition to min - if tag > 0 then - local tc, lc = getsynctexfields(current) - if tc and tc > 0 then - if tag == 0 then + local first = current + local last = current + local tag = 0 + local line = 0 + while true do + if id == glyph_code then + local tc, lc = getsynctexfields(current) + if tc and tc > 0 then + if tag > 0 and (tag ~= tc or line ~= lc) then + head = inject(parent,head,first,last,tag,line) + first = current + end + tag = tc + line = lc + last = current + else + if tag > 0 then + head = inject(parent,head,first,last,tag,line) + tag = 0 + end + first = nil + last = nil + end + elseif id == disc_code then + if not first then first = current end - tag = tc - line = lc last = current + elseif id == kern_code and getsubtype(current) == fontkern_code then + if first then + last = current + end + elseif id == glue_code then + if tag > 0 then + local tc, lc = getsynctexfields(current) + if tc and tc > 0 then + if tag ~= tc or line ~= lc then + head = inject(parent,head,first,last,tag,line) + tag = 0 + break + end + else + head = inject(parent,head,first,last,tag,line) + tag = 0 + break + end + else + tag = 0 + break + end + id = nil -- so no test later on + elseif id == penalty_code then + -- go on (and be nice for math) else - head = inject(parent,head,first,last,tag,line) - tag = 0 + if tag > 0 then + head = inject(parent,head,first,last,tag,line) + tag = 0 + end + break + end + current = getnext(current) + if current then + id = getid(current) + else + if tag > 0 then + head = inject(parent,head,first,last,tag,line) + end + return head end end - elseif id == penalty_code then -- in addition to min - -- go on (and be nice for math) - elseif id == hlist_code or id == vlist_code then - if tag > 0 then - head = inject(parent,head,first,last,tag,line) - tag = 0 - end + end + -- pick up (as id can have changed) + if id == hlist_code or id == vlist_code then local list = getlist(current) if list then - local l = collect(list) - if l ~= list then + local l = collect(list,current) + if l and l ~= list then setlist(current,l) end end - elseif tag > 0 then - head = inject(parent,head,first,last,tag,line) - tag = 0 end + current = getnext(current) end return head end diff --git a/tex/context/base/mkxl/page-ffl.mkxl b/tex/context/base/mkxl/page-ffl.mkxl index 4c467253b..9aeaeef60 100644 --- a/tex/context/base/mkxl/page-ffl.mkxl +++ b/tex/context/base/mkxl/page-ffl.mkxl @@ -96,12 +96,12 @@ \ifodd\c_strc_floats_facing_flushed \ifodd\realpageno \strc_floats_facing_flush_indeed - \doifelsependingpagecontent\relax{\null\page}% + \doifelsependingpagecontent\relax{\kern\zeropoint\page}% \fi \else \ifodd\realpageno\else \strc_floats_facing_flush_indeed - \doifelsependingpagecontent\relax{\null\page}% + \doifelsependingpagecontent\relax{\kern\zeropoint\page}% \fi \fi \fi} @@ -230,6 +230,7 @@ \else \begingroup \setbox\scratchbox\vsplit#1 upto \textheight + \setsplitlisthtdp\scratchbox\strutht\strutdp \setbox\scratchbox\hpack\bgroup \edef\currentfacingfloat{\currentfacingfloat:#2}% \inheritedfacingfloatframed{\box\scratchbox}% diff --git a/tex/context/base/mkxl/page-mrk.mkxl b/tex/context/base/mkxl/page-mrk.mkxl index 143fab180..f04d31e3a 100644 --- a/tex/context/base/mkxl/page-mrk.mkxl +++ b/tex/context/base/mkxl/page-mrk.mkxl @@ -186,41 +186,44 @@ \permanent\protected\def\page_marks_set#1% {\begincsname\??layoutmarking#1\endcsname} +\def\page_marks_setup_layout + {\setfalse\c_page_marks_add_page_lines + \setfalse\c_page_marks_add_more_color + \setfalse\c_page_marks_add_more_marking + \setfalse\c_page_marks_add_more_lines + \setfalse\c_page_marks_add_more_number + \global\c_page_marks_max\maxcount + \rawprocesscommacommand[\layoutparameter\c!marking]\page_marks_set + \ifnum\c_page_marks_max<\maxcount + \ifconditional\c_page_marks_add_page_lines \orelse + \ifconditional\c_page_marks_add_more_color \orelse + \ifconditional\c_page_marks_add_more_marking\orelse + \ifconditional\c_page_marks_add_more_lines \orelse + \ifconditional\c_page_marks_add_more_number \else + \settrue\c_page_marks_add_page_lines + \settrue\c_page_marks_add_more_number + \fi + \fi + \ifconditional\c_page_marks_add_page_lines + \let\page_marks_add_page\page_marks_add_page_indeed + \else + \let\page_marks_add_page\gobbleoneargument + \fi + % we can get a double set of (overlayed) lines .. needs to be redone (too many objects anyway) + \ifconditional\c_page_marks_add_more_lines + \let\page_marks_add_more\page_marks_add_more_indeed + \orelse\ifconditional\c_page_marks_add_more_color + \let\page_marks_add_more\page_marks_add_more_indeed + \orelse\ifconditional\c_page_marks_add_more_marking + \let\page_marks_add_more\page_marks_add_more_indeed + \orelse\ifconditional\c_page_marks_add_more_number + \let\page_marks_add_more\page_marks_add_more_indeed + \else + \let\page_marks_add_more\gobbleoneargument + \fi} + \appendtoks - \setfalse\c_page_marks_add_page_lines - \setfalse\c_page_marks_add_more_color - \setfalse\c_page_marks_add_more_marking - \setfalse\c_page_marks_add_more_lines - \setfalse\c_page_marks_add_more_number - \global\c_page_marks_max\maxcount - \rawprocesscommacommand[\layoutparameter\c!marking]\page_marks_set - \ifnum\c_page_marks_max<\maxcount - \ifconditional\c_page_marks_add_page_lines \orelse - \ifconditional\c_page_marks_add_more_color \orelse - \ifconditional\c_page_marks_add_more_marking\orelse - \ifconditional\c_page_marks_add_more_lines \orelse - \ifconditional\c_page_marks_add_more_number \else - \settrue\c_page_marks_add_page_lines - \settrue\c_page_marks_add_more_number - \fi - \fi - \ifconditional\c_page_marks_add_page_lines - \let\page_marks_add_page\page_marks_add_page_indeed - \else - \let\page_marks_add_page\gobbleoneargument - \fi - % we can get a double set of (overlayed) lines .. needs to be redone (too many objects anyway) - \ifconditional\c_page_marks_add_more_lines - \let\page_marks_add_more\page_marks_add_more_indeed - \orelse\ifconditional\c_page_marks_add_more_color - \let\page_marks_add_more\page_marks_add_more_indeed - \orelse\ifconditional\c_page_marks_add_more_marking - \let\page_marks_add_more\page_marks_add_more_indeed - \orelse\ifconditional\c_page_marks_add_more_number - \let\page_marks_add_more\page_marks_add_more_indeed - \else - \let\page_marks_add_more\gobbleoneargument - \fi + \page_marks_setup_layout \to \everysetuplayout \setuplayout diff --git a/tex/context/base/mkxl/supp-box.lmt b/tex/context/base/mkxl/supp-box.lmt index 24b0f3afb..a26cb3960 100644 --- a/tex/context/base/mkxl/supp-box.lmt +++ b/tex/context/base/mkxl/supp-box.lmt @@ -30,6 +30,8 @@ local glyph_code = nodecodes.glyph local par_code = nodecodes.par local indent_code = nodes.listcodes.indent +local topskip_code = nodes.gluecodes.topskip +local line_code = nodes.listcodes.line local hmode_code = tex.modelevels.horizontal @@ -1391,3 +1393,45 @@ do } end + +do + + function setsplitlisthtdp(n,ht,dp) + local box = getbox(n) + if box then + local head = getlist(box) + if head then + local tail = findtail(head) + local id = getid(head) + if id == glue_code and getsubtype(head) == topskip_code then + head = getnext(head) + id = head and getid(head) + ht = ht - getwidth(head) + end + if id == hlist_code and getsubtype(head) == line_code and getheight(head) < ht then +-- print("set height",ht) + setheight(head,ht) + end + local id = getid(tail) + if id == glue_code then + tail = getprev(tail) + id = tail and getid(tail) + dp = dp - getwidth(tail) + end + if id == hlist_code and getsubtype(tail) == line_code and getdepth(tail) < dp then + setdepth(dept,dp) +-- print("set depth",dp) + end + end + end + end + + implement { + name = "setsplitlisthtdp", + public = true, + protected = true, + arguments = { "integer", "dimen", "dimen" }, + actions = setsplitlisthtdp, + } +end + diff --git a/tex/context/base/mkxl/supp-box.mkxl b/tex/context/base/mkxl/supp-box.mkxl index 0d0f90cf3..4b6a576e2 100644 --- a/tex/context/base/mkxl/supp-box.mkxl +++ b/tex/context/base/mkxl/supp-box.mkxl @@ -2872,6 +2872,10 @@ %D \setpostlistbox <box> <hbox|vbox|vtop|somebox> %D \stoptyping +%D Defined in lua: +%D +%D setsplitlisthtdp\scratchbox\struthp\strutdp + \protect \endinput % a bit of test code: diff --git a/tex/context/base/mkxl/tabl-ltb.mkxl b/tex/context/base/mkxl/tabl-ltb.mkxl index ec4a37360..3376b30c6 100644 --- a/tex/context/base/mkxl/tabl-ltb.mkxl +++ b/tex/context/base/mkxl/tabl-ltb.mkxl @@ -261,8 +261,7 @@ \egroup} \def\tabl_lines_wrap_up - {\edef\p_background{\linetablecparameter\c!background}% - \ifx\p_background\v!color + {\ifcstok{\linetablecparameter\c!background}\v!color \ifconditional\linetableautoheight \tabl_lines_wrap_up_auto \else @@ -325,16 +324,12 @@ \else \vbox {\ifvoid\b_tabl_lines_current\c_tabl_lines_part\else\unvbox\b_tabl_lines_current\c_tabl_lines_part\fi - \edef\p_background{\linetablerparameter\c!background}% - \ifx\p_background\v!color + \ifcstok{\linetablerparameter\c!background}\v!color \backgroundline[\linetablerparameter\c!backgroundcolor]{\box\scratchbox}% + \orelse\iftok{\linetablerparameter\c!type}\emptytoks + \box\scratchbox \else - \edef\p_type{\linetablerparameter\c!type}% - \ifempty\p_type - \box\scratchbox - \else - \tabl_lines_wrap_up_auto_r - \fi + \tabl_lines_wrap_up_auto_r \fi \endgraf \linetablerparameter\c!after}% @@ -396,14 +391,12 @@ \unskip \unskip % remove last intercolumn skip (distance+fill) \fi \egroup - \ifconditional\c_tabl_lines_preroll \else - \ifcase\c_tabl_lines_part - % we're collecting the repeater - \else - \ifdim\dimexpr\hsize-\wd\scratchbox\relax>\linetableparameter\c!stretch\else - \setbox\scratchbox\hpack to \hsize{\unhbox\scratchbox}% - \fi - \fi + \ifconditional\c_tabl_lines_preroll + \orelse\ifcase\c_tabl_lines_part + % we're collecting the repeater + \orelse\ifdim\dimexpr\hsize-\wd\scratchbox\relax>\linetableparameter\c!stretch + \else + \setbox\scratchbox\hpack to \hsize{\unhbox\scratchbox}% \fi} \def\tabl_lines_check_part @@ -414,26 +407,23 @@ %\message{\the\c_tabl_lines_column,\the\c_tabl_lines_subcol}\wait % from now on the column counter is already incremented \ifcase\c_tabl_lines_split_state - \ifconditional\c_tabl_lines_preroll \else + \ifconditional\c_tabl_lines_preroll + \else \box\b_tabl_lines_cell % the columncounter is one ahead ! \hskip\scratchskip \fi %%% \donefalse - \ifcase\c_tabl_lines_repeat\else - % calculate ahead - \ifnum\c_tabl_lines_repeat=\numexpr\c_tabl_lines_column-\plustwo\relax - \donetrue % collecting repeater - \fi + \ifcase\c_tabl_lines_repeat + \orelse\ifnum\c_tabl_lines_repeat=\numexpr\c_tabl_lines_column-\plustwo\relax % calculate ahead + \donetrue % collecting repeater \fi %%%% \ifdone % collecting repeater - \else - \ifnum\c_tabl_lines_column>\csname\??linetablepart\number\c_tabl_lines_part\endcsname\relax - \donetrue - \fi + \orelse\ifnum\c_tabl_lines_column>\csname\??linetablepart\number\c_tabl_lines_part\endcsname\relax + \donetrue \fi \ifdone \tabl_lines_stop_part @@ -486,7 +476,8 @@ \tabl_lines_start_part \ifscratchconditionone \orelse \ifcase\c_tabl_lines_repeat \else % check for left/right page - \ifcase\c_tabl_lines_page\donetrue\or\donetrue\or\donefalse\fi\ifdone + \ifcase\c_tabl_lines_page\donetrue\or\donetrue\or\donefalse\fi + \ifdone % insert repeater \global\advance\d_tabl_lines_width\wd\b_tabl_lines_current\zerocount \ifconditional\c_tabl_lines_preroll\kern\wd\else\unhcopy\fi\b_tabl_lines_current\zerocount @@ -636,8 +627,9 @@ \def\tabl_lines_check_page {\global\c_tabl_lines_page\zerocount \ifcase\c_tabl_lines_repeat\orelse\ifcase\c_tabl_lines_page - \doif{\linetableparameter\c!repeat}\v!no - {\global\c_tabl_lines_page\doifelseoddpage\plusone\plustwo}% + \iftok{\linetableparameter\c!repeat}\v!no + \global\c_tabl_lines_page\doifelseoddpage\plusone\plustwo + \fi \fi} \def\tabl_lines_flush_head @@ -694,7 +686,7 @@ % todo: store in box instead of macro -\aliased\let\stoplinetablehead\relax +\permanent\protected\lettonothing\stoplinetablehead \permanent\protected\def\startlinetablehead#1\stoplinetablehead {\ifconditional\c_tabl_lines_in_table diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl index 88cd791e4..4ccb0e107 100644 --- a/tex/context/base/mkxl/tabl-tbl.mkxl +++ b/tex/context/base/mkxl/tabl-tbl.mkxl @@ -803,7 +803,7 @@ % the lmtx raw processor handles {} like the normal one so we need to prune \rawprocesscommalist[#1]\tabl_tabulate_set_vrule_command \fi - \tabl_tabulate_set_preamble#2\relax\relax % permits i without n + \tabl_tabulate_set_preamble#2\relax\relax % permits i without n \ifcase\c_tabl_tabulate_modus\relax \tabl_tabulate_set_width_normal \or % fixed width diff --git a/tex/context/base/mkxl/typo-del.mkxl b/tex/context/base/mkxl/typo-del.mkxl index 850eb0cc2..9cac52ab8 100644 --- a/tex/context/base/mkxl/typo-del.mkxl +++ b/tex/context/base/mkxl/typo-del.mkxl @@ -28,11 +28,11 @@ {\getdummyparameters[#1]% \expandnamespaceparameter\??hyphenmarksign\dummyparameter\c!sign\v!normal} -\setvalue{\??hyphenmarksign\v!normal}% +\defcsname\??hyphenmarksign\v!normal\endcsname {\enforced\let\textmodehyphen\normalhyphen \enforced\let\textmodehyphendiscretionary\normalhyphendiscretionary} -\setvalue{\??hyphenmarksign\v!wide}% +\defcsname\??hyphenmarksign\v!wide\endcsname {\enforced\let\textmodehyphen\composedhyphen \enforced\let\textmodehyphendiscretionary\composedhyphendiscretionary} @@ -416,6 +416,8 @@ \edef\p_delimited_method{\delimitedtextparameter\c!method}% \ifx\p_delimited_method\v!font \expandafter\typo_delimited_start_font + \orelse\ifx\p_delimited_method\v!paragraph + \expandafter\typo_delimited_start_font \else \expandafter\typo_delimited_start_other \fi} @@ -567,6 +569,8 @@ \edef\p_delimited_method{\delimitedtextparameter\c!method}% \ifx\p_delimited_method\v!font \expandafter\typo_delimited_fontdriven + \orelse\ifx\p_delimited_method\v!text + \expandafter\typo_delimited_fontdriven \else \expandafter\typo_delimited_other \fi} diff --git a/tex/context/modules/mkiv/m-tikz.mkiv b/tex/context/modules/mkiv/m-tikz.mkiv index 9267f90d4..ed9cb914f 100644 --- a/tex/context/modules/mkiv/m-tikz.mkiv +++ b/tex/context/modules/mkiv/m-tikz.mkiv @@ -72,4 +72,45 @@ \fi +% \input t-pgf.tex + +\ifx\pgfdefined\undefined + + \let\pgfdefined\relax + + % \input t-pgfcor.tex + + \ifx\pgfcoredefined\undefined + + \let\pgfcoredefined=\relax + + \input t-pgfsys.tex + + \edef\pgfcoreatcode {\the\catcode`\@} + \edef\pgfcorebarcode {\the\catcode`\|} + \edef\pgfcoreexclaimcode{\the\catcode`\!} + + \catcode`\@=11 + \catcode`\|=12 + \catcode`\!=12 + + \input pgfcore.code.tex + + \catcode`\@=\pgfcoreatcode + \catcode`\|=\pgfcorebarcode + \catcode`\!=\pgfcoreexclaimcode + + \let\startpgfpicture \pgfpicture \let\stoppgfpicture \endpgfpicture + \let\startpgfscope \pgfscope \let\stoppgfscope \endpgfscope + \let\startpgflowlevelscope \pgflowlevelscope \let\stoppgflowlevelscope \endpgflowlevelscope + \let\startpgfinterruptpath \pgfinterruptpath \let\stoppgfinterruptpath \endpgfinterruptpath + \let\startpgfinterruptpicture \pgfinterruptpicture \let\stoppgfinterruptpicture \endpgfinterruptpicture + \let\startpgfinterruptboundingbox\pgfinterruptboundinbox \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox + + \fi + + \usepgfmodule[shapes,plot] + +\fi + \stopmodule diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 45eb65e78..1407719d0 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-06-07 20:01 +-- merge date : 2021-06-09 00:11 do -- begin closure to overcome local limits and interference |