From 3c25716e01b7251f0f7504481692421a729e4b53 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 19 Apr 2020 20:29:51 +0200 Subject: 2020-04-19 19:24:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-en.mkii | 3 + tex/context/base/mkiv/back-exp.lua | 65 ++++++++---- tex/context/base/mkiv/buff-ver.lua | 4 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/context.mkxl | 2 +- tex/context/base/mkiv/font-ots.lua | 2 + tex/context/base/mkiv/lxml-aux.lua | 29 +++++- tex/context/base/mkiv/meta-imp-experiments.mkxl | 2 - tex/context/base/mkiv/mlib-lmp.lua | 110 +-------------------- tex/context/base/mkiv/mlib-lmt.lua | 94 +++++++++++++++++- tex/context/base/mkiv/mlib-lua.lua | 63 +++++++----- tex/context/base/mkiv/mlib-pps.lua | 33 ++++--- tex/context/base/mkiv/mlib-run.lua | 1 + tex/context/base/mkiv/mult-aux.mkxl | 4 +- tex/context/base/mkiv/mult-mps.lua | 4 + tex/context/base/mkiv/mult-prm.lua | 1 + tex/context/base/mkiv/spac-ver.mkxl | 4 + tex/context/base/mkiv/status-files.pdf | Bin 27713 -> 27734 bytes tex/context/base/mkiv/status-lua.pdf | Bin 251314 -> 251331 bytes tex/context/base/mkiv/strc-lst.mkvi | 75 +++++++++----- tex/context/base/mkiv/supp-box.mkiv | 2 + tex/context/base/mkiv/supp-box.mkxl | 18 ---- tex/context/base/mkiv/syst-ini.mkxl | 2 - tex/context/base/mkiv/trac-vis.mkiv | 28 +++++- tex/context/interface/mkii/keys-en.xml | 3 + tex/generic/context/luatex/luatex-fonts-merged.lua | 4 +- 29 files changed, 336 insertions(+), 225 deletions(-) (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index c9be3905d..d0ba7ffac 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{2020.04.08 14:34} +\newcontextversion{2020.04.19 19:20} %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 5a6ca6275..ea059fc76 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{2020.04.08 14:34} +\edef\contextversion{2020.04.19 19:20} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii index 3d7935db7..7737ae311 100644 --- a/tex/context/base/mkii/mult-en.mkii +++ b/tex/context/base/mkii/mult-en.mkii @@ -907,7 +907,10 @@ \setinterfaceconstant{keys}{keys} \setinterfaceconstant{keyword}{keyword} \setinterfaceconstant{label}{label} +\setinterfaceconstant{labelalternative}{labelalternative} +\setinterfaceconstant{labelcolor}{labelcolor} \setinterfaceconstant{labeloffset}{labeloffset} +\setinterfaceconstant{labelstyle}{labelstyle} \setinterfaceconstant{language}{language} \setinterfaceconstant{last}{last} \setinterfaceconstant{lastnamesep}{lastnamesep} diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index 22822d7dd..f72cd68b8 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -3691,6 +3691,31 @@ local htmltemplate = [[ end end + -- Some elements are not supported (well) in css so we need to retain them. For + -- instance, tablecells have no colspan so basically that renders css table div + -- elements quite useless. A side effect is that we nwo can have conflicts when + -- we mix in with other html (as there is no reset). Of course, when it eventually + -- gets added, there is a change then that those not using the div abstraction + -- will be rediculed. + -- + -- a table tr td th thead tbody tfoot + -- + + local crappycss = { + table = "table", tabulate = "table", + tablehead = "thead", tabulatehead = "thead", + tablebody = "tbody", tabulatebody = "tbody", + tablefoot = "tfoot", tabulatefoot = "tfoot", + tablerow = "tr", tabulaterow = "tr", + tablecell = "td", tabulatecell = "td", + } + + local cssmapping = false + + directives.register("export.nativetags", function(v) + cssmapping = v and crappycss or false + end) + local function remap(specification,source,target) local comment = nil -- share comments for c in xmlcollected(source,"*") do @@ -3762,11 +3787,11 @@ local htmltemplate = [[ } end end - c.tg = "div" c.at = attr if label then attr.label = label end + c.tg = cssmapping and cssmapping[tg] or "div" end end end @@ -4054,28 +4079,30 @@ local htmltemplate = [[ local metadata = structures.tags.getmetadata() local specification = { - name = usedname, - identifier = os.uuid(), - images = wrapups.uniqueusedimages(), - imagefile = joinfile("styles",imagefilebase), - imagepath = "images", - stylepath = "styles", - xmlfiles = { xmlfilebase }, - xhtmlfiles = { xhtmlfilebase }, - htmlfiles = { htmlfilebase }, - styles = cssfiles, - htmlroot = htmlfilebase, - language = languagenames[texgetcount("mainlanguagenumber")], - title = validstring(finetuning.title) or validstring(identity.title), - subtitle = validstring(finetuning.subtitle) or validstring(identity.subtitle), - author = validstring(finetuning.author) or validstring(identity.author), - firstpage = validstring(finetuning.firstpage), - lastpage = validstring(finetuning.lastpage), - metadata = metadata, + name = usedname, + identifier = os.uuid(), + images = wrapups.uniqueusedimages(), + imagefile = joinfile("styles",imagefilebase), + imagepath = "images", + stylepath = "styles", + xmlfiles = { xmlfilebase }, + xhtmlfiles = { xhtmlfilebase }, + htmlfiles = { htmlfilebase }, + styles = cssfiles, + htmlroot = htmlfilebase, + language = languagenames[texgetcount("mainlanguagenumber")], + title = validstring(finetuning.title) or validstring(identity.title), + subtitle = validstring(finetuning.subtitle) or validstring(identity.subtitle), + author = validstring(finetuning.author) or validstring(identity.author), + firstpage = validstring(finetuning.firstpage), + lastpage = validstring(finetuning.lastpage), + metadata = metadata, } report_export("saving specification in %a",specificationfilename,specificationfilename) + xml.wipe(xmltree,"metadata") -- maybe optional + io.savedata(specificationfilename,table.serialize(specification,true)) -- the html export for epub is different in the sense that it uses div's instead of diff --git a/tex/context/base/mkiv/buff-ver.lua b/tex/context/base/mkiv/buff-ver.lua index ad06dceec..2bf663704 100644 --- a/tex/context/base/mkiv/buff-ver.lua +++ b/tex/context/base/mkiv/buff-ver.lua @@ -800,7 +800,7 @@ end -- needed in e.g. tabulate (manuals) local fences = S([[[{]]) -local symbols = S([[!#"$%&'*()+,-./:;<=>?@[]^_`{|}~]]) +local symbols = S([[!#"$%&'*()+,-./:;<=>?@[]^_`{|}~0123456789]]) -- digits added but maybe split it local space = S([[ ]]) local backslash = S([[\]]) local nospace = space^1/"" @@ -808,7 +808,7 @@ local endstring = P(-1) local compactors = { [v_all] = Cs((backslash * (1-backslash-space)^1 * nospace * (endstring+fences) + 1)^0), - [v_absolute] = Cs((backslash * (1-symbols -space)^1 * nospace * (symbols +backslash) + 1) ^0), + [v_absolute] = Cs((backslash * (1-symbols -space)^1 * nospace * (symbols+backslash) + 1)^0), [v_last] = Cs((space^1 * endstring/"" + 1)^0), } diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 9d17b080c..d3c1125f4 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{2020.04.08 14:34} +\newcontextversion{2020.04.19 19:20} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index f28349e88..d290c3ab1 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{2020.04.08 14:34} +\edef\contextversion{2020.04.19 19:20} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index f7a8d2e46..cef37c41e 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.04.08 14:34} +\edef\contextversion{2020.04.19 19:20} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index f20a349ee..4df9c94ac 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -3287,6 +3287,7 @@ local nesting = 0 local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) local done = false local sweep = sweephead[head] + local start if sweep then start = sweep -- sweephead[head] = nil @@ -3448,6 +3449,7 @@ end local function c_run_multiple(head,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) local done = false local sweep = sweephead[head] + local start if sweep then start = sweep -- sweephead[head] = nil diff --git a/tex/context/base/mkiv/lxml-aux.lua b/tex/context/base/mkiv/lxml-aux.lua index 67ee31c88..dd0e733c0 100644 --- a/tex/context/base/mkiv/lxml-aux.lua +++ b/tex/context/base/mkiv/lxml-aux.lua @@ -22,7 +22,7 @@ local xmlapplylpath = xml.applylpath local type, next, setmetatable, getmetatable = type, next, setmetatable, getmetatable local insert, remove, fastcopy, concat = table.insert, table.remove, table.fastcopy, table.concat -local gmatch, gsub, format, find, strip = string.gmatch, string.gsub, string.format, string.find, string.strip +local gmatch, gsub, format, find, strip, match = string.gmatch, string.gsub, string.format, string.find, string.strip, string.match local utfbyte = utf.byte local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local striplinepatterns = utilities.strings.striplinepatterns @@ -247,6 +247,33 @@ function xml.delete(root,pattern) end end +function xml.wipe(root,pattern) -- not yet in manual + local collected = xmlapplylpath(root,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + local p = e.__p__ + if p then + local d = p.dt + local ni = e.ni + if ni <= #d then + local dt = e.dt + if #dt == 1 then + local d1 = dt[1] + if type(d1) == "string" and match(d1,"^%s*$") then + if trace_manipulations then + report('wiping',pattern,c,e) + end + remove(d,ni) + redo_ni(d) -- can be made faster and inlined + end + end + end + end + end + end +end + function xml.replace(root,pattern,whatever) local element = root and xmltoelement(whatever,root) local collected = element and xmlapplylpath(root,pattern) diff --git a/tex/context/base/mkiv/meta-imp-experiments.mkxl b/tex/context/base/mkiv/meta-imp-experiments.mkxl index 6b43ba676..644a8fff0 100644 --- a/tex/context/base/mkiv/meta-imp-experiments.mkxl +++ b/tex/context/base/mkiv/meta-imp-experiments.mkxl @@ -263,8 +263,6 @@ enddef ; vardef lmt_do_overlap = image ( - lmt_load_mlib_cnt ; - pushparameters "overlap" ; save p, q, r, s, qq, a, b, c, d, t, n, gap, subgap, steps, astep, start, stop, first, last ; diff --git a/tex/context/base/mkiv/mlib-lmp.lua b/tex/context/base/mkiv/mlib-lmp.lua index cf7862d91..3186a3b25 100644 --- a/tex/context/base/mkiv/mlib-lmp.lua +++ b/tex/context/base/mkiv/mlib-lmp.lua @@ -6,15 +6,15 @@ if not modules then modules = { } end modules ['mlib-lmp'] = { license = "see context related readme files", } +-- path relates stuff ... todo: use a stack (or numeric index to list) + + local type = type local aux = mp.aux local mpnumeric = aux.numeric local mppair = aux.pair local mpquoted = aux.quoted -local mpdirect = aux.direct - --- todo: use a stack? do @@ -121,107 +121,3 @@ do end end - -do - - -- if needed we can optimize the sub (cache last split) - - local utflen, utfsub = utf.len, utf.sub - - function mp.utflen(s) - mpnumeric(utflen(s)) - end - - function mp.utfsub(s,f,t) - mpquoted(utfsub(s,f,t or f)) - end - -end - -if CONTEXTLMTXMODE > 0 then - - function mp.lmt_svg_include() - local labelfile = metapost.getparameter { "labelfile" } - if labelfile and labelfile ~= "" then - local labels = table.load(labelfile) -- todo: same path as svg file - if type(labels) == "table" then - for i=1,#labels do - metapost.remaptext(labels[i]) - end - end - end - local fontname = metapost.getparameter { "fontname" } - if fontname and fontname ~= "" then - local unicode = metapost.getparameter { "unicode" } - if unicode then - mpdirect ( - metapost.svgglyphtomp(fontname,math.round(unicode)) - ) - end - return - end - local colorfile = metapost.getparameter { "colormap" } - local colormap = false - if colorfile and colorfile ~= "" then - colormap = metapost.svgcolorremapper(colorfile) - end - local filename = metapost.getparameter { "filename" } - if filename and filename ~= "" then - mpdirect ( metapost.svgtomp { - data = io.loaddata(filename), - remap = true, - colormap = colormap, - id = filename, - } ) - else - local buffer = metapost.getparameter { "buffer" } - if buffer then - mpdirect ( metapost.svgtomp { - data = buffers.getcontent(buffer), - -- remap = true, - colormap = colormap, - id = buffer or "buffer", - } ) - else - local code = metapost.getparameter { "code" } - if code then - mpdirect ( metapost.svgtomp { - data = code, - colormap = colormap, - id = "code", - } ) - end - end - end - end - -end - -if CONTEXTLMTXMODE > 0 then - - function mp.lmt_do_remaptext() - local parameters = metapost.scanparameters() - if parameters and parameters.label then - metapost.remaptext(parameters) - end - end - -end - -if CONTEXTLMTXMODE > 0 then - - local dropins = fonts.dropins - local registerglyphs = dropins.registerglyphs - local registerglyph = dropins.registerglyph - - function mp.lmt_register_glyph() - registerglyph(metapost.getparameterset("mpsglyph")) - end - - function mp.lmt_register_glyphs() - registerglyphs(metapost.getparameterset("mpsglyphs")) - end - -end - -todecimal = xdecimal and xdecimal.new or tonumber -- bonus diff --git a/tex/context/base/mkiv/mlib-lmt.lua b/tex/context/base/mkiv/mlib-lmt.lua index 9137861a5..f0b59248a 100644 --- a/tex/context/base/mkiv/mlib-lmt.lua +++ b/tex/context/base/mkiv/mlib-lmt.lua @@ -6,10 +6,17 @@ if not modules then modules = { } end modules ['mlib-lmt'] = { license = "see context related readme files", } +-- todo: check for possible inject usage + +local type = type + +local aux = mp.aux +local mpdirect = aux.direct local mppath = mp.path -local scannumeric = mp.scan.numeric -local scanpath = mp.scan.path +local scan = mp.scan +local scannumeric = scan.numeric +local scanpath = scan.path local getparameter = metapost.getparameter @@ -61,3 +68,86 @@ function mp.lmt_mesh_update() local mesh = getparameter { "paths" } or getparameter { "mesh", "paths" } mesh[scannumeric()] = scanpath(true) end + +-- moved here + +function mp.lmt_svg_include() + local labelfile = metapost.getparameter { "labelfile" } + if labelfile and labelfile ~= "" then + local labels = table.load(labelfile) -- todo: same path as svg file + if type(labels) == "table" then + for i=1,#labels do + metapost.remaptext(labels[i]) + end + end + end + local fontname = metapost.getparameter { "fontname" } + if fontname and fontname ~= "" then + local unicode = metapost.getparameter { "unicode" } + if unicode then + mpdirect ( + metapost.svgglyphtomp(fontname,math.round(unicode)) + ) + end + return + end + local colorfile = metapost.getparameter { "colormap" } + local colormap = false + if colorfile and colorfile ~= "" then + colormap = metapost.svgcolorremapper(colorfile) + end + local filename = metapost.getparameter { "filename" } + if filename and filename ~= "" then + mpdirect ( metapost.svgtomp { + data = io.loaddata(filename), + remap = true, + colormap = colormap, + id = filename, + } ) + else + local buffer = metapost.getparameter { "buffer" } + if buffer then + mpdirect ( metapost.svgtomp { + data = buffers.getcontent(buffer), + -- remap = true, + colormap = colormap, + id = buffer or "buffer", + } ) + else + local code = metapost.getparameter { "code" } + if code then + mpdirect ( metapost.svgtomp { + data = code, + colormap = colormap, + id = "code", + } ) + end + end + end +end + + +function mp.lmt_do_remaptext() + local parameters = metapost.scanparameters() + if parameters and parameters.label then + metapost.remaptext(parameters) + end +end + +do + + local dropins = fonts.dropins + local registerglyphs = dropins.registerglyphs + local registerglyph = dropins.registerglyph + + function mp.lmt_register_glyph() + registerglyph(metapost.getparameterset("mpsglyph")) + end + + function mp.lmt_register_glyphs() + registerglyphs(metapost.getparameterset("mpsglyphs")) + end + +end + +todecimal = xdecimal and xdecimal.new or tonumber -- bonus diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua index 31a9b845b..9b4ec44dd 100644 --- a/tex/context/base/mkiv/mlib-lua.lua +++ b/tex/context/base/mkiv/mlib-lua.lua @@ -1118,9 +1118,9 @@ end do - local mprint = mp.print - local fprint = mp.fprint - local qprint = mp.quoted + local mpprint = mp.print + local mpfprint = mp.fprint + local mpquoted = mp.quoted local jobpositions = job.positions local getwhd = jobpositions.whd local getxy = jobpositions.xy @@ -1132,72 +1132,72 @@ do function mp.positionpath(name) local w, h, d = getwhd(name) if w then - fprint("((%p,%p)--(%p,%p)--(%p,%p)--(%p,%p)--cycle)",0,-d,w,-d,w,h,0,h) + mpfprint("((%p,%p)--(%p,%p)--(%p,%p)--(%p,%p)--cycle)",0,-d,w,-d,w,h,0,h) else - mprint("(origin--cycle)") + mpprint("(origin--cycle)") end end function mp.positioncurve(name) local w, h, d = getwhd(name) if w then - fprint("((%p,%p)..(%p,%p)..(%p,%p)..(%p,%p)..cycle)",0,-d,w,-d,w,h,0,h) + mpfprint("((%p,%p)..(%p,%p)..(%p,%p)..(%p,%p)..cycle)",0,-d,w,-d,w,h,0,h) else - mprint("(origin--cycle)") + mpprint("(origin--cycle)") end end function mp.positionbox(name) local p, x, y, w, h, d = getposition(name) if p then - fprint("((%p,%p)--(%p,%p)--(%p,%p)--(%p,%p)--cycle)",x,y-d,x+w,y-d,x+w,y+h,x,y+h) + mpfprint("((%p,%p)--(%p,%p)--(%p,%p)--(%p,%p)--cycle)",x,y-d,x+w,y-d,x+w,y+h,x,y+h) else - mprint("(%p,%p)",x,y) + mpprint("(%p,%p)",x,y) end end function mp.positionxy(name) local x, y = getxy(name) if x then - fprint("(%p,%p)",x,y) + mpfprint("(%p,%p)",x,y) else - mprint("origin") + mpprint("origin") end end function mp.positionpage(name) - fprint("%i",getpage(name) or 0) + mpfprint("%i",getpage(name) or 0) end function mp.positionregion(name) local r = getregion(name) if r then - qprint(r) + mpquoted(r) else - qprint("unknown") + mpquoted("unknown") end end function mp.positionwhd(name) local w, h, d = getwhd(name) if w then - fprint("(%p,%p,%p)",w,h,d) + mpfprint("(%p,%p,%p)",w,h,d) else - mprint("(0,0,0)") + mpprint("(0,0,0)") end end function mp.positionpxy(name) local p, x, y = getposition(name) if p then - fprint("(%p,%p,%p)",p,x,y) + mpfprint("(%p,%p,%p)",p,x,y) else - mprint("(0,0,0)") + mpprint("(0,0,0)") end end function mp.positionanchor() - qprint(getmacro("MPanchorid")) + mpquoted(getmacro("MPanchorid")) end end @@ -1219,16 +1219,16 @@ end do - local mprint = mp.print - local qprint = mp.quoted + local mpprint = mp.print + local mpquoted = mp.quoted local getmacro = tokens.getters.macro function mp.texvar(name) - mprint(getmacro(metapost.namespace .. name)) + mpprint(getmacro(metapost.namespace .. name)) end function mp.texstr(name) - qprint(getmacro(metapost.namespace .. name)) + mpquoted(getmacro(metapost.namespace .. name)) end end @@ -1385,3 +1385,20 @@ function mp.flatten(t) end +do + + -- if needed we can optimize the sub (cache last split) + + local utflen = utf.len + local utfsub = utf.sub + + function mp.utflen(s) + mpnumeric(utflen(s)) + end + + function mp.utfsub(s,f,t) + mpquoted(utfsub(s,f,t or f)) + end + +end + diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua index 0250df35c..51491d513 100644 --- a/tex/context/base/mkiv/mlib-pps.lua +++ b/tex/context/base/mkiv/mlib-pps.lua @@ -25,6 +25,7 @@ local setmacro = interfaces.setmacro local texsetbox = tex.setbox local textakebox = tex.takebox -- or: nodes.takebox +local texruntoks = tex.runtoks local copy_list = node.copy_list local flush_list = node.flush_list local setmetatableindex = table.setmetatableindex @@ -250,6 +251,7 @@ local function startjob(plugmode,kind,mpx) top = { textexts = { }, -- all boxes, optionally with a different color texstrings = { }, + texregimes = { }, mapstrings = { }, mapindices = { }, mapmoves = { }, @@ -811,7 +813,13 @@ local tx_reset, tx_process do local mp_t = nil local function processtext() - local mp_text = top.texstrings[mp_index] + local mp_text = top.texstrings[mp_index] + local mp_regime = top.texregimes[mp_index] + if mp_regime and tonumber(mp_regime) >= 0 then + mp_text = function() + context.sprint(mp_regime,top.texstrings[mp_index] or "") + end + end if not mp_text then report_textexts("missing text for index %a",mp_index) elseif not mp_c then @@ -842,14 +850,15 @@ local tx_reset, tx_process do local madetext = nil - function mp.mf_some_text(index,str) + function mp.mf_some_text(index,str,regime) mp_target = index mp_index = index mp_c = nil mp_a = nil mp_t = nil top.texstrings[mp_index] = str - tex.runtoks("mptexttoks") + top.texregimes[mp_index] = regime or -1 + texruntoks("mptexttoks") local box = textakebox("mptextbox") top.textexts[mp_target] = box mp.triplet(bp*box.width,bp*box.height,bp*box.depth) @@ -857,7 +866,7 @@ local tx_reset, tx_process do end function mp.mf_made_text(index) - mp.mf_some_text(index,madetext) + mp.mf_some_text(index,madetext,catcodes.numbers.ctxcatcodes) -- btex/etex .. end -- a label can be anything, also something mp doesn't like in strings @@ -899,7 +908,7 @@ local tx_reset, tx_process do mp.triplet(top.mapmoves[index]) end - function mp.mf_map_text(index,str) + function mp.mf_map_text(index,str,regime) local map = top.mapindices[tonumber(str)] if type(map) == "table" then local text = map.text @@ -912,14 +921,16 @@ local tx_reset, tx_process do -- the image text if overload then top.texstrings[mp_index] = map.template or map.label or "error" - tex.runtoks("mptexttoks") + top.texregimes[mp_index] = regime or -1 + texruntoks("mptexttoks") local box = textakebox("mptextbox") or new_hlist() width = bp * box.width where = overload.where end -- the real text top.texstrings[mp_index] = overload and overload.text or text or "error" - tex.runtoks("mptexttoks") + top.texregimes[mp_index] = regime or -1 + texruntoks("mptexttoks") local box = textakebox("mptextbox") or new_hlist() local twd = bp * box.width local tht = bp * box.height @@ -1036,7 +1047,7 @@ local tx_reset, tx_process do local mp_hash = prescript.tx_cache local box if mp_hash == "no" then - tex.runtoks("mptexttoks") + texruntoks("mptexttoks") box = textakebox("mptextbox") else local cache = data.texhash @@ -1069,7 +1080,7 @@ local tx_reset, tx_process do if box then box = copy_list(box) else - tex.runtoks("mptexttoks") + texruntoks("mptexttoks") box = textakebox("mptextbox") cache[mp_hash] = box end @@ -1152,7 +1163,7 @@ local gt_reset, gt_process do if not graphics[index] then mp_index = index mp_str = str - tex.runtoks("mpgraphictexttoks") + texruntoks("mpgraphictexttoks") end end @@ -1573,7 +1584,7 @@ local ot_reset, ot_process do mp_index = index mp_kind = kind mp_str = str - tex.runtoks("mpoutlinetoks") + texruntoks("mpoutlinetoks") end end diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua index 07fa6a191..11bd1a9be 100644 --- a/tex/context/base/mkiv/mlib-run.lua +++ b/tex/context/base/mkiv/mlib-run.lua @@ -414,6 +414,7 @@ function metapost.load(name,method) extensions = 1, -- random_seed = seed, utf8_mode = true, + text_mode = true, } report_metapost("initializing number mode %a",method) local result diff --git a/tex/context/base/mkiv/mult-aux.mkxl b/tex/context/base/mkiv/mult-aux.mkxl index 3fed8c26e..7a5e60b29 100644 --- a/tex/context/base/mkiv/mult-aux.mkxl +++ b/tex/context/base/mkiv/mult-aux.mkxl @@ -224,8 +224,8 @@ {\noexpand#1}% \??aa \expandafter\noexpand\csname current#2\endcsname \expandafter\noexpand\csname #2parameter\endcsname - \expandafter\noexpand\csname do#2parameter\endcsname % or : #2_parameter - \expandafter\noexpand\csname do#2parentparameter\endcsname % or : #2_parent_parameter + \expandafter\noexpand\csname do#2parameter\endcsname % or: #2_parameter + \expandafter\noexpand\csname do#2parentparameter\endcsname % or: #2_parent_parameter \expandafter\noexpand\csname named#2parameter\endcsname \expandafter\noexpand\csname detokenized#2parameter\endcsname \expandafter\noexpand\csname direct#2parameter\endcsname diff --git a/tex/context/base/mkiv/mult-mps.lua b/tex/context/base/mkiv/mult-mps.lua index 6385d3fe5..d2bad606c 100644 --- a/tex/context/base/mkiv/mult-mps.lua +++ b/tex/context/base/mkiv/mult-mps.lua @@ -131,6 +131,10 @@ return { "join_radius", "charscale", -- actually a mult-fun one -- + "inicatcoderegime", "texcatcoderegime", "luacatcoderegime", "notcatcoderegime", + "vrbcatcoderegime", "prtcatcoderegime", "ctxcatcoderegime", "txtcatcoderegime", + "catcoderegime", + -- "ditto", "EOF", -- maybe also down etc -- "pen_lft", "pen_rt", "pen_top", "pen_bot", -- "pen_count_", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index e1a37260b..ffce2b40f 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -368,6 +368,7 @@ return { "tracingfonts", "unletfrozen", "unletprotected", + "vcentermode", "vpack", "wordboundary", "xtoksapp", diff --git a/tex/context/base/mkiv/spac-ver.mkxl b/tex/context/base/mkiv/spac-ver.mkxl index c56352077..0151fe311 100644 --- a/tex/context/base/mkiv/spac-ver.mkxl +++ b/tex/context/base/mkiv/spac-ver.mkxl @@ -877,12 +877,14 @@ \else \strutheightfactor\dimexpr\normallineheight \fi + \relax \strutdp\dimexpr \ifdim\minimumstrutdepth>\zeropoint \minimumstrutdepth \else \normallineheight-\strutht \fi + \relax \dosetstrut} \unexpanded\def\setstrutgridnop @@ -892,12 +894,14 @@ \else \strutheightfactor\dimexpr\normallineheight \fi + \relax \strutdp\spacingfactor\dimexpr \ifdim\minimumstrutdepth>\zeropoint \minimumstrutdepth \else \strutdepthfactor\dimexpr\normallineheight \fi + \relax \dosetstrut} \unexpanded\def\setcharstrut#1% diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 09ffdf972..2e95a65c9 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index d90426ecc..bd4830f83 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/strc-lst.mkvi b/tex/context/base/mkiv/strc-lst.mkvi index d29b1f6fd..6d64a9a28 100644 --- a/tex/context/base/mkiv/strc-lst.mkvi +++ b/tex/context/base/mkiv/strc-lst.mkvi @@ -367,6 +367,17 @@ \unexpanded\def\savedlisttitle #1#2{\clf_savedlisttitle {#1}\numexpr#2\relax} \unexpanded\def\savedlistprefixednumber#1#2{\clf_savedlistprefixednumber{#1}\numexpr#2\relax} +\newconditional\c_lists_show_realpage + +\installcorenamespace {listpagenumber} + +\setvalue{\??listpagenumber\v!always }{\settrue\c_lists_show_page\settrue\c_lists_has_page} +\setvalue{\??listpagenumber\v!yes }{\settrue\c_lists_show_page} +\setvalue{\??listpagenumber\s!realpage}{\settrue\c_lists_show_page\settrue\c_lists_show_realpage} + +\def\strc_lists_process_pagenumber#1% + {\begincsname\??listpagenumber#1\endcsname} + \def\structurelistlocation {\clf_listlocation\numexpr\currentlistindex\relax} @@ -375,23 +386,27 @@ \unexpanded\def\structurelistpagenumber {\dostarttagged\t!listpage\empty - \clf_listprefixedpage - {\currentlist}% - \currentlistindex - { - separatorset {\listparameter\c!pageprefixseparatorset} - conversionset {\listparameter\c!pageprefixconversionset} - set {\listparameter\c!pageprefixset} - segments {\listparameter\c!pageprefixsegments} - connector {\listparameter\c!pageprefixconnector} - }% - { - prefix {\listparameter\c!pageprefix} - conversionset {\listparameter\c!pageconversionset} - starter {\listparameter\c!pagestarter} - stopper {\listparameter\c!pagestopper} - }% - \relax + \ifconditional\c_lists_show_realpage + \clf_listrealpage{\currentlist}\numexpr\currentlistindex\relax + \else + \clf_listprefixedpage + {\currentlist}% + \currentlistindex + { + separatorset {\listparameter\c!pageprefixseparatorset} + conversionset {\listparameter\c!pageprefixconversionset} + set {\listparameter\c!pageprefixset} + segments {\listparameter\c!pageprefixsegments} + connector {\listparameter\c!pageprefixconnector} + }% + { + prefix {\listparameter\c!pageprefix} + conversionset {\listparameter\c!pageconversionset} + starter {\listparameter\c!pagestarter} + stopper {\listparameter\c!pagestopper} + }% + \relax + \fi \dostoptagged} \unexpanded\def\structurelistuservariable#name% @@ -891,17 +906,22 @@ % because these tests happen often and because we're dealing with % rather complex composed data we have special conditionals; keep % in mind that testing for empty fails do to tagging being applied - \edef\p_pagenumber{\listparameter\c!pagenumber}% - \ifx\p_pagenumber\v!always - \settrue\c_lists_has_page - \settrue\c_lists_show_page - \else +% \edef\p_pagenumber{\listparameter\c!pagenumber}% +% \ifx\p_pagenumber\v!always +% \settrue\c_lists_has_page +% \settrue\c_lists_show_page +% \else +% \doifelsestructurelisthaspage\settrue\setfalse\c_lists_has_page +% \ifx\p_pagenumber\v!yes +% \settrue\c_lists_show_page +% \else +% \setfalse\c_lists_show_page +% \fi +% \fi + \setfalse\c_lists_show_page % necessary? + \processcommacommand[\listparameter\c!pagenumber]\strc_lists_process_pagenumber + \ifconditional\c_lists_has_page \else \doifelsestructurelisthaspage\settrue\setfalse\c_lists_has_page - \ifx\p_pagenumber\v!yes - \settrue\c_lists_show_page - \else - \setfalse\c_lists_show_page - \fi \fi % always forces number placement (in bib we use a forced number) \edef\p_headnumber{\listparameter\c!headnumber}% @@ -933,6 +953,7 @@ \setfalse\c_lists_has_page \setfalse\c_lists_has_number \setfalse\c_lists_show_page + \setfalse\c_lists_show_realpage \setfalse\c_lists_show_number \to \t_lists_every_renderingcleanup diff --git a/tex/context/base/mkiv/supp-box.mkiv b/tex/context/base/mkiv/supp-box.mkiv index d43459c63..74a3462dd 100644 --- a/tex/context/base/mkiv/supp-box.mkiv +++ b/tex/context/base/mkiv/supp-box.mkiv @@ -2728,6 +2728,8 @@ %D %D Also new: tex mode \type {\vcenter}. +% not in lmtxmode: + \unexpanded\def\vcenter {\vbox\bgroup \dowithnextboxcs\syst_boxes_vcenter_finish\vbox} diff --git a/tex/context/base/mkiv/supp-box.mkxl b/tex/context/base/mkiv/supp-box.mkxl index e6ab96e89..912eefc63 100644 --- a/tex/context/base/mkiv/supp-box.mkxl +++ b/tex/context/base/mkiv/supp-box.mkxl @@ -2657,24 +2657,6 @@ \let\naturalvcenter\normalvtop % will go away -%D \macros -%D {vcenter} -%D -%D Also new: tex mode \type {\vcenter}. - -\unexpanded\def\vcenter - {\vbox\bgroup - \dowithnextboxcs\syst_boxes_vcenter_finish\vbox} - -\def\syst_boxes_vcenter_finish - {\hpack{\normalstartimath\vcenter{\box\nextbox}\normalstopimath}% - \egroup} - -% could be \everymathematics - -\prependtoks \let\vcenter\normalvcenter \to \everymath -\prependtoks \let\vcenter\normalvcenter \to \everydisplay - % \appendtoks \let\vcenter\normalvcenter \to \everymathematics %D \macros diff --git a/tex/context/base/mkiv/syst-ini.mkxl b/tex/context/base/mkiv/syst-ini.mkxl index 3a6deab9a..88fe2211b 100644 --- a/tex/context/base/mkiv/syst-ini.mkxl +++ b/tex/context/base/mkiv/syst-ini.mkxl @@ -1115,8 +1115,6 @@ %D Experiment: -\ifdefined\glyphdimensionsmode \else \newcount\glyphdimensionsmode \fi - \glyphdimensionsmode\plusone \protect \endinput diff --git a/tex/context/base/mkiv/trac-vis.mkiv b/tex/context/base/mkiv/trac-vis.mkiv index 570e6a7c7..14270214f 100644 --- a/tex/context/base/mkiv/trac-vis.mkiv +++ b/tex/context/base/mkiv/trac-vis.mkiv @@ -50,9 +50,10 @@ %D We only provide box visualizers as they can come in handy for testing %D macros. In due time we will move some of the m-visual code here too. -\let\syst_visualizers_hbox\hbox -\let\syst_visualizers_vbox\vbox -\let\syst_visualizers_vtop\vtop +\let\syst_visualizers_hbox \hbox +\let\syst_visualizers_vbox \vbox +\let\syst_visualizers_vtop \vtop +\let\syst_visualizers_vcenter\vcenter \let\syst_visualizers_hpack\hpack \let\syst_visualizers_vpack\vpack @@ -69,6 +70,27 @@ \unexpanded\def\ruledmbox#1{\ruledhbox{\startimath#1\stopimath}} +\ifcase\contextlmtxmode + + \unexpanded\def\sys_ruled_vcenter{\syst_visualizers_vcenter attr \visualattribute \clf_getvisual {simplevbox}} + + \unexpanded\def\ruledvcenter + {\ruledvbox\bgroup + \dowithnextboxcs\syst_boxes_ruled_vcenter_finish\ruledvbox} + + \def\syst_boxes_ruled_vcenter_finish + {\ruledhpack{\normalstartimath\ruledvcenter{\box\nextbox}\normalstopimath}% + \egroup} + + \prependtoks \let\ruledvcenter\sys_ruled_vcenter \to \everymath + \prependtoks \let\ruledvcenter\sys_ruled_vcenter \to \everydisplay + +\else + + \unexpanded\def\ruledvcenter{\syst_visualizers_vcenter attr \visualattribute \clf_getvisual {simplevbox}} + +\fi + \appendtoks \ifcase\c_syst_visualizers_state\else \syst_visualizers_speedup diff --git a/tex/context/interface/mkii/keys-en.xml b/tex/context/interface/mkii/keys-en.xml index d8c5c9c81..00922e743 100644 --- a/tex/context/interface/mkii/keys-en.xml +++ b/tex/context/interface/mkii/keys-en.xml @@ -913,7 +913,10 @@ + + + diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 682730c80..24e7b7b32 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 : 2020-04-08 14:34 +-- merge date : 2020-04-19 19:20 do -- begin closure to overcome local limits and interference @@ -29037,6 +29037,7 @@ local nesting=0 local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) local done=false local sweep=sweephead[head] + local start if sweep then start=sweep sweephead[head]=false @@ -29181,6 +29182,7 @@ end local function c_run_multiple(head,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) local done=false local sweep=sweephead[head] + local start if sweep then start=sweep sweephead[head]=false -- cgit v1.2.3