summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2021-07-09 19:19:20 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2021-07-09 19:19:20 +0200
commitba4875d8c328257fa3cb4d140d07ced41b8a576c (patch)
tree4bb65d6c46a72b995bc9e0641b80b1fd80fb3aac /tex
parent8d02589abdbd8d4f476ac951d99d4081319fce35 (diff)
downloadcontext-ba4875d8c328257fa3cb4d140d07ced41b8a576c.tar.gz
2021-07-09 18:16:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/mult-mps.lua4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin23611 -> 23613 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin248505 -> 248476 bytes
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl2
-rw-r--r--tex/context/base/mkxl/core-ini.mkxl3
-rw-r--r--tex/context/base/mkxl/core-sys.lmt27
-rw-r--r--tex/context/base/mkxl/file-job.lmt1
-rw-r--r--tex/context/base/mkxl/luat-fio.lmt4
-rw-r--r--tex/context/base/mkxl/meta-ini.mkxl1
-rw-r--r--tex/context/base/mkxl/mlib-ctx.lmt2
-rw-r--r--tex/context/base/mkxl/mlib-pdf.lmt464
-rw-r--r--tex/context/base/mkxl/mlib-pps.lmt8
-rw-r--r--tex/context/base/mkxl/node-par.lmt10
-rw-r--r--tex/context/base/mkxl/trac-deb.lmt4
-rw-r--r--tex/context/base/mkxl/typo-drp.lmt9
-rw-r--r--tex/context/base/mkxl/typo-drp.mkxl63
-rw-r--r--tex/generic/context/luatex/luatex-basics-nod.lua2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua4
23 files changed, 367 insertions, 251 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 1cacc2484..422bcf32a 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2021.07.06 18:44}
+\newcontextversion{2021.07.09 18:13}
%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 c58792280..1cf730f4c 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2021.07.06 18:44}
+\edef\contextversion{2021.07.09 18:13}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 290b2ec1a..2d989531d 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.07.06 18:44}
+\newcontextversion{2021.07.09 18:13}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index d1466a091..30ae6b70f 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2021.07.06 18:44}
+\edef\contextversion{2021.07.09 18:13}
%D Kind of special:
diff --git a/tex/context/base/mkiv/mult-mps.lua b/tex/context/base/mkiv/mult-mps.lua
index 49c4f12ae..6512091ae 100644
--- a/tex/context/base/mkiv/mult-mps.lua
+++ b/tex/context/base/mkiv/mult-mps.lua
@@ -6,7 +6,7 @@ return {
"..", "...", "--", "---", "&", "\\",
},
primitives = { -- to be checked
- "charcode", "day", "linecap", "linejoin", "miterlimit", "month", "pausing",
+ "charcode", "day", "linecap", "linejoin", "miterlimit", "stacking", "month", "pausing",
"prologues", "showstopping", "time", "tracingcapsules", "tracingchoices", "mpprocset",
"tracingcommands", "tracingequations", "tracinglostchars",
"tracingmacros", "tracingonline", "tracingoutput", "tracingrestores",
@@ -30,7 +30,7 @@ return {
"def", "vardef", "enddef", "expr", "suffix", "text", "primary", "secondary",
"tertiary", "primarydef", "secondarydef", "tertiarydef",
"randomseed", "also", "contour", "doublepath",
- "withcolor", "withcmykcolor", "withpen",
+ "withcolor", "withcmykcolor", "withpen", "withstacking",
"dashed",
"envelope",
"if", "else", "elseif", "fi", "for", "endfor", "forever", "exitif", "within",
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index b4e417c5c..8fb358fa4 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 71b72e28c..8e2064949 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 12f04a4ea..4fec9a7f9 100644
--- a/tex/context/base/mkxl/cont-new.mkxl
+++ b/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.07.06 18:44}
+\newcontextversion{2021.07.09 18:13}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 0b00ec001..4339426be 100644
--- a/tex/context/base/mkxl/context.mkxl
+++ b/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2021.07.06 18:44}
+\immutable\edef\contextversion{2021.07.09 18:13}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/core-ini.mkxl b/tex/context/base/mkxl/core-ini.mkxl
index de7c645b4..41c73b903 100644
--- a/tex/context/base/mkxl/core-ini.mkxl
+++ b/tex/context/base/mkxl/core-ini.mkxl
@@ -75,7 +75,8 @@
\to \everysimplifycommands
\appendtoks
- \everypar\emptytoks % pretty important
+ \everypar \emptytoks % pretty important
+ \everybeforepar\emptytoks % pretty important
\to \everyforgetall
%D Page building:
diff --git a/tex/context/base/mkxl/core-sys.lmt b/tex/context/base/mkxl/core-sys.lmt
index 0d471133d..8615e9f05 100644
--- a/tex/context/base/mkxl/core-sys.lmt
+++ b/tex/context/base/mkxl/core-sys.lmt
@@ -19,23 +19,32 @@ function environment.initializefilenames()
local arguments = environment.arguments
- local jobname = arguments.jobname or tex.jobname
- local fulljobname = arguments.fulljobname or jobname
- local inputfilename = arguments.input or fulljobname
- local outputfilename = arguments.result or removesuffix(jobname)
+ local jobname = arguments.jobname
+ local fulljobname = arguments.fulljobname
+ local inputfilename = arguments.input
+
+ if not fulljobname then
+ fulljobname = inputfilename or tex.jobname
+ end
+ if not inputfilename then
+ inputfilename = fulljobname
+ end
+ if not jobname then
+ jobname = removesuffix(fulljobname)
+ end
- local inputfilename = suffixonly(inputfilename) == "tex" and removesuffix(inputfilename) or inputfilename or ""
+ local inputfilebase = basename(inputfilename)
+ local outputfilename = arguments.result or removesuffix(fulljobname)
+
+-- local inputfilename = suffixonly(inputfilename) == "tex" and removesuffix(inputfilename) or inputfilename or ""
local filename = fulljobname
local suffix = suffixonly(filename)
local filename = ctxrunner.resolve(filename) -- in case we're prepped
- local jobfilename = jobname or inputfilename or tex.jobname or ""
- local inputfilename = inputfilename or ""
-
+ local jobfilename = jobname -- alias
local jobfilebase = basename(jobfilename)
- local inputfilebase = basename(inputfilename)
-- jobfilename = gsub(jobfilename, "^./","")
-- inputfilename = gsub(inputfilename,"^./","")
diff --git a/tex/context/base/mkxl/file-job.lmt b/tex/context/base/mkxl/file-job.lmt
index 50064622a..e64ed8539 100644
--- a/tex/context/base/mkxl/file-job.lmt
+++ b/tex/context/base/mkxl/file-job.lmt
@@ -901,6 +901,7 @@ end
function environment.loadexamodes(filename)
if not filename or filename == "" then
+ -- todo: environment.fulljobnmame
filename = removesuffix(tex.jobname)
end
filename = resolvers.findfile(addsuffix(filename,'ctm')) or ""
diff --git a/tex/context/base/mkxl/luat-fio.lmt b/tex/context/base/mkxl/luat-fio.lmt
index 2c6247225..ce8b5ab27 100644
--- a/tex/context/base/mkxl/luat-fio.lmt
+++ b/tex/context/base/mkxl/luat-fio.lmt
@@ -80,8 +80,8 @@ if not resolvers.initialized() then
return name
end
- register('find_log_file' , find_any_file, true)
- register('find_format_file', find_any_file, true)
+ register('find_log_file' , find_any_file, true) -- why do we have this callback if we just return the name
+ register('find_format_file', find_any_file, true) -- why do we have this callback if we just return the name
-- register('find_data_file' , find_data_file, true)
register('open_data_file' , open_data_file, true)
diff --git a/tex/context/base/mkxl/meta-ini.mkxl b/tex/context/base/mkxl/meta-ini.mkxl
index cd8f74439..def3900fe 100644
--- a/tex/context/base/mkxl/meta-ini.mkxl
+++ b/tex/context/base/mkxl/meta-ini.mkxl
@@ -302,6 +302,7 @@
inclusions {\meta_flush_current_inclusions}%
definitions {\meta_flush_current_definitions}%
figure {\MPaskedfigure}%
+ filtering {\mpcategoryparameter\c!list}
method {\MPinstanceparameter\c!method}%
namespace {\??graphicvariable\currentmpcategory:}%
\relax}%
diff --git a/tex/context/base/mkxl/mlib-ctx.lmt b/tex/context/base/mkxl/mlib-ctx.lmt
index 2569a6066..13dba92cd 100644
--- a/tex/context/base/mkxl/mlib-ctx.lmt
+++ b/tex/context/base/mkxl/mlib-ctx.lmt
@@ -223,6 +223,7 @@ implement {
{ "figure" },
{ "method" },
{ "namespace" },
+ { "filtering" },
}
}
}
@@ -313,6 +314,7 @@ implement {
{ "inclusions" },
{ "method" },
{ "namespace" },
+ { "filtering" },
{ "width", "dimension" },
{ "height", "dimension" },
},
diff --git a/tex/context/base/mkxl/mlib-pdf.lmt b/tex/context/base/mkxl/mlib-pdf.lmt
index ac84e4f3e..11f211b2b 100644
--- a/tex/context/base/mkxl/mlib-pdf.lmt
+++ b/tex/context/base/mkxl/mlib-pdf.lmt
@@ -7,7 +7,7 @@ if not modules then modules = { } end modules ['mlib-pdf'] = {
}
local gsub = string.gsub
-local concat, insert, remove = table.concat, table.insert, table.remove
+local concat, insert, remove, sortedkeys = table.concat, table.insert, table.remove, table.sortedkeys
local abs, sqrt, round = math.abs, math.sqrt, math.round
local setmetatable, rawset, tostring, tonumber, type = setmetatable, rawset, tostring, tonumber, type
local P, S, C, Ct, Cc, Cg, Cf, Carg = lpeg.P, lpeg.S, lpeg.C, lpeg.Ct, lpeg.Cc, lpeg.Cg, lpeg.Cf, lpeg.Carg
@@ -341,7 +341,8 @@ end
-- end
-- end
-local stack = { }
+local stack = { } -- general stack (not related to stacking)
+local nostacking = { 0 } -- layers in figures
local function pushproperties(figure)
-- maybe there will be getters in lmtx
@@ -373,6 +374,7 @@ function metapost.flush(specification,result)
local flusher = specification.flusher
local askedfig = specification.askedfig
local incontext = specification.incontext
+ local filtering = specification.filtering
local figures = result.fig
if figures then
flusher = flusher or pdfflusher
@@ -386,7 +388,9 @@ function metapost.flush(specification,result)
local textfigure = flusher.textfigure
-- local processspecial = flusher.processspecial or metapost.processspecial
local tocomment = flusher.tocomment
-
+ if type(filtering) ~= "table" then
+ filtering = false
+ end
-- patterns: we always use image 1 and then can use patterns for 2..n (or one number)
-- we can then do an intermediate flush
@@ -394,6 +398,7 @@ function metapost.flush(specification,result)
local figure = figures[index]
local properties = pushproperties(figure)
if askedfig == "direct" or askedfig == "all" or askedfig == properties.number then
+ local stacking = figure:stacking() -- This has to happen before fetching objects!
local objects = figure:objects()
local tolerance = figure:tolerance() or getbendtolerance()
local result = { }
@@ -428,248 +433,269 @@ function metapost.flush(specification,result)
-- resetplugins(result) -- we should move the colorinitializer here
local savedpath = nil
local savedhtap = nil
- for o=1,#objects do
- local object = objects[o]
- local objecttype = object.type
- if objecttype == "fill" or objecttype == "outline" then
- -- we use an indirect table as we want to overload
- -- entries but this is not possible in userdata
- --
- -- can be optimized if no path
- --
- local original = object
- local object = { }
- setmetatable(object, {
- __index = original
- })
- local before,
- after,
- options = processplugins(object)
- local evenodd = false
- local collect = false
- local both = false
- local flush = false
- local postscript = object.postscript
- local tolerance = options and tonumber(options.tolerance) or tolerance
- -- if not object.istext then
- if postscript == "evenodd" then
- evenodd = true
- elseif postscript == "collect" then
- collect = true
- elseif postscript == "flush" then
- flush = true
- elseif postscript == "both" then
- both = true
- elseif postscript == "eoboth" then
- evenodd = true
- both = true
- end
- -- end
- --
- if flush and not savedpath then
- -- forget about it
- elseif collect then
- if not savedpath then
- savedpath = { object.path or false }
- savedhtap = { object.htap or false }
+ if stacking then
+ stacking = { }
+ for o=1,#objects do
+ local stack = objects[o].stacking
+ if stack then
+ if filtering then
+ stacking[stack] = filtering[stack]
else
- savedpath[#savedpath+1] = object.path or false
- savedhtap[#savedhtap+1] = object.htap or false
- end
- else
- local objecttype = object.type -- can have changed
- if before then
- result = pluginactions(before,result,flushfigure)
+ stacking[stack] = true
end
- local ml = object.miterlimit
- if ml and ml ~= miterlimit then
- miterlimit = ml
- result[#result+1] = f_M(ml)
- end
- local lj = object.linejoin
- if lj and lj ~= linejoin then
- linejoin = lj
- result[#result+1] = f_j(lj)
- end
- local lc = object.linecap
- if lc and lc ~= linecap then
- linecap = lc
- result[#result+1] = f_J(lc)
- end
- if both then
- if dashed ~= false then -- was just dashed test
- result[#result+1] = "[] 0 d"
- dashed = false
+ end
+ end
+ stacking = sortedkeys(stacking)
+ else
+ stacking = nostacking
+ end
+ for i=1,#stacking do
+ local stack = stacking[i]
+ for o=1,#objects do
+ local object = objects[o]
+ if stack == object.stacking then
+ local objecttype = object.type
+ if objecttype == "fill" or objecttype == "outline" then
+ -- we use an indirect table as we want to overload
+ -- entries but this is not possible in userdata
+ --
+ -- can be optimized if no path
+ --
+ local original = object
+ local object = { }
+ setmetatable(object, {
+ __index = original
+ })
+ local before,
+ after,
+ options = processplugins(object)
+ local evenodd = false
+ local collect = false
+ local both = false
+ local flush = false
+ local postscript = object.postscript
+ local tolerance = options and tonumber(options.tolerance) or tolerance
+ -- if not object.istext then
+ if postscript == "evenodd" then
+ evenodd = true
+ elseif postscript == "collect" then
+ collect = true
+ elseif postscript == "flush" then
+ flush = true
+ elseif postscript == "both" then
+ both = true
+ elseif postscript == "eoboth" then
+ evenodd = true
+ both = true
end
- else
- local dl = object.dash
- if dl then
- local d = f_d(concat(dl.dashes or {}," "),dl.offset)
- if d ~= dashed then
- dashed = d
- result[#result+1] = d
+ -- end
+ --
+ if flush and not savedpath then
+ -- forget about it
+ elseif collect then
+ if not savedpath then
+ savedpath = { object.path or false }
+ savedhtap = { object.htap or false }
+ else
+ savedpath[#savedpath+1] = object.path or false
+ savedhtap[#savedhtap+1] = object.htap or false
end
- elseif dashed ~= false then -- was just dashed test
- result[#result+1] = "[] 0 d"
- dashed = false
- end
- end
- local path = object.path -- newpath
- local transformed = false
- local penwidth = 1
- local open = path and path[1].left_type and path[#path].right_type -- at this moment only "end_point"
- local pen = object.pen
- if pen then
- if pen.type == "elliptical" then
- transformed, penwidth = pen_characteristics(original) -- boolean, value
- if penwidth ~= linewidth then
- result[#result+1] = f_w(penwidth)
- linewidth = penwidth
+ else
+ local objecttype = object.type -- can have changed
+ if before then
+ result = pluginactions(before,result,flushfigure)
end
- if objecttype == "fill" then
- objecttype = "both"
+ local ml = object.miterlimit
+ if ml and ml ~= miterlimit then
+ miterlimit = ml
+ result[#result+1] = f_M(ml)
end
- else -- calculated by mplib itself
- objecttype = "fill"
- end
- end
- if transformed then
- result[#result+1] = "q"
- end
- if path then
- if savedpath then
- for i=1,#savedpath do
- local path = savedpath[i]
- if transformed then
+ local lj = object.linejoin
+ if lj and lj ~= linejoin then
+ linejoin = lj
+ result[#result+1] = f_j(lj)
+ end
+ local lc = object.linecap
+ if lc and lc ~= linecap then
+ linecap = lc
+ result[#result+1] = f_J(lc)
+ end
+ if both then
+ if dashed ~= false then -- was just dashed test
+ result[#result+1] = "[] 0 d"
+ dashed = false
+ end
+ else
+ local dl = object.dash
+ if dl then
+ local d = f_d(concat(dl.dashes or {}," "),dl.offset)
+ if d ~= dashed then
+ dashed = d
+ result[#result+1] = d
+ end
+ elseif dashed ~= false then -- was just dashed test
+ result[#result+1] = "[] 0 d"
+ dashed = false
+ end
+ end
+ local path = object.path -- newpath
+ local transformed = false
+ local penwidth = 1
+ local open = path and path[1].left_type and path[#path].right_type -- at this moment only "end_point"
+ local pen = object.pen
+ if pen then
+ if pen.type == "elliptical" then
+ transformed, penwidth = pen_characteristics(original) -- boolean, value
+ if penwidth ~= linewidth then
+ result[#result+1] = f_w(penwidth)
+ linewidth = penwidth
+ end
+ if objecttype == "fill" then
+ objecttype = "both"
+ end
+ else -- calculated by mplib itself
+ objecttype = "fill"
+ end
+ end
+ if transformed then
+ result[#result+1] = "q"
+ end
+ if path then
+ if savedpath then
+ for i=1,#savedpath do
+ local path = savedpath[i]
+ if transformed then
+ flushconcatpath(path,result,open,tolerance)
+ else
+ flushnormalpath(path,result,open,tolerance)
+ end
+ end
+ savedpath = nil
+ end
+ if flush then
+ -- ignore this path
+ elseif transformed then
flushconcatpath(path,result,open,tolerance)
else
flushnormalpath(path,result,open,tolerance)
end
+ if force_stroke then
+ result[#result+1] = open and "S" or "h S"
+ elseif objecttype == "fill" then
+ result[#result+1] = evenodd and "h f*" or "h f" -- f* = eo
+ elseif objecttype == "outline" then
+ if both then
+ result[#result+1] = evenodd and "h B*" or "h B" -- B* = eo
+ else
+ result[#result+1] = open and "S" or "h S"
+ end
+ elseif objecttype == "both" then
+ result[#result+1] = evenodd and "h B*" or "h B" -- B* = eo -- b includes closepath
+ end
end
- savedpath = nil
- end
- if flush then
- -- ignore this path
- elseif transformed then
- flushconcatpath(path,result,open,tolerance)
- else
- flushnormalpath(path,result,open,tolerance)
- end
- if force_stroke then
- result[#result+1] = open and "S" or "h S"
- elseif objecttype == "fill" then
- result[#result+1] = evenodd and "h f*" or "h f" -- f* = eo
- elseif objecttype == "outline" then
- if both then
- result[#result+1] = evenodd and "h B*" or "h B" -- B* = eo
- else
- result[#result+1] = open and "S" or "h S"
+ if transformed then
+ result[#result+1] = "Q"
end
- elseif objecttype == "both" then
- result[#result+1] = evenodd and "h B*" or "h B" -- B* = eo -- b includes closepath
- end
- end
- if transformed then
- result[#result+1] = "Q"
- end
- local path = object.htap
- if path then
- if transformed then
- result[#result+1] = "q"
- end
- if savedhtap then
- for i=1,#savedhtap do
- local path = savedhtap[i]
+ local path = object.htap
+ if path then
+ if transformed then
+ result[#result+1] = "q"
+ end
+ if savedhtap then
+ for i=1,#savedhtap do
+ local path = savedhtap[i]
+ if transformed then
+ flushconcatpath(path,result,open,tolerance)
+ else
+ flushnormalpath(path,result,open,tolerance)
+ end
+ end
+ savedhtap = nil
+ evenodd = true
+ end
if transformed then
flushconcatpath(path,result,open,tolerance)
else
flushnormalpath(path,result,open,tolerance)
end
+ if force_stroke then
+ result[#result+1] = open and "S" or "h S"
+ elseif objecttype == "fill" then
+ result[#result+1] = evenodd and "h f*" or "h f" -- f* = eo
+ elseif objecttype == "outline" then
+ result[#result+1] = open and "S" or "h S"
+ elseif objecttype == "both" then
+ result[#result+1] = evenodd and "h B*" or "h B" -- B* = eo -- b includes closepath
+ end
+ if transformed then
+ result[#result+1] = "Q"
+ end
+ end
+ if after then
+ result = pluginactions(after,result,flushfigure)
end
- savedhtap = nil
- evenodd = true
end
- if transformed then
- flushconcatpath(path,result,open,tolerance)
- else
- flushnormalpath(path,result,open,tolerance)
+ if object.grouped then
+ -- can be qQ'd so changes can end up in groups
+ miterlimit, linecap, linejoin, dashed, linewidth = -1, -1, -1, "", false
end
- if force_stroke then
- result[#result+1] = open and "S" or "h S"
- elseif objecttype == "fill" then
- result[#result+1] = evenodd and "h f*" or "h f" -- f* = eo
- elseif objecttype == "outline" then
- result[#result+1] = open and "S" or "h S"
- elseif objecttype == "both" then
- result[#result+1] = evenodd and "h B*" or "h B" -- B* = eo -- b includes closepath
+ elseif objecttype == "start_clip" then
+ -- local evenodd = not object.istext and object.postscript == "evenodd"
+ local evenodd = object.postscript == "evenodd"
+ result[#result+1] = "q"
+ flushnormalpath(object.path,result,false,tolerance)
+ result[#result+1] = evenodd and "W* n" or "W n"
+ elseif objecttype == "stop_clip" then
+ result[#result+1] = "Q"
+ miterlimit, linecap, linejoin, dashed, linewidth = -1, -1, -1, "", false
+ elseif objecttype == "start_bounds" or objecttype == "stop_bounds" then
+ -- skip
+ elseif objecttype == "start_group" then
+ if lpdf.flushgroup then
+ local before, after = processplugins(object)
+ if before then
+ result[#result+1] = "q"
+ result = pluginactions(before,result,flushfigure)
+ insert(groupstack, {
+ after = after,
+ result = result,
+ bbox = toboundingbox(object.path),
+ })
+ result = { }
+ miterlimit, linecap, linejoin, dashed, linewidth = -1, -1, -1, "", false
+ else
+ insert(groupstack,false)
+ end
+ else
+ insert(groupstack,false)
end
- if transformed then
+ elseif objecttype == "stop_group" then
+ local data = remove(groupstack)
+ if data then
+ local reference = lpdf.flushgroup(concat(result,"\r"),data.bbox)
+ result = data.result
+ result[#result+1] = reference
+ result = pluginactions(data.after,result,flushfigure)
result[#result+1] = "Q"
+ miterlimit, linecap, linejoin, dashed, linewidth = -1, -1, -1, "", false
end
- end
- if after then
- result = pluginactions(after,result,flushfigure)
- end
- end
- if object.grouped then
- -- can be qQ'd so changes can end up in groups
- miterlimit, linecap, linejoin, dashed, linewidth = -1, -1, -1, "", false
- end
- elseif objecttype == "start_clip" then
- -- local evenodd = not object.istext and object.postscript == "evenodd"
- local evenodd = object.postscript == "evenodd"
- result[#result+1] = "q"
- flushnormalpath(object.path,result,false,tolerance)
- result[#result+1] = evenodd and "W* n" or "W n"
- elseif objecttype == "stop_clip" then
- result[#result+1] = "Q"
- miterlimit, linecap, linejoin, dashed, linewidth = -1, -1, -1, "", false
- elseif objecttype == "start_bounds" or objecttype == "stop_bounds" then
- -- skip
- elseif objecttype == "start_group" then
- if lpdf.flushgroup then
- local before, after = processplugins(object)
- if before then
- result[#result+1] = "q"
- result = pluginactions(before,result,flushfigure)
- insert(groupstack, {
- after = after,
- result = result,
- bbox = toboundingbox(object.path),
- })
- result = { }
- miterlimit, linecap, linejoin, dashed, linewidth = -1, -1, -1, "", false
+ -- if objecttype == "text" then
+ -- result[#result+1] = "q"
+ -- local ot = object.transform -- 3,4,5,6,1,2
+ -- result[#result+1] = f_cm(ot[3],ot[4],ot[5],ot[6],ot[1],ot[2])
+ -- flushfigure(result) -- flush accumulated literals
+ -- result = { }
+ -- textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth)
+ -- result[#result+1] = "Q"
+ -- elseif objecttype == "special" then
+ -- if processspecial then
+ -- processspecial(object.prescript)
+ -- end
+ -- else
else
- insert(groupstack,false)
+ -- error
end
- else
- insert(groupstack,false)
- end
- elseif objecttype == "stop_group" then
- local data = remove(groupstack)
- if data then
- local reference = lpdf.flushgroup(concat(result,"\r"),data.bbox)
- result = data.result
- result[#result+1] = reference
- result = pluginactions(data.after,result,flushfigure)
- result[#result+1] = "Q"
- miterlimit, linecap, linejoin, dashed, linewidth = -1, -1, -1, "", false
end
- -- if objecttype == "text" then
- -- result[#result+1] = "q"
- -- local ot = object.transform -- 3,4,5,6,1,2
- -- result[#result+1] = f_cm(ot[3],ot[4],ot[5],ot[6],ot[1],ot[2])
- -- flushfigure(result) -- flush accumulated literals
- -- result = { }
- -- textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth)
- -- result[#result+1] = "Q"
- -- elseif objecttype == "special" then
- -- if processspecial then
- -- processspecial(object.prescript)
- -- end
- -- else
- else
- -- error
end
end
end
diff --git a/tex/context/base/mkxl/mlib-pps.lmt b/tex/context/base/mkxl/mlib-pps.lmt
index cae1bbb5f..7790f0f23 100644
--- a/tex/context/base/mkxl/mlib-pps.lmt
+++ b/tex/context/base/mkxl/mlib-pps.lmt
@@ -14,6 +14,7 @@ local Cs, Cf, C, Cg, Ct, P, S, V, Carg = lpeg.Cs, lpeg.Cf, lpeg.C, lpeg.Cg, lpeg
local lpegmatch, tsplitat, tsplitter = lpeg.match, lpeg.tsplitat, lpeg.tsplitter
local formatters, toboolean = string.formatters, string.toboolean
local exists, savedata = io.exists, io.savedata
+local stepper = utilities.parsers.stepper
local mplib = mplib
local metapost = metapost
@@ -578,6 +579,7 @@ function metapost.graphic_base_pass(specification)
local top = startjob(true,"base",mpx)
local data = specification.data or ""
local inclusions = specification.inclusions or ""
+ local filtering = specification.filtering
local initializations = specification.initializations or ""
local askedfig,
wrappit = checkaskedfig(specification.figure)
@@ -589,6 +591,11 @@ function metapost.graphic_base_pass(specification)
top.mpx = mpx
top.data = data
top.initializations = initializations
+ if filtering then
+ local t = { }
+ stepper(filtering,function(k) t[k] = true end)
+ filtering = t
+ end
if trace_runs then
report_metapost("running job %s, asked figure %a",nofruns,askedfig)
end
@@ -596,6 +603,7 @@ function metapost.graphic_base_pass(specification)
mpx = mpx,
askedfig = askedfig,
incontext = true,
+ filtering = filtering,
data = {
inclusions,
wrappit and do_begin_fig or "",
diff --git a/tex/context/base/mkxl/node-par.lmt b/tex/context/base/mkxl/node-par.lmt
index 125c1b687..290c2fbd8 100644
--- a/tex/context/base/mkxl/node-par.lmt
+++ b/tex/context/base/mkxl/node-par.lmt
@@ -11,10 +11,10 @@ local stoptiming = statistics.stoptiming
local sequencers = utilities.sequencers
--- This is called a lot! I'm a bit reluctant with this one because it is
--- sensitive for order. In many other callbacks ther eis no action at the
--- tex end but here ... Anyway, it has been around for a while now (2019)
--- and so far I had no need for extensive usage so we're okay.
+-- This is called a lot! I'm a bit reluctant with this one because it is sensitive
+-- for order. In many other callbacks there is no action at the tex end but here ...
+-- Anyway, it has been around for a while now (2019) and so far I had no need for
+-- extensive usage so we're okay.
do
@@ -33,7 +33,7 @@ end
-- Originally this one was meant to deal with the indentation (like turn a box into
-- a skip or prevent it) but that never really was used. The return value still
--- detemines if an indentation box or skip is injected. Will I change that?
+-- determines if an indentation box or skip is injected. Will I change that?
do
diff --git a/tex/context/base/mkxl/trac-deb.lmt b/tex/context/base/mkxl/trac-deb.lmt
index 506a4e9cd..13e3c7e70 100644
--- a/tex/context/base/mkxl/trac-deb.lmt
+++ b/tex/context/base/mkxl/trac-deb.lmt
@@ -248,7 +248,7 @@ function tracers.printerror(specification)
report_str(tracers.showlines(filename,linenumber,offset,tonumber(luaerrorline)))
report_nl()
end
- local errname = file.addsuffix(tex.jobname .. "-error","log")
+ local errname = tex.jobname .. "-error.log"
if quitonerror then
table.save(errname,specification)
local help = specification.lasttexhelp
@@ -264,7 +264,7 @@ function tracers.printerror(specification)
end
end
-luatex.wrapup(function() os.remove(file.addsuffix(tex.jobname .. "-error","log")) end)
+luatex.wrapup(function() os.remove(tex.jobname .. "-error.log") end)
local function processwarning(offset)
local warningstate = status.warningstate
diff --git a/tex/context/base/mkxl/typo-drp.lmt b/tex/context/base/mkxl/typo-drp.lmt
index 23bf254a8..de65dd55d 100644
--- a/tex/context/base/mkxl/typo-drp.lmt
+++ b/tex/context/base/mkxl/typo-drp.lmt
@@ -312,6 +312,15 @@ actions[v_default] = function(head,setting)
end
texset("hangafter",hangafter,true)
texset("hangindent",hangindent,true)
+-- local hsize = texget("hsize",false)
+-- local step = { hangindent, hsize - hangindent }
+-- local shape = { ["shift"] = true }
+-- for i=1,-hangafter do
+-- shape[#shape+1] = step
+-- end
+-- shape[#shape+1] = { 0, hsize }
+-- texset("parshape",shape)
+-- tex.snapshotpar(0x20000)
end
if indent then
insertafter(first,first,new_kern(-parindent))
diff --git a/tex/context/base/mkxl/typo-drp.mkxl b/tex/context/base/mkxl/typo-drp.mkxl
index da11f76e7..beed0f244 100644
--- a/tex/context/base/mkxl/typo-drp.mkxl
+++ b/tex/context/base/mkxl/typo-drp.mkxl
@@ -79,6 +79,26 @@
\permanent\tolerant\protected\def\flushinitial % when used inside a mechanism that forgets
{\typo_initial_handle}
+\newconstant \c_initial_lines
+\newconditional\c_initial_synchronize
+
+% First experiment:
+%
+% \startluacode
+% function nodes.handlers.forgetinitial(mode,indented,context)
+% token.expandmacro("forgetinitial")
+% return indented
+% end
+% utilities.sequencers.prependaction("paragraph","system","nodes.handlers.forgetinitial")
+% utilities.sequencers.enableaction("paragraph","nodes.handlers.forgetinitial")
+% \stopluacode
+%
+% Second experiment:
+%
+% \appendtoks
+% \forgetinitial
+% \to \everybeforepar
+
\protected\def\typo_initial_handle_indeed#1#2%
{\dontleavehmode
\begingroup
@@ -109,11 +129,50 @@
\relax
\c_attr_initial\plusone
\initialparameter\c!text
- \endgroup
- \enforced\glettonothing\typo_initial_handle}
+ \normalexpanded{\endgroup\c_initial_lines\the\scratchcounter}%
+ \enforced\glettonothing\typo_initial_handle
+ \ifconditional\c_initial_synchronize
+ \appendtoks \forgetinitial \to \everybeforepar
+ \fi}
\lettonothing\typo_initial_handle % hook into everypar
+\permanent\protected\def\forgetinitial
+ {\ifcase\c_initial_lines\else
+ \begingroup
+ \advance\c_initial_lines-\prevgraf\relax
+ \ifcase\c_initial_lines\else
+ \obeydepth
+ \forgetall
+ \testpage[\the\c_initial_lines]%
+ \dorecurse\c_initial_lines{\nointerlineskip\hpack to \hsize{\strut}\par}%
+ \fi
+ \endgroup
+ \c_initial_lines\zerocount
+ \ifconditional\c_initial_synchronize
+ \removetoks \forgetinitial \from \everybeforepar
+ \fi
+ \fi}
+
+%D \starttyping
+%D \setupinitial[n=2,style=\tfd,location=text]
+%D \setuphead[chapter][after=\placeinitial]
+%D \enableexperiments[autoforgetinitials]
+%D
+%D \starttext
+%D \chapter{Test me} Hello world!
+%D %\forgetinitial \input tufte
+%D \input tufte
+%D \stoptext
+%D \stoptyping
+
+% \enableexperiments[autoforgetinitials]
+
+\installtexexperiment
+ {autoforgetinitials}
+ {\settrue \c_initial_synchronize}
+ {\setfalse\c_initial_synchronize}
+
% \setupbodyfont[dejavu,9pt]
%
% \startbuffer
diff --git a/tex/generic/context/luatex/luatex-basics-nod.lua b/tex/generic/context/luatex/luatex-basics-nod.lua
index 76e36f2aa..61587d5de 100644
--- a/tex/generic/context/luatex/luatex-basics-nod.lua
+++ b/tex/generic/context/luatex/luatex-basics-nod.lua
@@ -118,7 +118,7 @@ nuts.setcomponents = direct.setcomponents
nuts.setdirection = direct.setdirection
nuts.setdisc = direct.setdisc
nuts.setreplace = direct.setreplace
-nuts.setfield = setfield
+nuts.setfield = direct.setfield
nuts.setkern = direct.setkern
nuts.setlink = direct.setlink
nuts.setlist = direct.setlist
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 366745bab..891377edd 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2021-07-06 18:44
+-- merge date : 2021-07-09 18:13
do -- begin closure to overcome local limits and interference
@@ -4996,7 +4996,7 @@ nuts.setcomponents=direct.setcomponents
nuts.setdirection=direct.setdirection
nuts.setdisc=direct.setdisc
nuts.setreplace=direct.setreplace
-nuts.setfield=setfield
+nuts.setfield=direct.setfield
nuts.setkern=direct.setkern
nuts.setlink=direct.setlink
nuts.setlist=direct.setlist