diff options
Diffstat (limited to 'tex')
45 files changed, 619 insertions, 792 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index b3dbc31a7..afb671bbd 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{2019.02.10 17:43} +\newcontextversion{2019.02.14 16:57} %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 c74bfda1f..f50ab529e 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{2019.02.10 17:43} +\edef\contextversion{2019.02.14 16:57} %D For those who want to use this: diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index c57c2e69b..f5035d3cf 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -2905,7 +2905,6 @@ local collectresults do -- too many locals otherwise local isglyph = nuts.isglyph local getkern = nuts.getkern local getwidth = nuts.getwidth - local getfield = nuts.getfield local nexthlist = nuts.traversers.hlist local nextnode = nuts.traversers.node diff --git a/tex/context/base/mkiv/back-ini.lua b/tex/context/base/mkiv/back-ini.lua index e21f0ce6d..94cdcd29f 100644 --- a/tex/context/base/mkiv/back-ini.lua +++ b/tex/context/base/mkiv/back-ini.lua @@ -6,36 +6,46 @@ if not modules then modules = { } end modules ['back-ini'] = { license = "see context related readme files" } --- -- how to create a shortcut: --- --- local function something(...) --- something = backends.codeinjections.something --- return something(...) --- end - local next, type = next, type local format = string.format +local sind, cosd, abs = math.sind, math.cosd, math.abs +local insert, remove = table.insert, table.remove +local unpack = unpack backends = backends or { } local backends = backends local trace_backend = false trackers.register("backend.initializers", function(v) trace_finalizers = v end) + +local report = logs.reporter("backend") local report_backend = logs.reporter("backend","initializing") local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex local setaction = nodes.tasks.setaction +local scanners = tokens.scanners +local scannumber = scanners.number +local scankeyword = scanners.keyword +local scancount = scanners.count +local scanstring = scanners.string + +local scanners = interfaces.scanners + +local implement = interfaces.implement + local texset = tex.set -local function nothing() return nil end +local nodeinjections = { } +local codeinjections = { } +local registrations = { } +local tables = allocate() -backends.nothing = nothing +local function nothing() + return nil +end -local nodeinjections = { } -local codeinjections = { } -local registrations = { } -local tables = allocate() +backends.nothing = nothing local function donothing(t,k) t[k] = nothing @@ -175,9 +185,132 @@ function codeinjections.getpagedimensions() return paper_width, paper_height end -interfaces.implement { +implement { name = "shipoutoffset", actions = function() context(lmtxmode() and "0pt" or "-1in") -- the old tex offset end } + +-- could also be codeinjections + +function backends.noflatelua() + return status.late_callbacks or 0 +end + +-- + +local stack = { } +local restore = true -- false + +local nodepool = nodes.pool +local savenode = nodepool.save +local restorenode = nodepool.restore +local setmatrixnode = nodepool.setmatrix + +-- updaters.register("backend.update",function() +-- savenode = nodepool.save +-- restorenode = nodepool.restore +-- setmatrixnode = nodepool.setmatrix +-- end) + +local function stopsomething() + local top = remove(stack) + if top == false then + -- not wrapped + elseif top == true then + context(restorenode()) + elseif top then + context(setmatrixnode(unpack(top))) -- not really needed anymore + context(restorenode()) + else + -- nesting error + end +end + +local function startrotation() + local a = scannumber() + if a == 0 then + insert(stack,false) + else + local s, c = sind(a), cosd(a) + if abs(s) < 0.000001 then + s = 0 -- otherwise funny -0.00000 + end + if abs(c) < 0.000001 then + c = 0 -- otherwise funny -0.00000 + end + context(savenode()) + context(setmatrixnode(c,s,-s,c)) + insert(stack,restore and { c, -s, s, c } or true) + end +end + +implement { name = "startrotation", actions = startrotation } +implement { name = "stoprotation", actions = stopsomething } + +local function startscaling() -- at the tex end we use sx and sy instead of rx and ry + local rx, ry = 1, 1 + while true do + if scankeyword("rx") then + rx = scannumber() + elseif scankeyword("ry") then + ry = scannumber() + -- elseif scankeyword("revert") then + -- local top = stack[#stack] + -- if top then + -- rx = top[1] + -- ry = top[4] + -- else + -- rx = 1 + -- ry = 1 + -- end + else + break + end + end + if rx == 1 and ry == 1 then + insert(stack,false) + else + if rx == 0 then + rx = 0.0001 + end + if ry == 0 then + ry = 0.0001 + end + context(savenode()) + context(setmatrixnode(rx,0,0,ry)) + insert(stack,restore and { 1/rx, 0, 0, 1/ry } or true) + end +end + +implement { name = "startscaling", actions = startscaling } +implement { name = "stopscaling", actions = stopsomething } + +local function startmatrix() -- rx sx sy ry -- tx, ty + local rx, sx, sy, ry = 1, 0, 0, 1 + while true do + if scankeyword("rx") then rx = scannumber() + elseif scankeyword("ry") then ry = scannumber() + elseif scankeyword("sx") then sx = scannumber() + elseif scankeyword("sy") then sy = scannumber() + else break end + end + if rx == 1 and sx == 0 and sy == 0 and ry == 1 then + insert(stack,false) + else + context(savenode()) + context(setmatrixnode(rx,sx,sy,ry)) + insert(stack,store and { -rx, -sx, -sy, -ry } or true) + end +end + +implement { name = "startmatrix", actions = startmatrix } +implement { name = "stopmatrix", actions = stopsomething } + +local function startmirroring() + context(setmatrixnode(-1,0,0,1)) +end + +implement { name = "startmirroring", actions = startmirroring } +implement { name = "stopmirroring", actions = startmirroring } -- not: stopsomething diff --git a/tex/context/base/mkiv/back-ini.mkiv b/tex/context/base/mkiv/back-ini.mkiv index 42af1165a..8729403f8 100644 --- a/tex/context/base/mkiv/back-ini.mkiv +++ b/tex/context/base/mkiv/back-ini.mkiv @@ -29,6 +29,8 @@ \registerctxluafile{back-ini}{} \registerctxluafile{back-res}{} +\doifelsefileexists{back-out.mkiv}{\loadmarkfile{back-out}}{} + %D We currently have a curious mix between tex and lua backend handling but %D eventually most will move to \LUA. @@ -54,13 +56,47 @@ %D Not everything here makes sense and the content of this file will definitely %D change (or even go away). -\let \dostartrotation \gobbleoneargument -\let \dostoprotation \donothing -\let \dostartscaling \gobbletwoarguments -\let \dostopscaling \donothing -\let \dostartmirroring \donothing -\let \dostopmirroring \donothing -\let \dotransformnextbox\gobblesixarguments % and pass last box +% rotation + +\unexpanded\def\dostartrotation#1% + {\forcecolorhack + \clf_startrotation#1\relax} % todo: implement without Q q + +\unexpanded\def\dostoprotation + {\clf_stoprotation + \forcecolorhack} + +% scaling + +\unexpanded\def\dostartscaling#1#2% + {\forcecolorhack + \clf_startscaling rx #1 ry #2\relax} + +\unexpanded\def\dostopscaling + {\clf_stopscaling + \forcecolorhack} + +% mirroring + +\unexpanded\def\dostartmirroring + {\clf_startmirroring} + +\unexpanded\def\dostopmirroring + {\clf_stopmirroring} + +% transform + +\unexpanded\def\dotransformnextbox#1#2#3#4#5#6% + {\dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}} + +\unexpanded\def\dodotransformnextbox#1#2#3#4#5#6% + {\hpack + {\kern #5\onebasepoint + \raise#6\onebasepoint + \hpack + {\clf_startmatrix rx #1 sx #2 sy #3 ry #4\relax + \box\nextbox + \clf_stopmatrix}}} %D \macros %D {back_ovalbox} diff --git a/tex/context/base/mkiv/back-pdf.lua b/tex/context/base/mkiv/back-pdf.lua index 7e4848ef8..cc8d31597 100644 --- a/tex/context/base/mkiv/back-pdf.lua +++ b/tex/context/base/mkiv/back-pdf.lua @@ -6,182 +6,10 @@ if not modules then modules = { } end modules ['back-pdf'] = { license = "see context related readme files" } --- we could do \pdfmatrix sx <> sy <> etc - -local sind, cosd, abs = math.sind, math.cosd, math.abs -local insert, remove = table.insert, table.remove - -local codeinjections = backends.pdf.codeinjections - -local context = context - -local scanners = tokens.scanners -local scannumber = scanners.number -local scankeyword = scanners.keyword -local scancount = scanners.count -local scanstring = scanners.string - -local scanners = interfaces.scanners -local implement = interfaces.implement - -local report = logs.reporter("backend") - -local outputfilename - -function codeinjections.getoutputfilename() - if not outputfilename then - outputfilename = file.addsuffix(tex.jobname,"pdf") - end - return outputfilename -end - -backends.install("pdf") - --- local f_matrix = string.formatters["%F %F %F %F"] -- 0.8 is default --- --- scanners.pdfrotation = function() -- a --- -- todo: check for 1 and 0 and flush sparse --- local a = scannumber() --- local s, c = sind(a), cosd(a) --- context(f_matrix(c,s,-s,c)) --- end - --- experimental code (somewhat weird here) .. todo: nodeinjections .. this will only work --- out well if we also calculate the accumulated cm and wrap inclusions / annotations in --- the accumulated ... it's a mess --- --- we could also do the save restore wrapping here + colorhack - -local nodepool = nodes.pool -local pdfsave = nodepool.pdfsave -local pdfrestore = nodepool.pdfrestore -local pdfsetmatrix = nodepool.pdfsetmatrix - -local stack = { } -local restore = true -- false - -local function pdfstopsomething() - local top = remove(stack) - if top == false then - -- not wrapped - elseif top == true then - context(pdfrestore()) - elseif top then - context(pdfsetmatrix(unpack(top))) -- not really needed anymore - context(pdfrestore()) - else - -- nesting error - end -end - -local function pdfstartrotation() - local a = scannumber() - if a == 0 then - insert(stack,false) - else - local s, c = sind(a), cosd(a) - if abs(s) < 0.000001 then - s = 0 -- otherwise funny -0.00000 - end - if abs(c) < 0.000001 then - c = 0 -- otherwise funny -0.00000 - end - context(pdfsave()) - context(pdfsetmatrix(c,s,-s,c)) - insert(stack,restore and { c, -s, s, c } or true) - end -end - -implement { name = "pdfstartrotation", actions = pdfstartrotation } -implement { name = "pdfstoprotation", actions = pdfstopsomething } - -local function pdfstartscaling() -- at the tex end we use sx and sy instead of rx and ry - local rx, ry = 1, 1 - while true do - if scankeyword("rx") then - rx = scannumber() - elseif scankeyword("ry") then - ry = scannumber() - -- elseif scankeyword("revert") then - -- local top = stack[#stack] - -- if top then - -- rx = top[1] - -- ry = top[4] - -- else - -- rx = 1 - -- ry = 1 - -- end - else - break - end - end - if rx == 1 and ry == 1 then - insert(stack,false) - else - if rx == 0 then - rx = 0.0001 - end - if ry == 0 then - ry = 0.0001 - end - context(pdfsave()) - context(pdfsetmatrix(rx,0,0,ry)) - insert(stack,restore and { 1/rx, 0, 0, 1/ry } or true) - end -end - -implement { name = "pdfstartscaling", actions = pdfstartscaling } -implement { name = "pdfstopscaling", actions = pdfstopsomething } - -local function pdfstartmatrix() -- rx sx sy ry -- tx, ty - local rx, sx, sy, ry = 1, 0, 0, 1 - while true do - if scankeyword("rx") then rx = scannumber() - elseif scankeyword("ry") then ry = scannumber() - elseif scankeyword("sx") then sx = scannumber() - elseif scankeyword("sy") then sy = scannumber() - else break end - end - if rx == 1 and sx == 0 and sy == 0 and ry == 1 then - insert(stack,false) - else - context(pdfsave()) - context(pdfsetmatrix(rx,sx,sy,ry)) - insert(stack,store and { -rx, -sx, -sy, -ry } or true) - end -end - -implement { name = "pdfstartmatrix", actions = pdfstartmatrix } -implement { name = "pdfstopmatrix", actions = pdfstopsomething } - -local function pdfstartmirroring() - context(pdfsetmatrix(-1,0,0,1)) -end - -implement { name = "pdfstartmirroring", actions = pdfstartmirroring } -implement { name = "pdfstopmirroring", actions = pdfstartmirroring } -- not: pdfstopsomething - -if environment.arguments.nocompression then - lpdf.setcompression(0,0,true) -end - --- todo: - -implement { - name = "setmapfile", - arguments = "string", - actions = lpdf.setmapfile -} - -implement { - name = "setmapline", - arguments = "string", - actions = lpdf.setmapline -} - -implement { +interfaces.implement { name = "setpdfcompression", arguments = { "integer", "integer" }, actions = lpdf.setcompression, } +backends.install("pdf") diff --git a/tex/context/base/mkiv/back-pdf.mkiv b/tex/context/base/mkiv/back-pdf.mkiv index c523d30b7..9e88ab193 100644 --- a/tex/context/base/mkiv/back-pdf.mkiv +++ b/tex/context/base/mkiv/back-pdf.mkiv @@ -15,7 +15,6 @@ \writestatus{loading}{ConTeXt Backend Macros / PDF} -%registerctxluafile{lpdf-aux}{optimize} % common helpers \registerctxluafile{lpdf-ini}{optimize} \registerctxluafile{lpdf-nod}{} \registerctxluafile{lpdf-col}{} @@ -34,25 +33,19 @@ \registerctxluafile{lpdf-fmt}{} \registerctxluafile{lpdf-pde}{} -\doifelsefileexists {lpdf-emb.lua} { +\ifcase\contextlmtxmode\else \registerctxluafile{lpdf-img}{optimize} -} { - % nothing -} +\fi \registerctxluafile{lpdf-epa}{} -\doifelsefileexists {lpdf-emb.lua} { +\ifcase\contextlmtxmode\else \registerctxluafile{lpdf-emb}{optimize} -} { - % nothing -} +\fi \registerctxluafile{back-pdp}{} -\ifnum\texenginefunctionality>6856 - \registerctxluafile{lpdf-fnt}{} -\fi +\registerctxluafile{lpdf-fnt}{} \registerctxluafile{back-pdf}{} % some code will move to lpdf-* @@ -103,15 +96,16 @@ %D I'll write a parser that maps onto \CONTEXT. \unexpanded\def\unsupportedpdfprimitive#1% - {\writestatus{error}{the primitive \string#1\space is not supported}} + {\writestatus{fatal error}{the primitive \string#1\space is not supported}% + \directlua{os.exit()}} \unexpanded\def\pdfcolorstack {\unsupportedpdfprimitive\pdfcolorstack} \unexpanded\def\pdfcolorstackinit{\unsupportedpdfprimitive\pdfcolorstackinit} -%unexpanded\def\pdfannot {\unsupportedpdfprimitive\pdfannot} +% pdfannot \unexpanded\def\pdfstartlink {\unsupportedpdfprimitive\pdfstartlink} \unexpanded\def\pdfendlink {\unsupportedpdfprimitive\pdfendlink} \unexpanded\def\pdfoutline {\unsupportedpdfprimitive\pdfoutline} -%unexpanded\def\pdfdest {\unsupportedpdfprimitive\pdfdest} +% pdfdest \unexpanded\def\pdfthread {\unsupportedpdfprimitive\pdfthread} \unexpanded\def\pdfstartthread {\unsupportedpdfprimitive\pdfstartthread} \unexpanded\def\pdfendthread {\unsupportedpdfprimitive\pdfendthread} @@ -149,8 +143,8 @@ %D These might even become no-ops as we don't need them in \CONTEXT: -\unexpanded\def\pdfmapfile#1{\clf_setmapfile{#1}} -\unexpanded\def\pdfmapline#1{\clf_setmapline{#1}} +\unexpanded\def\pdfmapfile#1{} % obsolete +\unexpanded\def\pdfmapline#1{} % obsolete %D We don't support these directives, at least not this way. If they are needed %D by third party modules we can provide some interface. @@ -277,84 +271,6 @@ \def\pdfcolor #1{\clf_lpdf_color\numexpr\thecolorattribute{#1}\relax} \let\PDFcolor\pdfcolor -%D Transformations - -% rotation - -\unexpanded\def\dostartrotation#1% - {\forcecolorhack - \clf_pdfstartrotation#1\relax} % todo: implement without Q q - -\unexpanded\def\dostoprotation - {\clf_pdfstoprotation - \forcecolorhack} - -% scaling - -\unexpanded\def\dostartscaling#1#2% - {\forcecolorhack - \clf_pdfstartscaling rx #1 ry #2\relax} - -\unexpanded\def\dostopscaling - {\clf_pdfstopscaling - \forcecolorhack} - -% mirroring - -\unexpanded\def\dostartmirroring - {\clf_pdfstartmirroring} - -\unexpanded\def\dostopmirroring - {\clf_pdfstopmirroring} - -% transform - -\unexpanded\def\dotransformnextbox#1#2#3#4#5#6% - {\dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}} - -\unexpanded\def\dodotransformnextbox#1#2#3#4#5#6% - {\hpack - {\kern #5\onebasepoint - \raise#6\onebasepoint - \hpack - {\clf_pdfstartmatrix rx #1 sx #2 sy #3 ry #4\relax - \box\nextbox - \clf_pdfstopmatrix}}} - -% somehow the shift is not happening .. bug in luatex? -% -% \unexpanded\def\dodotransformnextbox#1#2#3#4#5#6% -% {\ctxcommand{pdftransformbox(\number\nextbox,#1,#2,#3,#4,\number\dimexpr#5\onebasepoint,\number\dimexpr#6\onebasepoint)}% -% \box\nextbox} -% -% \startluacode -% function commands.pdftransformbox(box,rx,sx,sy,ry,tx,ty) -% if rx == 1 and sx == 0 and sy == 0 and ry == 1 then -% if tx == 0 and ty == 0 then -% local b = nodes.hpack(nodes.concat { -% nodes.pool.kern(tx), -% nodes.takebox(box), -% }) -% b.shift = -ty -% tex.setbox(box,b) -% else -% -- no need to transform -% end -% else -% local b = nodes.hpack(nodes.concat { -% nodes.pool.kern(tx), -% nodes.pool.pdfsave(), -% nodes.pool.pdfsetmatrix(rx,sx,sy,ry), -% nodes.takebox(box), -% nodes.pool.pdfsetmatrix(-rx,-sx,-sy,-ry), -% nodes.pool.pdfrestore(), -% }) -% b.shift = -ty -% tex.setbox(box,b) -% end -% end -% \stopluacode - % clipping \unexpanded\def\dostartclipping#1#2#3% we can move this to lua and only set a box here diff --git a/tex/context/base/mkiv/back-pdp.lua b/tex/context/base/mkiv/back-pdp.lua index 178fe98fb..7363cfcae 100644 --- a/tex/context/base/mkiv/back-pdp.lua +++ b/tex/context/base/mkiv/back-pdp.lua @@ -33,10 +33,10 @@ local report = logs.reporter("command") local nodepool = nodes.pool local newsavepos = nodepool.savepos -local newliteral = nodepool.pdfliteral -local newsave = nodepool.pdfsave -local newrestore = nodepool.pdfrestore -local newsetmatrix = nodepool.pdfsetmatrix +local newliteral = nodepool.literal +local newsave = nodepool.save +local newrestore = nodepool.restore +local newsetmatrix = nodepool.setmatrix local implement = interfaces.implement local constants = interfaces.constants diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 555ab05e5..f9d8a6b2c 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.02.10 17:43} +\newcontextversion{2019.02.14 16:57} %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/cont-run.lua b/tex/context/base/mkiv/cont-run.lua index 2ffbd24dd..2634654fe 100644 --- a/tex/context/base/mkiv/cont-run.lua +++ b/tex/context/base/mkiv/cont-run.lua @@ -197,11 +197,7 @@ local preparejob preparejob = function() -- tricky: we need a hook for this local arguments = environment.arguments - if arguments.lmtx or CONTEXTLMTXMODE then - report("enabling lmtx mode") - context.enablelmtx() - environment.lmtxmode = true - end + environment.lmtxmode = CONTEXTLMTXMODE if arguments.nosynctex then luatex.synctex.setup { diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 9e8d20c99..f8ab3d7a6 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,9 +42,13 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.02.10 17:43} +\edef\contextversion{2019.02.14 16:57} \edef\contextkind {beta} +%D Kind of special: + +\chardef\contextlmtxmode\directlua{tex.print(CONTEXTLMTXMODE and 1 or 0)}\relax + %D For those who want to use this: \let\fmtname \contextformat @@ -62,6 +66,8 @@ \def\loadmkiifile#1{} \def\loadmkivfile#1{\normalinput#1.mkiv\relax} \def\loadmkvifile#1{\normalinput#1.mkvi\relax} +\def\loadlmtxfile#1{\ifcase\contextlmtxmode\else\normalinput#1.mkiv\relax\fi} + %D First we load the system modules. These implement a lot of %D manipulation macros. We start with setting up some basic \TEX\ @@ -77,8 +83,8 @@ %D We just quit if new functionality is expected. -\ifnum\luatexversion<108 % also change message - \writestatus{!!!!}{Your luatex binary is too old, you need at least version 1.08!} +\ifnum\luatexversion<109 % also change message + \writestatus{!!!!}{Your luatex binary is too old, you need at least version 1.09!} \expandafter\end \fi @@ -127,14 +133,11 @@ \loadmarkfile{luat-usr} -% \loadmarkfile{luat-ini} % moved up -% \loadmarkfile{toks-ini} % moved up - \loadmkvifile{file-ini} \loadmkvifile{file-res} \loadmkvifile{file-lib} -\doifelsefileexists{core-lmt.mkiv}{\loadmarkfile{core-lmt}}{} +\loadlmtxfile{core-lmt} % needs more checking for clashes: % @@ -181,6 +184,8 @@ \loadmarkfile{node-mig} %loadmarkfile{node-pag} +\loadmarkfile{driv-ini} + \loadmarkfile{back-ini} \loadmarkfile{attr-col} @@ -595,8 +600,7 @@ \loadmarkfile{cont-run} % the main runner (used in cont-yes.mkiv) -\doifelsefileexists{back-out.mkiv}{\loadmarkfile{back-out}}{} -\doifelsefileexists{back-shp.mkiv}{\loadmarkfile{back-shp}}{} +\loadlmtxfile{driv-shp} \setupcurrentlanguage[\defaultlanguagetag] diff --git a/tex/context/base/mkiv/core-uti.lua b/tex/context/base/mkiv/core-uti.lua index 7c70cee7a..cd867db1b 100644 --- a/tex/context/base/mkiv/core-uti.lua +++ b/tex/context/base/mkiv/core-uti.lua @@ -400,7 +400,7 @@ function statistics.callbacks() local c_internal = status.callbacks or 0 local c_file = status.indirect_callbacks or 0 local c_direct = status.direct_callbacks or 0 - local c_late = status.late_callbacks or 0 + local c_late = backends.noflatelua() or 0 local c_function = status.function_callbacks or 0 local c_total = c_internal + c_file + c_direct + c_late + c_function local n_pages = texgetcount('realpageno') - 1 diff --git a/tex/context/base/mkiv/driv-ini.lua b/tex/context/base/mkiv/driv-ini.lua new file mode 100644 index 000000000..e16327f27 --- /dev/null +++ b/tex/context/base/mkiv/driv-ini.lua @@ -0,0 +1,194 @@ +if not modules then modules = { } end modules ['driv-ini'] = { + version = 1.001, + comment = "companion to driv-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type = type +local addsuffix = file.addsuffix + +local setmetatableindex = table.setmetatableindex +local formatters = string.formatters + +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming + +local report = logs.reporter("drivers") + +local instances = { } +local helpers = { } +local prepared = { } +local wrappedup = { } +local currentdriver = "default" + +local prepare = nil +local convert = nil +local wrapup = nil +local outputfilename = nil + +drivers = drivers or { + instances = instances, + helpers = helpers, + lmtxversion = 0.10, +} + +local dummy = function() end + +local defaulthandlers = { + prepare = dummy, + initialize = dummy, + finalize = dummy, + updatefontstate = dummy, + wrapup = dummy, + convert = dummy, + outputfilename = dummy, +} + +function drivers.install(specification) + local name = specification.name + if not name then + report("missing driver name") + return + end + local actions = specification.actions + if not actions then + report("no actions for driver %a",name) + return + end + local flushers = specification.flushers + if not flushers then + report("no flushers for driver %a",name) + return + end + setmetatableindex(actions,defaulthandlers) + instances[name] = specification +end + +function drivers.convert(boxnumber) + callbacks.functions.start_page_number() + starttiming(drivers) + convert(boxnumber) + stoptiming(drivers) + callbacks.functions.stop_page_number() +end + +function drivers.outputfilename() + return outputfilename() +end + + +luatex.wrapup(function() + if not wrappedup[currentdriver] then + starttiming(drivers) + wrapup() + stoptiming(drivers) + wrappedup[currentdriver] = true + end +end) + +function drivers.enable(name) + currentdriver = name or "default" + local actions = instances[currentdriver].actions + prepare = actions.prepare + wrapup = actions.wrapup + convert = actions.convert + outputfilename = actions.outputfilename + -- + if prepare and not prepared[currentdriver] then + starttiming(drivers) + prepare() + stoptiming(drivers) + prepared[currentdriver] = true + end +end + +statistics.register("driver time",function() + return statistics.elapsedseconds(drivers) +end) + +interfaces.implement { + name = "shipoutpage", + arguments = "integer", + actions = drivers.convert, +} + +interfaces.implement { + name = "enabledriver", + arguments = "string", + actions = drivers.enable, +} + +-- The default driver: + +do + + local filename = nil + + drivers.install { + name = "default", + actions = { + convert = tex.shipout, + outputfilename = function() + if not filename then + filename = addsuffix(tex.jobname,"pdf") + end + return filename + end, + }, + flushers = { + -- we always need this entry + }, + } + +end + +setmetatableindex(instances,function() return instances.default end) + +-- for now: + +drivers.enable("default") + +-- helpers + +local s_matrix_0 = "1 0 0 1" +local f_matrix_2 = formatters["%.6F 0 0 %.6F"] +local f_matrix_4 = formatters["%.6F %.6F %.6F %.6F"] + +directives.register("pdf.stripzeros",function() + f_matrix_2 = formatters["%.6N 0 0 %.6N"] + f_matrix_4 = formatters["%.6N %.6N %.6N %.6N"] +end) + +function helpers.tomatrix(rx,sx,sy,ry,tx,ty) -- todo: tx ty + if type(rx) == "string" then + return rx + else + if not rx then + rx = 1 + elseif rx == 0 then + rx = 0.0001 + end + if not ry then + ry = 1 + elseif ry == 0 then + ry = 0.0001 + end + if not sx then + sx = 0 + end + if not sy then + sy = 0 + end + if sx == 0 and sy == 0 then + if rx == 1 and ry == 1 then + return s_matrix_0 + else + return f_matrix_2(rx,ry) + end + else + return f_matrix_4(rx,sx,sy,ry) + end + end +end diff --git a/tex/context/base/mkiv/driv-ini.mkiv b/tex/context/base/mkiv/driv-ini.mkiv new file mode 100644 index 000000000..95b6c88a7 --- /dev/null +++ b/tex/context/base/mkiv/driv-ini.mkiv @@ -0,0 +1,25 @@ +%D \module +%D [ file=driv-ini, +%D version=2018.07.26, +%D title=\CONTEXT\ Driver Macros, +%D subtitle=Initialization, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Driver Macros / Initialization} + +\registerctxluafile{driv-ini}{} + +\unprotect + +\def\page_shipout_box#1% + {\clf_shipoutpage#1\relax + \setbox#1\emptybox + \global\deadcycles\zerocount} + +\protect \endinput diff --git a/tex/context/base/mkiv/grph-inc.mkiv b/tex/context/base/mkiv/grph-inc.mkiv index 15152e994..6379c150d 100644 --- a/tex/context/base/mkiv/grph-inc.mkiv +++ b/tex/context/base/mkiv/grph-inc.mkiv @@ -20,15 +20,14 @@ \writestatus{loading}{ConTeXt Graphic Macros / Figure Inclusion} -\doifelsefileexists {grph-img.lua} { +\ifcase\contextlmtxmode + \registerctxluafile{grph-inc}{} +\else \registerctxluafile{grph-img}{} -} {} - -\registerctxluafile{grph-inc}{} - -\doifelsefileexists {grph-chk.lua} { + \registerctxluafile{grph-inc}{} + \registerctxluafile{grph-bmp}{} \registerctxluafile{grph-chk}{} -} {} +\fi \registerctxluafile{grph-con}{} \registerctxluafile{grph-fil}{} diff --git a/tex/context/base/mkiv/grph-pat.lua b/tex/context/base/mkiv/grph-pat.lua index 1b5f1fd29..e38a9a674 100644 --- a/tex/context/base/mkiv/grph-pat.lua +++ b/tex/context/base/mkiv/grph-pat.lua @@ -15,7 +15,7 @@ local texsetbox = tex.setbox local texgetbox = tex.getbox local nodepool = nodes.pool -local new_literal = nodepool.pdforiginliteral -- really ? +local new_literal = nodepool.originliteral -- really ? local new_hlist = nodepool.hlist local names = { } diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua index 9dc60e7a9..bf9d6926f 100644 --- a/tex/context/base/mkiv/lpdf-ano.lua +++ b/tex/context/base/mkiv/lpdf-ano.lua @@ -65,8 +65,6 @@ local executers = references.executers local nodepool = nodes.pool ------ pdfannotation_node = nodepool.pdfannotation ------ pdfdestination_node = nodepool.pdfdestination local new_latelua = nodepool.latelua local texgetcount = tex.getcount diff --git a/tex/context/base/mkiv/lpdf-col.lua b/tex/context/base/mkiv/lpdf-col.lua index 3a541f962..1645a72ed 100644 --- a/tex/context/base/mkiv/lpdf-col.lua +++ b/tex/context/base/mkiv/lpdf-col.lua @@ -23,7 +23,7 @@ local registrations = backends.pdf.registrations local nodepool = nodes.nuts.pool local register = nodepool.register -local pdfpageliteral = nodepool.pdfpageliteral +local pageliteral = nodepool.pageliteral local pdfconstant = lpdf.constant local pdfdictionary = lpdf.dictionary @@ -129,26 +129,26 @@ lpdf.registerpagefinalizer(addpagegroup,3,"pagegroup") -- color injection function nodeinjections.rgbcolor(r,g,b) - return register(pdfpageliteral(f_rgb(r,g,b,r,g,b))) + return register(pageliteral(f_rgb(r,g,b,r,g,b))) end function nodeinjections.cmykcolor(c,m,y,k) - return register(pdfpageliteral(f_cmyk(c,m,y,k,c,m,y,k))) + return register(pageliteral(f_cmyk(c,m,y,k,c,m,y,k))) end function nodeinjections.graycolor(s) -- caching 0/1 does not pay off - return register(pdfpageliteral(f_gray(s,s))) + return register(pageliteral(f_gray(s,s))) end function nodeinjections.spotcolor(n,f,d,p) if type(p) == "string" then p = gsub(p,","," ") -- brr misuse of spot end - return register(pdfpageliteral(f_spot(n,n,p,p))) + return register(pageliteral(f_spot(n,n,p,p))) end function nodeinjections.transparency(n) - return register(pdfpageliteral(f_tr_gs(n))) + return register(pageliteral(f_tr_gs(n))) end -- a bit weird but let's keep it here for a while @@ -167,7 +167,7 @@ function nodeinjections.effect(effect,stretch,rulethickness) -- always, no zero test (removed) rulethickness = bp * rulethickness effect = effects[effect] or effects['normal'] - return register(pdfpageliteral(f_effect(stretch,rulethickness,effect))) -- watch order + return register(pageliteral(f_effect(stretch,rulethickness,effect))) -- watch order end -- spot- and indexcolors diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua index c502f3f72..19f2d7504 100644 --- a/tex/context/base/mkiv/lpdf-ini.lua +++ b/tex/context/base/mkiv/lpdf-ini.lua @@ -1547,7 +1547,7 @@ do local f_actual_text = formatters["/Span <</ActualText %s >> BDC"] local context = context - local pdfdirect = nodes.pool.pdfdirectliteral -- we can use nuts.write deep down + local pdfdirect = nodes.pool.directliteral -- we can use nuts.write deep down -- todo: use tounicode from the font mapper @@ -1733,4 +1733,10 @@ do end +-- a left-over + +if environment.arguments.nocompression then + lpdf.setcompression(0,0,true) +end + diff --git a/tex/context/base/mkiv/lpdf-mis.lua b/tex/context/base/mkiv/lpdf-mis.lua index c8071e5d7..1d2e07310 100644 --- a/tex/context/base/mkiv/lpdf-mis.lua +++ b/tex/context/base/mkiv/lpdf-mis.lua @@ -29,7 +29,7 @@ local nuts = nodes.nuts local copy_node = nuts.copy local nodepool = nuts.pool -local pdfpageliteral = nodepool.pdfpageliteral +local pageliteral = nodepool.pageliteral local register = nodepool.register local pdfdictionary = lpdf.dictionary @@ -77,10 +77,10 @@ local v_lefttoright = variables.lefttoright local v_righttoleft = variables.righttoleft local v_title = variables.title -local positive = register(pdfpageliteral("/GSpositive gs")) -local negative = register(pdfpageliteral("/GSnegative gs")) -local overprint = register(pdfpageliteral("/GSoverprint gs")) -local knockout = register(pdfpageliteral("/GSknockout gs")) +local positive = register(pageliteral("/GSpositive gs")) +local negative = register(pageliteral("/GSnegative gs")) +local overprint = register(pageliteral("/GSoverprint gs")) +local knockout = register(pageliteral("/GSknockout gs")) local omitextraboxes = false diff --git a/tex/context/base/mkiv/lpdf-nod.lua b/tex/context/base/mkiv/lpdf-nod.lua index 9d4bf9270..d5c1f6b46 100644 --- a/tex/context/base/mkiv/lpdf-nod.lua +++ b/tex/context/base/mkiv/lpdf-nod.lua @@ -6,9 +6,9 @@ if not modules then modules = { } end modules ['lpdf-nod'] = { license = "see context related readme files" } -local type = type - -local formatters = string.formatters +if CONTEXTLMTXMODE then + return +end local nodecodes = nodes.nodecodes local whatsitcodes = nodes.whatsitcodes @@ -16,7 +16,6 @@ local whatsitcodes = nodes.whatsitcodes local nodeinjections = backends.nodeinjections local nuts = nodes.nuts -local tonut = nuts.tonut local setfield = nuts.setfield local setdata = nuts.setdata @@ -40,244 +39,51 @@ local pageliteral_code = literalvalues.page local directliteral_code = literalvalues.direct local rawliteral_code = literalvalues.raw -local s_matrix_0 = "1 0 0 1" -local f_matrix_2 = formatters["%.6F 0 0 %.6F"] -local f_matrix_4 = formatters["%.6F %.6F %.6F %.6F"] - -directives.register("pdf.stripzeros",function() - f_matrix_2 = formatters["%.6N 0 0 %.6N"] - f_matrix_4 = formatters["%.6N %.6N %.6N %.6N"] -end) - -local function tomatrix(rx,sx,sy,ry,tx,ty) -- todo: tx ty - if type(rx) == "string" then - return rx - else - if not rx then - rx = 1 - elseif rx == 0 then - rx = 0.0001 - end - if not ry then - ry = 1 - elseif ry == 0 then - ry = 0.0001 - end - if not sx then - sx = 0 - end - if not sy then - sy = 0 - end - if sx == 0 and sy == 0 then - if rx == 1 and ry == 1 then - return s_matrix_0 - else - return f_matrix_2(rx,ry) - end - else - return f_matrix_4(rx,sx,sy,ry) - end - end -end - -if CONTEXTLMTXMODE then - - local nodeproperties = nodes.properties.data - - local pdfliteral = register(new_node(whatsit_code,literalwhatsit_code)) - - function nodepool.pdforiginliteral(str) local t = copy_node(pdfliteral) nodeproperties[t] = { data = str, mode = originliteral_code } return t end - function nodepool.pdfpageliteral (str) local t = copy_node(pdfliteral) nodeproperties[t] = { data = str, mode = pageliteral_code } return t end - function nodepool.pdfdirectliteral(str) local t = copy_node(pdfliteral) nodeproperties[t] = { data = str, mode = directliteral_code } return t end - function nodepool.pdfrawliteral (str) local t = copy_node(pdfliteral) nodeproperties[t] = { data = str, mode = rawliteral_code } return t end - - local pdfliterals = { - -- by number - [originliteral_code] = originliteral_code, - [pageliteral_code] = pageliteral_code, - [directliteral_code] = directliteral_code, - [rawliteral_code] = rawliteral_code, - -- by name - [literalvalues[originliteral_code]] = originliteral_code, - [literalvalues[pageliteral_code]] = pageliteral_code, - [literalvalues[directliteral_code]] = directliteral_code, - [literalvalues[rawliteral_code]] = rawliteral_code, - } - - function nodepool.pdfliteral(mode,str) - local t = copy_node(pdfliteral) - if str then - nodeproperties[t] = { data = str, mode = pdfliterals[mode] or pageliteral_code } - else - nodeproperties[t] = { data = mode, mode = pageliteral_code } - end - return t - end - -else - - local pdforiginliteral = register(new_node(whatsit_code, literalwhatsit_code)) setfield(pdforiginliteral,"mode",originliteral_code) - local pdfpageliteral = register(new_node(whatsit_code, literalwhatsit_code)) setfield(pdfpageliteral, "mode",pageliteral_code) - local pdfdirectliteral = register(new_node(whatsit_code, literalwhatsit_code)) setfield(pdfdirectliteral,"mode",directliteral_code) - local pdfrawliteral = register(new_node(whatsit_code, literalwhatsit_code)) setfield(pdfrawliteral, "mode",rawliteral_code) - - function nodepool.pdforiginliteral(str) local t = copy_node(pdforiginliteral) setdata(t,str) return t end - function nodepool.pdfpageliteral (str) local t = copy_node(pdfpageliteral ) setdata(t,str) return t end - function nodepool.pdfdirectliteral(str) local t = copy_node(pdfdirectliteral) setdata(t,str) return t end - function nodepool.pdfrawliteral (str) local t = copy_node(pdfrawliteral ) setdata(t,str) return t end +local tomatrix = drivers.helpers.tomatrix - local pdfliterals = { - -- by number - [originliteral_code] = pdforiginliteral, - [pageliteral_code] = pdfpageliteral, - [directliteral_code] = pdfdirectliteral, - [rawliteral_code] = pdfrawliteral, - -- by name - [literalvalues[originliteral_code]] = pdforiginliteral, - [literalvalues[pageliteral_code]] = pdfpageliteral, - [literalvalues[directliteral_code]] = pdfdirectliteral, - [literalvalues[rawliteral_code]] = pdfrawliteral, - } +local originliteralnode = register(new_node(whatsit_code, literalwhatsit_code)) setfield(originliteralnode,"mode",originliteral_code) +local pageliteralnode = register(new_node(whatsit_code, literalwhatsit_code)) setfield(pageliteralnode, "mode",pageliteral_code) +local directliteralnode = register(new_node(whatsit_code, literalwhatsit_code)) setfield(directliteralnode,"mode",directliteral_code) +local rawliteralnode = register(new_node(whatsit_code, literalwhatsit_code)) setfield(rawliteralnode, "mode",rawliteral_code) - function nodepool.pdfliteral(mode,str) - if str then - local t = copy_node(pdfliterals[mode] or pdfpageliteral) - setdata(t,str) - return t - else - local t = copy_node(pdfpageliteral) - setdata(t,mode) - return t - end - end - -end - -local pdfsave = register(new_node(whatsit_code, savewhatsit_code)) -local pdfrestore = register(new_node(whatsit_code, restorewhatsit_code)) -local pdfsetmatrix = register(new_node(whatsit_code, setmatrixwhatsit_code)) - -function nodepool.pdfsave() - return copy_node(pdfsave) -end - -function nodepool.pdfrestore() - return copy_node(pdfrestore) -end - -if CONTEXTLMTXMODE then +function nodepool.originliteral(str) local t = copy_node(originliteralnode) setdata(t,str) return t end +function nodepool.pageliteral (str) local t = copy_node(pageliteralnode ) setdata(t,str) return t end +function nodepool.directliteral(str) local t = copy_node(directliteralnode) setdata(t,str) return t end +function nodepool.rawliteral (str) local t = copy_node(rawliteralnode ) setdata(t,str) return t end - local nodeproperties = nodes.properties.data +local literals = { + [originliteral_code] = originliteralnode, [literalvalues[originliteral_code]] = originliteralnode, + [pageliteral_code] = pageliteralnode, [literalvalues[pageliteral_code]] = pageliteralnode, + [directliteral_code] = directliteralnode, [literalvalues[directliteral_code]] = directliteralnode, + [rawliteral_code] = rawliteralnode, [literalvalues[rawliteral_code]] = rawliteralnode, +} - function nodepool.pdfsetmatrix(rx,sx,sy,ry,tx,ty) - local t = copy_node(pdfsetmatrix) - nodeproperties[t] = { matrix = tomatrix(rx,sx,sy,ry,tx,ty) } +function nodepool.literal(mode,str) + if str then + local t = copy_node(literals[mode] or pageliteralnode) + setdata(t,str) return t - end - -else - - function nodepool.pdfsetmatrix(rx,sx,sy,ry,tx,ty) - local t = copy_node(pdfsetmatrix) - setdata(t,tomatrix(rx,sx,sy,ry,tx,ty)) + else + local t = copy_node(pageliteralnode) + setdata(t,mode) return t end - end --- best is to use a specific one: origin | page | direct | raw - -nodeinjections.save = nodepool.pdfsave -nodeinjections.restore = nodepool.pdfrestore -nodeinjections.transform = nodepool.pdfsetmatrix - --- the next one is implemented differently, using latelua +local savenode = register(new_node(whatsit_code, savewhatsit_code)) +local restorenode = register(new_node(whatsit_code, restorewhatsit_code)) +local setmatrixnode = register(new_node(whatsit_code, setmatrixwhatsit_code)) -function nodepool.pdfannotation(w,h,d,data,n) - report("don't use node based annotations!") - os.exit() - -- local t = copy_node(pdfannot) - -- if w and w ~= 0 then - -- setfield(t,"width",w) - -- end - -- if h and h ~= 0 then - -- setfield(t,"height",h) - -- end - -- if d and d ~= 0 then - -- setfield(t,"depth",d) - -- end - -- if n then - -- setfield(t,"objnum",n) - -- end - -- if data and data ~= "" then - -- setfield(t,"data",data) - -- end - -- return t +function nodepool.save() + return copy_node(savenode) end --- (!) The next code in pdfdest.w is wrong: --- --- case pdf_dest_xyz: --- if (matrixused()) { --- set_rect_dimens(pdf, p, parent_box, cur, alt_rule, pdf_dest_margin) ; --- } else { --- pdf_ann_left(p) = pos.h ; --- pdf_ann_top (p) = pos.v ; --- } --- break ; --- --- so we need to force a matrix. - --- local views = { -- beware, we do support the pdf keys but this is *not* official --- xyz = 0, [variables.standard] = 0, --- fit = 1, [variables.fit] = 1, --- fith = 2, [variables.width] = 2, --- fitv = 3, [variables.height] = 3, --- fitb = 4, --- fitbh = 5, [variables.minwidth] = 5, --- fitbv = 6, [variables.minheight] = 6, --- fitr = 7, --- } +function nodepool.restore() + return copy_node(restorenode) +end -function nodepool.pdfdestination(w,h,d,name,view,n) - report("don't use node based destinations!") - os.exit() - -- local t = copy_node(pdfdest) - -- local hasdimensions = false - -- if w and w ~= 0 then - -- setfield(t,"width",w) - -- hasdimensions = true - -- end - -- if h and h ~= 0 then - -- setfield(t,"height",h) - -- hasdimensions = true - -- end - -- if d and d ~= 0 then - -- setfield(t,"depth",d) - -- hasdimensions = true - -- end - -- if n then - -- setfield(t,"objnum",n) - -- end - -- view = views[view] or view or 1 -- fit is default - -- setfield(t,"dest_id",name) - -- setfield(t,"dest_type",view) - -- if hasdimensions and view == 0 then -- xyz - -- -- see (!) s -> m -> t -> r - -- -- linked - -- local s = copy_node(pdfsave) - -- local m = copy_node(pdfsetmatrix) - -- local r = copy_node(pdfrestore) - -- setfield(m,"data","1 0 0 1") - -- setfield(s,"next",m) - -- setfield(m,"next",t) - -- setfield(t,"next",r) - -- setfield(m,"prev",s) - -- setfield(t,"prev",m) - -- setfield(r,"prev",t) - -- return s -- a list - -- else - -- return t - -- end +function nodepool.setmatrix(rx,sx,sy,ry,tx,ty) + local t = copy_node(setmatrixnode) + setdata(t,tomatrix(rx,sx,sy,ry,tx,ty)) + return t end diff --git a/tex/context/base/mkiv/lpdf-ren.lua b/tex/context/base/mkiv/lpdf-ren.lua index e9b22f382..d6e95e66a 100644 --- a/tex/context/base/mkiv/lpdf-ren.lua +++ b/tex/context/base/mkiv/lpdf-ren.lua @@ -54,7 +54,7 @@ local copy_node = nuts.copy local nodepool = nuts.pool local register = nodepool.register -local pdfpageliteral = nodepool.pdfpageliteral +local pageliteral = nodepool.pageliteral local pdf_ocg = pdfconstant("OCG") local pdf_ocmd = pdfconstant("OCMD") @@ -261,7 +261,7 @@ function nodeinjections.startlayer(name) local c = cache[name] if not c then useviewerlayer(name) - c = register(pdfpageliteral(f_bdc(escapednames[name]))) + c = register(pageliteral(f_bdc(escapednames[name]))) cache[name] = c end return copy_node(c) @@ -269,7 +269,7 @@ end function nodeinjections.stoplayer() if not stop then - stop = register(pdfpageliteral(s_emc)) + stop = register(pageliteral(s_emc)) end return copy_node(stop) end @@ -286,7 +286,7 @@ function nodeinjections.startstackedlayer(s,t,first,last) r[#r+1] = startlayer(values[t[i]]) end r = concat(r," ") - return pdfpageliteral(r) + return pageliteral(r) end function nodeinjections.stopstackedlayer(s,t,first,last) @@ -295,7 +295,7 @@ function nodeinjections.stopstackedlayer(s,t,first,last) r[#r+1] = stoplayer() end r = concat(r," ") - return pdfpageliteral(r) + return pageliteral(r) end function nodeinjections.changestackedlayer(s,t1,first1,last1,t2,first2,last2) @@ -307,7 +307,7 @@ function nodeinjections.changestackedlayer(s,t1,first1,last1,t2,first2,last2) r[#r+1] = startlayer(values[t2[i]]) end r = concat(r," ") - return pdfpageliteral(r) + return pageliteral(r) end -- transitions diff --git a/tex/context/base/mkiv/lpdf-res.lua b/tex/context/base/mkiv/lpdf-res.lua index 87d3d42f5..d3c591343 100644 --- a/tex/context/base/mkiv/lpdf-res.lua +++ b/tex/context/base/mkiv/lpdf-res.lua @@ -6,16 +6,15 @@ if not modules then modules = { } end modules ['lpdf-res'] = { license = "see context related readme files" } -local codeinjections = backends.codeinjections -local implement = interfaces.implement +local codeinjections = backends.codeinjections -local nuts = nodes.nuts -local tonut = nodes.tonut +local nuts = nodes.nuts +local tonut = nodes.tonut -local setwhd = nuts.setwhd -local setlist = nuts.setlist +local setwhd = nuts.setwhd +local setlist = nuts.setlist -local new_hlist = nuts.pool.hlist +local new_hlist = nuts.pool.hlist local boxresources = tex.boxresources local saveboxresource = boxresources.save diff --git a/tex/context/base/mkiv/lpdf-tag.lua b/tex/context/base/mkiv/lpdf-tag.lua index 70a97c9d0..0a2fe679e 100644 --- a/tex/context/base/mkiv/lpdf-tag.lua +++ b/tex/context/base/mkiv/lpdf-tag.lua @@ -54,7 +54,7 @@ local a_image = attributes.private('image') local nuts = nodes.nuts local nodepool = nuts.pool -local pdfpageliteral = nodepool.pdfpageliteral +local pageliteral = nodepool.pageliteral local register = nodepool.register local getid = nuts.getid @@ -322,7 +322,7 @@ local visualize = nil function nodeinjections.addtags(head) if not EMCliteral then - EMCliteral = register(pdfpageliteral("EMC")) + EMCliteral = register(pageliteral("EMC")) end local last = nil @@ -463,9 +463,9 @@ function nodeinjections.addtags(head) end if prev then - literal = pdfpageliteral(makecontent(prev,id,specification)) + literal = pageliteral(makecontent(prev,id,specification)) elseif ignore then - literal = pdfpageliteral(makeignore(specification)) + literal = pageliteral(makeignore(specification)) else -- maybe also ignore or maybe better: comment or so end @@ -490,7 +490,7 @@ function nodeinjections.addtags(head) else - local literal = pdfpageliteral(makeignore(specification)) + local literal = pageliteral(makeignore(specification)) inject(start,stop,list,literal) @@ -614,9 +614,9 @@ end -- end -- -- if r > 0 then --- local literal = pdfpageliteral(concat(result,"\n")) +-- local literal = pageliteral(concat(result,"\n")) -- -- use insert instead: --- local literal = pdfpageliteral(result) +-- local literal = pageliteral(result) -- local prev = getprev(start) -- if prev then -- setlink(prev,literal) @@ -638,7 +638,7 @@ end -- for i=1,noftop do -- result[i] = "EMC" -- end --- local literal = pdfpageliteral(concat(result,"\n")) +-- local literal = pageliteral(concat(result,"\n")) -- -- use insert instead: -- local next = getnext(last) -- if next then diff --git a/tex/context/base/mkiv/luat-run.lua b/tex/context/base/mkiv/luat-run.lua index 3939504a2..39384b7b1 100644 --- a/tex/context/base/mkiv/luat-run.lua +++ b/tex/context/base/mkiv/luat-run.lua @@ -149,8 +149,11 @@ callbacks.register('stop_run', stop_run, "actions perf callbacks.register('report_output_pages', report_output_pages, "actions performed when reporting pages") callbacks.register('report_output_log', report_output_log, "actions performed when reporting log file") -callbacks.register('start_page_number', start_shipout_page, "actions performed at the beginning of a shipout") -callbacks.register('stop_page_number', stop_shipout_page, "actions performed at the end of a shipout") +---------.register('start_page_number', start_shipout_page, "actions performed at the beginning of a shipout") +---------.register('stop_page_number', stop_shipout_page, "actions performed at the end of a shipout") + +callbacks.register('start_page_number', function() end, "actions performed at the beginning of a shipout") +callbacks.register('stop_page_number', function() end, "actions performed at the end of a shipout") callbacks.register('process_input_buffer', false, "actions performed when reading data") callbacks.register('process_output_buffer', false, "actions performed when writing data") diff --git a/tex/context/base/mkiv/luat-usr.lua b/tex/context/base/mkiv/luat-usr.lua index ebcb0f0e8..b49379bbf 100644 --- a/tex/context/base/mkiv/luat-usr.lua +++ b/tex/context/base/mkiv/luat-usr.lua @@ -26,8 +26,6 @@ local io = io local os = os local lpeg = lpeg -local luanames = lua.name -- luatex itself - local setmetatableindex = table.setmetatableindex local load = load local xpcall = xpcall @@ -135,7 +133,6 @@ local function registername(name,message) messages[lnn] = message numbers[name] = lnn end - luanames[lnn] = instance_banner(message) local report = reporter("lua instance",message) local proxy = { -- we can access all via: diff --git a/tex/context/base/mkiv/meta-pdf.lua b/tex/context/base/mkiv/meta-pdf.lua index 2e3a5782a..a0bf16d90 100644 --- a/tex/context/base/mkiv/meta-pdf.lua +++ b/tex/context/base/mkiv/meta-pdf.lua @@ -35,7 +35,6 @@ local pdfgraycode = lpdf.graycode local pdfspotcode = lpdf.spotcode local pdftransparencycode = lpdf.transparencycode local pdffinishtransparencycode = lpdf.finishtransparencycode ------ pdfpageliteral = nodes.pool.pdfpageliteral metapost.mptopdf = metapost.mptopdf or { } local mptopdf = metapost.mptopdf @@ -69,13 +68,6 @@ end resetall() --- -- this does not work as expected (displacement of text) beware, needs another --- -- comment hack --- --- local function pdfcode(str) --- context(pdfpageliteral(str)) --- end - local pdfcode = context.pdfliteral local function mpscode(str) diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua index 717bb1634..b90821508 100644 --- a/tex/context/base/mkiv/mlib-pdf.lua +++ b/tex/context/base/mkiv/mlib-pdf.lua @@ -43,7 +43,7 @@ metapost.n = 0 local experiment = true -- uses context(node) that already does delayed nodes local savedliterals = nil -- needs checking -local mpsliteral = nodes.pool.pdforiginliteral +local mpsliteral = nodes.pool.originliteral local f_f = formatters["%.6F"] local f_m = formatters["%.6F %.6F m"] diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 13cc31a94..75c048c92 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -34,9 +34,7 @@ return { -- "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "texenginefunctionality", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", - -- "etexversion", - -- "pdftexversion", "pdftexrevision", - -- "xetexversion", "xetexrevision", + "contextformat", "contextversion", "contextkind", "contextlmtxmode", "contextmark", "mksuffix", -- "activecatcode", -- diff --git a/tex/context/base/mkiv/node-acc.lua b/tex/context/base/mkiv/node-acc.lua index db8ca8af8..e6c617602 100644 --- a/tex/context/base/mkiv/node-acc.lua +++ b/tex/context/base/mkiv/node-acc.lua @@ -153,7 +153,7 @@ end) -- -- tasks.appendaction("processors", "words", "nodes.injectspans") -- --- local pdfpageliteral = nuts.pool.pdfpageliteral +-- local pageliteral = nuts.pool.pageliteral -- -- local function injectspans(head) -- local done = false @@ -162,8 +162,8 @@ end) -- local a = getattr(n,a_hyphenated) -- if a then -- local str = codes[a] --- local b = pdfpageliteral(format("/Span << /ActualText %s >> BDC", lpdf.tosixteen(str))) --- local e = pdfpageliteral("EMC") +-- local b = pageliteral(format("/Span << /ActualText %s >> BDC", lpdf.tosixteen(str))) +-- local e = pageliteral("EMC") -- insert_before(head,n,b) -- insert_after(head,n,e) -- done = true diff --git a/tex/context/base/mkiv/node-ppt.lua b/tex/context/base/mkiv/node-ppt.lua index 7e52aa800..485e742b6 100644 --- a/tex/context/base/mkiv/node-ppt.lua +++ b/tex/context/base/mkiv/node-ppt.lua @@ -26,7 +26,6 @@ local getid = nuts.getid local getnext = nuts.getnext local getprev = nuts.getprev local getsubtype = nuts.getsubtype -local getfield = nuts.getfield local getlist = nuts.getlist local setlist = nuts.setlist local getprop = nuts.getprop diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua index 995bba6e5..da8daa29b 100644 --- a/tex/context/base/mkiv/node-res.lua +++ b/tex/context/base/mkiv/node-res.lua @@ -172,6 +172,10 @@ local savepos = register_nut(new_nut(whatsit_code,whatsitcodes.savepos local user_node = new_nut(whatsit_code,whatsitcodes.userdefined) +if not CONTEXTLMTXMODE then + setfield(user_node,"type",usercodes.number) +end + local left_margin_kern = register_nut(new_nut(nodecodes.marginkern,0)) local right_margin_kern = register_nut(new_nut(nodecodes.marginkern,1)) diff --git a/tex/context/base/mkiv/page-imp.mkiv b/tex/context/base/mkiv/page-imp.mkiv index 99786c2f2..838ad7421 100644 --- a/tex/context/base/mkiv/page-imp.mkiv +++ b/tex/context/base/mkiv/page-imp.mkiv @@ -162,7 +162,11 @@ \box\scratchbox \endgroup} -\def\page_shipout_box#1{\normalshipout\box#1\relax} % takes a number +\ifdefined \page_shipout_box \else + + \def\page_shipout_box#1{\normalshipout\box#1\relax} % takes a number + +\fi \def\page_shipouts_normal#1% {\global\advance\shippedoutpages\plusone diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 0019fb8fd..c2c5d8791 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 3ec1d4d28..b460df354 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index 4b04c16ae..7690af018 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -96,21 +96,14 @@ %D Initialization of primitives. -\directlua 0 { % this info is stored in the format - lua.name[0] = "main ctx instance" +\directlua { + local baseprimitives = tex.extraprimitives("core","tex") + local moreprimitives = tex.extraprimitives("etex","luatex") - local coreprimitives = tex.extraprimitives("core") - local texprimitives = tex.extraprimitives("tex") - local etexprimitives = tex.extraprimitives("etex") - local luatexprimitives = tex.extraprimitives("luatex") + tex.enableprimitives("",moreprimitives) - tex.enableprimitives("",etexprimitives) - tex.enableprimitives("",luatexprimitives) - - tex.enableprimitives("normal",coreprimitives) - tex.enableprimitives("normal",texprimitives) - tex.enableprimitives("normal",etexprimitives) - tex.enableprimitives("normal",luatexprimitives) + tex.enableprimitives("normal",baseprimitives) + tex.enableprimitives("normal",moreprimitives) function tex.enableprimitives() end } @@ -126,13 +119,10 @@ \expandafter\def\csname\Uchar\formfeedasciicode \endcsname {\par} % \def\^^L{\par} formfeed \expandafter\def\csname\Uchar\endoflineasciicode\endcsname {\ } % \def\^^M{\ } return -%D \ETEX\ has a not so handy way of telling you the version number, i.e. the revision -%D number has a period in it: +%D For now: \def\gobbleoneargument#1{} % will be defined later on anyway -\mathchardef\etexversion = \numexpr\eTeXversion*100+\expandafter\gobbleoneargument\eTeXrevision\relax - %D First we define a simplified version of the \CONTEXT\ protection mechanism. %D Later we will implement a better variant. @@ -1014,124 +1004,43 @@ %D Backend: -% For the moment we define some \pdf... helpers but this will move to the backend -% module after which the official interfaces have to be used. This is needed for -% modules not made by ctx developers. - -\ifdefined\pdfextension - -\normalprotected\def\pdfliteral {\pdfextension literal } -\normalprotected\def\pdfcolorstack {\pdfextension colorstack } -\normalprotected\def\pdfsetmatrix {\pdfextension setmatrix } -\normalprotected\def\pdfsave {\pdfextension save\relax} -\normalprotected\def\pdfrestore {\pdfextension restore\relax} -\normalprotected\def\pdfobj {\pdfextension obj } -\normalprotected\def\pdfrefobj {\pdfextension refobj } -\normalprotected\def\pdfannot {\pdfextension annot } -\normalprotected\def\pdfstartlink {\pdfextension startlink } -\normalprotected\def\pdfendlink {\pdfextension endlink\relax} -\normalprotected\def\pdfoutline {\pdfextension outline } -\normalprotected\def\pdfdest {\pdfextension dest } -\normalprotected\def\pdfthread {\pdfextension thread } -\normalprotected\def\pdfstartthread {\pdfextension startthread } -\normalprotected\def\pdfendthread {\pdfextension endthread\relax} -\normalprotected\def\pdfinfo {\pdfextension info } -\normalprotected\def\pdfcatalog {\pdfextension catalog } -\normalprotected\def\pdfnames {\pdfextension names } -\normalprotected\def\pdfincludechars {\pdfextension includechars } -\normalprotected\def\pdffontattr {\pdfextension fontattr } -\normalprotected\def\pdfmapfile {\pdfextension mapfile } -\normalprotected\def\pdfmapline {\pdfextension mapline } -\normalprotected\def\pdftrailer {\pdfextension trailer } -\normalprotected\def\pdfglyphtounicode {\pdfextension glyphtounicode } - -% \chardef\pdfnofullbanner = 1 -% \chardef\pdfnofilename = 2 -% \chardef\pdfnopagenumber = 4 -% \chardef\pdfnoinfodict = 8 -% \chardef\pdfnocreator = 16 -% \chardef\pdfnocreationdate = 32 -% \chardef\pdfnomoddate = 64 -% \chardef\pdfnoproducer = 128 -% \chardef\pdfnotrapped = 256 -% \chardef\pdfnoid = 512 - -\def\pdftexversion {\numexpr\pdffeedback version\relax} -\def\pdftexrevision {\pdffeedback revision} -\def\pdflastlink {\numexpr\pdffeedback lastlink\relax} -\def\pdfretval {\numexpr\pdffeedback retval\relax} -\def\pdflastobj {\numexpr\pdffeedback lastobj\relax} -\def\pdflastannot {\numexpr\pdffeedback lastannot\relax} -\def\pdfxformname {\numexpr\pdffeedback xformname\relax} -\def\pdfcreationdate {\pdffeedback creationdate} -\def\pdffontname {\numexpr\pdffeedback fontname\relax} -\def\pdffontobjnum {\numexpr\pdffeedback fontobjnum\relax} -\def\pdffontsize {\dimexpr\pdffeedback fontsize\relax} -\def\pdfpageref {\numexpr\pdffeedback pageref\relax} -\def\pdfcolorstackinit {\pdffeedback colorstackinit} - -\let\pdfxform \saveboxresource -\let\pdflastxform \lastsavedboxresourceindex -\let\pdfrefxform \useboxresource -\let\pdfximage \saveimageresource -\let\pdflastximage \lastsavedimageresourceindex -\let\pdflastximagepages \lastsavedimageresourcepages -\let\pdfrefximage \useimageresource -\let\pdfsavepos \savepos -\let\pdflastxpos \lastxpos -\let\pdflastypos \lastypos - -\edef\pdfcompresslevel {\pdfvariable compresslevel} \pdfcompresslevel \plusnine -\edef\pdfobjcompresslevel {\pdfvariable objcompresslevel} \pdfobjcompresslevel \plusone -%edef\pdfrecompress {\pdfvariable recompress} \pdfrecompress \zerocount -\edef\pdfdecimaldigits {\pdfvariable decimaldigits} \pdfdecimaldigits \plussix % \plusfive -\edef\pdfgamma {\pdfvariable gamma} \pdfgamma \plusthousand -\edef\pdfimageresolution {\pdfvariable imageresolution} \pdfimageresolution 300 -\edef\pdfimageapplygamma {\pdfvariable imageapplygamma} \pdfimageapplygamma \zerocount -\edef\pdfimagegamma {\pdfvariable imagegamma} \pdfimagegamma 2200 -\edef\pdfimagehicolor {\pdfvariable imagehicolor} \pdfimagehicolor \plusone -\edef\pdfimageaddfilename {\pdfvariable imageaddfilename} \pdfimageaddfilename \plusone -\edef\pdfpkresolution {\pdfvariable pkresolution} \pdfpkresolution 1200 -\edef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts} \pdfinclusioncopyfonts \plusone -\edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel} \pdfinclusionerrorlevel \zerocount -\edef\pdfgentounicode {\pdfvariable gentounicode} \pdfgentounicode \plusone -\edef\pdfomitcidset {\pdfvariable omitcidset } \pdfomitcidset \plusone -\edef\pdfomitcharset {\pdfvariable omitcharset} \pdfomitcharset \plusone -\edef\pdfpagebox {\pdfvariable pagebox} \pdfpagebox \zerocount -\edef\pdfmajorversion {\pdfvariable majorversion} % \pdfmajorversion \plusone -\edef\pdfminorversion {\pdfvariable minorversion} \pdfminorversion \plusseven -\edef\pdfuniqueresname {\pdfvariable uniqueresname} \pdfuniqueresname \zerocount -\edef\pdfhorigin {\pdfvariable horigin} \pdfhorigin 1in -\edef\pdfvorigin {\pdfvariable vorigin} \pdfvorigin \pdfhorigin -\edef\pdflinkmargin {\pdfvariable linkmargin} \pdflinkmargin \zeropoint -\edef\pdfdestmargin {\pdfvariable destmargin} \pdfdestmargin \zeropoint -\edef\pdfthreadmargin {\pdfvariable threadmargin} \pdfthreadmargin \zeropoint -\edef\pdfxformmargin {\pdfvariable xformmargin} \pdfxformmargin \zeropoint -\edef\pdfpkfixeddpi {\pdfvariable pkfixeddpi} \pdfpkfixeddpi \plusone -\edef\pdfignoreunknownimages {\pdfvariable ignoreunknownimages} \pdfignoreunknownimages \zerocount - -\edef\pdfpagesattr {\pdfvariable pagesattr} -\edef\pdfpageattr {\pdfvariable pageattr} -\edef\pdfpageresources {\pdfvariable pageresources} -\edef\pdfxformattr {\pdfvariable xformattr} -\edef\pdfxformresources {\pdfvariable xformresources} -\edef\pdfpkmode {\pdfvariable pkmode} - -\edef\pdfsuppressoptionalinfo{\pdfvariable suppressoptionalinfo } -\edef\pdftrailerid {\pdfvariable trailerid } -\edef\pdfinfoomitdate {\pdfvariable suppressoptionalinfo \numexpr32+64\relax} - -\normalprotected\def\nopdfcompression {\pdfobjcompresslevel\zerocount \pdfcompresslevel\zerocount} -\normalprotected\def\maximumpdfcompression{\pdfobjcompresslevel\plusnine \pdfcompresslevel\plusnine } -\normalprotected\def\normalpdfcompression {\pdfobjcompresslevel\plusthree \pdfcompresslevel\plusthree} - -\else - \let\nopdfcompression \relax - \let\maximumpdfcompression\relax - \let\normalpdfcompression \relax +\ifdefined\pdfvariable + + \pdfvariable compresslevel \plusthree + \pdfvariable objcompresslevel \plusone + % \pdfvariable recompress \zerocount + \pdfvariable decimaldigits \plussix + \pdfvariable gamma \plusthousand + \pdfvariable imageresolution 300 + \pdfvariable imageapplygamma \zerocount + \pdfvariable imagegamma 2200 + \pdfvariable imagehicolor \plusone + \pdfvariable imageaddfilename \plusone + \pdfvariable pkresolution 1200 + \pdfvariable inclusioncopyfonts \plusone + \pdfvariable inclusionerrorlevel \zerocount + \pdfvariable gentounicode \plusone + \pdfvariable omitcidset \plusone + \pdfvariable omitcharset \plusone + \pdfvariable pagebox \zerocount + % \pdfvariable majorversion % \plusone + \pdfvariable minorversion \plusseven + \pdfvariable uniqueresname \zerocount + \pdfvariable horigin 1in + \pdfvariable vorigin 1in + % \pdfvariable linkmargin \zeropoint + % \pdfvariable destmargin \zeropoint + % \pdfvariable threadmargin \zeropoint + % \pdfvariable xformmargin \zeropoint + \pdfvariable pkfixeddpi \plusone + \pdfvariable ignoreunknownimages \zerocount + \fi -\normalpdfcompression +\let\nopdfcompression \relax +\let\onlypdfobjectcompression\relax +\let\maximumpdfcompression \relax +\let\normalpdfcompression \relax \ifdefined\outputmode \outputmode \zerocount % we generate the format in this mode diff --git a/tex/context/base/mkiv/trac-par.lua b/tex/context/base/mkiv/trac-par.lua index d888fafeb..03f0a67d1 100644 --- a/tex/context/base/mkiv/trac-par.lua +++ b/tex/context/base/mkiv/trac-par.lua @@ -15,7 +15,6 @@ local concat = table.concat local nuts = nodes.nuts local tonut = nuts.tonut -local getfield = nuts.getfield local getid = nuts.getid local getnext = nuts.getnext local getlist = nuts.getlist diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua index 8c7d6fef1..b61dadb51 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -45,7 +45,6 @@ local setattr = nuts.setattr local setwidth = nuts.setwidth local setshift = nuts.setshift -local getfield = nuts.getfield local getid = nuts.getid local getfont = nuts.getfont local getattr = nuts.getattr @@ -579,29 +578,17 @@ local whatsit do local w_cache = caches["whatsit"] local tags = { - open = "FIC", - write = "FIW", - close = "FIC", - special = "SPE", - latelua = "LUA", - savepos = "POS", - userdefined = "USR", - -- backend stuff - pdfliteral = "PDF", - pdfrefobj = "PDF", - pdfannot = "PDF", - pdfstartlink = "PDF", - pdfendlink = "PDF", - pdfdest = "PDF", - pdfthread = "PDF", - pdfstartthread = "PDF", - pdfendthread = "PDF", - pdfthreaddata = "PDF", - pdflinkdata = "PDF", - pdfcolorstack = "PDF", - pdfsetmatrix = "PDF", - pdfsave = "PDF", - pdfrestore = "PDF", + open = "OPN", + write = "WRI", + close = "CLS", + special = "SPE", + latelua = "LUA", + savepos = "POS", + userdefined = "USR", + literal = "LIT", + setmatrix = "MAT", + save = "SAV", + restore = "RES", } whatsit = function(head,current) diff --git a/tex/context/base/mkiv/typo-mar.lua b/tex/context/base/mkiv/typo-mar.lua index 179fea607..19507f7f5 100644 --- a/tex/context/base/mkiv/typo-mar.lua +++ b/tex/context/base/mkiv/typo-mar.lua @@ -67,7 +67,6 @@ local hpack_nodes = nuts.hpack local traverse_id = nuts.traverse_id local flush_node_list = nuts.flush_list -local getfield = nuts.getfield local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid diff --git a/tex/context/base/mkiv/typo-rub.lua b/tex/context/base/mkiv/typo-rub.lua index 9b3bdb9d8..da63d7b64 100644 --- a/tex/context/base/mkiv/typo-rub.lua +++ b/tex/context/base/mkiv/typo-rub.lua @@ -204,7 +204,7 @@ function rubies.check(head) setprev(start) setnext(stop) local h = hpack(start) - if prev == head then + if start == head then head = h else setlink(prev,h) @@ -243,20 +243,21 @@ function rubies.check(head) start = current stop = current end + -- go on elseif id == kern_code and getsubtype(current,fontkern_code) then -- go on elseif found and id == disc_code then -- go on (todo: look into disc) elseif found then - flush("flush 4") + flush("flush 3") found = nil end current = nx end if found then - flush("flush 5") + flush("flush 4") end - return head, true + return head, true -- no need for true end local attach diff --git a/tex/context/base/mkiv/util-env.lua b/tex/context/base/mkiv/util-env.lua index 1ff4c7f23..cadfb7ac5 100644 --- a/tex/context/base/mkiv/util-env.lua +++ b/tex/context/base/mkiv/util-env.lua @@ -72,20 +72,16 @@ end -- dirty tricks (we will replace the texlua call by luatex --luaonly) local validengines = allocate { - ["luatex"] = true, - ["luajittex"] = true, - -- ["luatex.exe"] = true, - -- ["luajittex.exe"] = true, + ["luatex"] = true, + ["luajittex"] = true, } local basicengines = allocate { - ["luatex"] = "luatex", - ["texlua"] = "luatex", - ["texluac"] = "luatex", - ["luajittex"] = "luajittex", - ["texluajit"] = "luajittex", - -- ["texlua.exe"] = "luatex", - -- ["texluajit.exe"] = "luajittex", + ["luatex"] = "luatex", + ["texlua"] = "luatex", -- obsolete + ["texluac"] = "luatex", -- obsolete + ["luajittex"] = "luajittex", + ["texluajit"] = "luajittex", -- obsolete } local luaengines = allocate { diff --git a/tex/context/base/mkiv/util-sta.lua b/tex/context/base/mkiv/util-sta.lua index d140cacdc..7819395f6 100644 --- a/tex/context/base/mkiv/util-sta.lua +++ b/tex/context/base/mkiv/util-sta.lua @@ -289,24 +289,24 @@ end -- -- local concat = table.concat -- --- local pdfpageliteral = nodes.pool.pdfpageliteral +-- local pageliteral = nodes.pool.pageliteral -- -- function demostacker.start(s,t,first,last) -- local n = whatever[t[last]] -- -- s.report("start: %s",n) --- return pdfpageliteral(n) +-- return pageliteral(n) -- end -- -- function demostacker.stop(s,t,first,last) -- local n = whatever[false] -- -- s.report("stop: %s",n) --- return pdfpageliteral(n) +-- return pageliteral(n) -- end -- -- function demostacker.change(s,t1,first1,last1,t2,first2,last2) -- local n = whatever[t2[last2]] -- -- s.report("change: %s",n) --- return pdfpageliteral(n) +-- return pageliteral(n) -- end -- -- demostacker.mode = "switch" @@ -325,7 +325,7 @@ end -- r[#r+1] = whatever[t[i]] -- end -- -- s.report("start: %s",concat(r," ")) --- return pdfpageliteral(concat(r," ")) +-- return pageliteral(concat(r," ")) -- end -- -- function demostacker.stop(s,t,first,last) @@ -334,7 +334,7 @@ end -- r[#r+1] = whatever[false] -- end -- -- s.report("stop: %s",concat(r," ")) --- return pdfpageliteral(concat(r," ")) +-- return pageliteral(concat(r," ")) -- end -- -- function demostacker.change(s,t1,first1,last1,t2,first2,last2) @@ -346,7 +346,7 @@ end -- r[#r+1] = whatever[t2[i]] -- end -- -- s.report("change: %s",concat(r," ")) --- return pdfpageliteral(concat(r," ")) +-- return pageliteral(concat(r," ")) -- end -- -- demostacker.mode = "stack" diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 0883693ac..710c2b708 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 41bf65996..c9466e104 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 17967ff29..d470094fc 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 : 02/10/19 17:43:53 +-- merge date : 02/14/19 16:57:24 do -- begin closure to overcome local limits and interference |