summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2021-03-01 15:56:41 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2021-03-01 15:56:41 +0100
commitd07afd7261f4bb5486cc016d8c90d532ba7fc0e4 (patch)
tree19f6b457352c70aa6dd74830fb268d6f42b6cee3 /tex
parent4f7f67101a808c6b6c89d64ad5ee1f1701d8f632 (diff)
downloadcontext-d07afd7261f4bb5486cc016d8c90d532ba7fc0e4.tar.gz
2021-03-01 15:36: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/data-env.lua4
-rw-r--r--tex/context/base/mkiv/publ-ini.mkiv6
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25335 -> 25363 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin256139 -> 256166 bytes
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl4
-rw-r--r--tex/context/base/mkxl/meta-imp-txt.lmt86
-rw-r--r--tex/context/base/mkxl/meta-imp-txt.mkxl66
-rw-r--r--tex/context/base/mkxl/mlib-ctx.lmt2
-rw-r--r--tex/context/base/mkxl/mlib-fio.lmt2
-rw-r--r--tex/context/base/mkxl/mlib-lua.lmt2
-rw-r--r--tex/context/base/mkxl/mlib-mpf.lmt12
-rw-r--r--tex/context/base/mkxl/mlib-run.lmt2
-rw-r--r--tex/context/base/mkxl/node-par.lmt21
-rw-r--r--tex/context/base/mkxl/publ-ini.mkxl12
-rw-r--r--tex/context/base/mkxl/spac-par.lmt1
-rw-r--r--tex/context/base/mkxl/spac-par.mkxl55
-rw-r--r--tex/context/base/mkxl/typo-par.lmt40
-rw-r--r--tex/context/base/mkxl/typo-shp.lmt117
-rw-r--r--tex/context/base/mkxl/typo-shp.mkxl125
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
25 files changed, 336 insertions, 233 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index b1c603769..623678b40 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.02.27 19:27}
+\newcontextversion{2021.03.01 15:33}
%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 8486049d0..9ac6432f5 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.02.27 19:27}
+\edef\contextversion{2021.03.01 15:33}
%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 c984f50cf..229feff8a 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.02.27 19:27}
+\newcontextversion{2021.03.01 15:33}
%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 e2afeb0d4..796f686fc 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.02.27 19:27}
+\edef\contextversion{2021.03.01 15:33}
%D Kind of special:
diff --git a/tex/context/base/mkiv/data-env.lua b/tex/context/base/mkiv/data-env.lua
index 53f0c27cc..3b10d89b8 100644
--- a/tex/context/base/mkiv/data-env.lua
+++ b/tex/context/base/mkiv/data-env.lua
@@ -94,7 +94,9 @@ local relations = allocate { -- todo: handlers also here
mp = {
names = { "mp" },
variable = 'MPINPUTS',
- suffixes = { 'mp', 'mpvi', 'mpiv', 'mpxl', 'mpii' },
+ suffixes = CONTEXTLMTXMODE > 0
+ and { 'mp', 'mpxl', 'mpvi', 'mpiv', 'mpii' }
+ or { 'mp', 'mpvi', 'mpiv', 'mpii' },
usertype = true,
},
tex = {
diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv
index ef2c5cbda..dfed53c73 100644
--- a/tex/context/base/mkiv/publ-ini.mkiv
+++ b/tex/context/base/mkiv/publ-ini.mkiv
@@ -396,6 +396,10 @@
\let\btxsetup\fastsetup
+% This fails when we check field values:
+
+\let\btxrawfield\btxfield
+
\def\btxfield #1{\dostarttagged\t!pubfld{#1}\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}
\def\btxdetail #1{\dostarttagged\t!pubfld{#1}\clf_btxdetail{\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}
\def\btxflush #1{\dostarttagged\t!pubfld{#1}\clf_btxflush {\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}
@@ -681,7 +685,7 @@
\dostarttagged\t!publication\empty
\dotagpublication\currentbtxdataset\currentbtxtag
\redoconvertfont % see (**) in strc-lst, this will become an configuration option
- \edef\currentbtxcategory{\btxfield{category}}%
+ \edef\currentbtxcategory{\btxrawfield{category}}%
\ignorespaces
\ifconditional\c_btx_list_texts
\dostarttagged\t!listtext\s!left
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 0b1992890..58cd21876 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 b52a1d01d..4241ea0a2 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 8e2816e46..088eb9591 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.02.27 19:27}
+\newcontextversion{2021.03.01 15:33}
%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 4976b707d..d84bbb73c 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.02.27 19:27}
+\immutable\edef\contextversion{2021.03.01 15:33}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -568,6 +568,8 @@
\loadmkxlfile{meta-blb}
\loadmkxlfile{grph-epd}
+\loadmkxlfile{typo-shp}
+
\loadmkxlfile{math-inc} % an experiment
\loadmkxlfile{publ-inc} % an experiment
diff --git a/tex/context/base/mkxl/meta-imp-txt.lmt b/tex/context/base/mkxl/meta-imp-txt.lmt
deleted file mode 100644
index f7721956f..000000000
--- a/tex/context/base/mkxl/meta-imp-txt.lmt
+++ /dev/null
@@ -1,86 +0,0 @@
-if not modules then modules = { } end modules ['meta-imp-txt'] = {
- version = 1.001,
- comment = "companion to meta-imp-txt.mkiv",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "see context related readme files",
-}
-
-local setmetatableindex = table.setmetatableindex
-
-local texset = tex.set
-
-local scannumeric = mp.scan.numeric
-local scaninteger = mp.scan.integer
-local scanboolean = mp.scan.boolean
-local scanstring = mp.scan.string
-
-local bpfactor = number.dimenfactors.bp
-
-local metapost = metapost
-
-local parshapes = { }
-local properties = { }
-
--- initialize shapes to 0 hsize
-
-metapost.parshapes = { }
-
-function metapost.parshapes.reset()
- parshapes = { }
- properties = { }
-end
-
-function metapost.parshapes.next()
- properties = { }
- parshapes[#parshapes+1] = properties
-end
-
-function metapost.parshapes.inspect()
- inspect(parshapes)
-end
-
-function metapost.parshapes.get(index,name)
- local v = parshapes[index][name]
- if type(v) == "boolean" then
- context(v and 1 or 0)
- else
- context(v)
- end
-end
-
-function metapost.parshapes.wholeshape() -- maybe just collect them earlier
- local t, n = { }, 0
- for i=1,#parshapes do
- local s = parshapes[i].shape
- for i=1,#s do
- n = n + 1
- t[n] = s[i]
- end
- end
- texset("parshape",t)
-end
-
-metapost.registerscript("setparshapeproperty", function()
- local k = scanstring()
- if k == "line" then
- local entry = properties.shape[scannumeric()]
- local indent = scannumeric() / bpfactor
- local width = scannumeric() / bpfactor
- entry[1] = indent
- entry[2] = width
- elseif k == "lines" then
- properties.lines = scaninteger()
- properties.shape = setmetatableindex(function(t,k)
- local v = { 0, properties.width or 0 }
- t[k] = v
- return v
- end)
- elseif k == "first" then
- properties[k] = scanboolean()
- elseif k == "inspect" then
- inspect(properties)
- else
- properties[k] = scannumeric() / bpfactor
- end
-end)
diff --git a/tex/context/base/mkxl/meta-imp-txt.mkxl b/tex/context/base/mkxl/meta-imp-txt.mkxl
index 4654ca722..0c3516a7b 100644
--- a/tex/context/base/mkxl/meta-imp-txt.mkxl
+++ b/tex/context/base/mkxl/meta-imp-txt.mkxl
@@ -21,70 +21,8 @@
%D This time we combine \TEX, \METAPOST\ and \LUA, so we do't need a temporary file
%D to communicate from \METAPOST\ to \TEX. We just store information in \LUA\ tables.
-\ifdefined\startshapetext
-
- % now moved into the core
-
-\else
-
- \ifdefined\shapetextbox \else
- \newbox \shapetextbox
- \newcount\shapetextindex
- \fi
-
- \ctxloadluafile{meta-imp-txt.lmt}
-
- \startMPextensions loadmodule "text" ; \stopMPextensions
-
- \protected\def\startshapetext[#1]%
- {\begingroup
- \global\shapetextindex\zerocount
- \global\setbox\shapetextbox\vbox\bgroup
- % analyze the mp shapes
- \ctxlua{metapost.parshapes.reset()}
- \def\docommand##1%
- {\ctxlua{metapost.parshapes.next()}%
- \startMPcalculation
- \includeMPgraphic{##1}%
- \stopMPcalculation}%
- \processcommalist[#1]\docommand
- \forgetall
- \dontcomplain
- % setup tex part (maybe just enable grid snapping)
- \setuptolerance[\v!verytolerant,\v!stretch]% default
- \setuplayout[\c!grid=\v!yes]%
- \ctxlua{metapost.parshapes.wholeshape()}%
- \pushparagraphtweak {prune}}
-
- \protected\def\stopshapetext
- {\popparagraphtweak
- \egroup
- \endgroup}
-
- \def\getshapeparameter#1{\ctxlua{metapost.parshapes.get(\number\shapetextindex,"#1")}}
-
- \protected\def\getshapetext
- {\vbox\bgroup
- \forgetall
- \dontcomplain
- \global\advance\shapetextindex\plusone
- \scratchcounter\getshapeparameter{lines}\relax
- \scratchwidth \getshapeparameter{width}\scaledpoint\relax
- \scratchheight \getshapeparameter{height}\scaledpoint\relax
- \setbox\scratchbox\vpack to \scratchheight
- {\splittopskip\strutheight
- \vskip\dimexpr\getshapeparameter{voffset}\scaledpoint\relax
- \ifcase\numexpr\getshapeparameter{first}\relax\else
- \vskip\lineheight
- \fi
- \hskip\dimexpr\getshapeparameter{hoffset}\scaledpoint\relax
- \hpack{\vsplit\shapetextbox to \scratchcounter\lineheight}}%
- \wd\scratchbox\scratchwidth
- \ht\scratchbox\scratchheight
- \dp\scratchbox\zeropoint
- \box\scratchbox
- \egroup}
-
+\ifdefined\startshapetext \else
+ \writestatus{system}{something is wrong here}
\fi
%D Following:
diff --git a/tex/context/base/mkxl/mlib-ctx.lmt b/tex/context/base/mkxl/mlib-ctx.lmt
index 558553921..2569a6066 100644
--- a/tex/context/base/mkxl/mlib-ctx.lmt
+++ b/tex/context/base/mkxl/mlib-ctx.lmt
@@ -80,7 +80,7 @@ implement {
}
local patterns = {
- CONTEXTLMTXMODE > 0 and "meta-imp-%s.mkxl" or "",
+ "meta-imp-%s.mkxl",
"meta-imp-%s.mkiv",
"meta-imp-%s.tex",
-- obsolete:
diff --git a/tex/context/base/mkxl/mlib-fio.lmt b/tex/context/base/mkxl/mlib-fio.lmt
index bc890a37d..2e31d56d1 100644
--- a/tex/context/base/mkxl/mlib-fio.lmt
+++ b/tex/context/base/mkxl/mlib-fio.lmt
@@ -69,7 +69,7 @@ local suffixlist = { "mpxl", "mpiv", "mp" } -- no "mf"
local function findmpfile(name,ftype)
local validtyp = validftype(ftype)
local fullname = findfile(name,validtyp)
- if fullname and fulllname ~= "" then
+ if fullname and fullname ~= "" then
return fullname
elseif suffix(name) == "" then
for i=1,#suffixlist do
diff --git a/tex/context/base/mkxl/mlib-lua.lmt b/tex/context/base/mkxl/mlib-lua.lmt
index e8f33a53a..068d17f32 100644
--- a/tex/context/base/mkxl/mlib-lua.lmt
+++ b/tex/context/base/mkxl/mlib-lua.lmt
@@ -63,7 +63,7 @@ scan.property = function(k) if trace then reporti("property") end return s
scan.numeric = function() if trace then reporti("numeric") end return scan_numeric (currentmpx) end
scan.integer = function() if trace then reporti("integer") end return scan_integer (currentmpx) end
scan.boolean = function() if trace then reporti("boolean") end return scan_boolean (currentmpx) end
-scan.string = function() if trace then reporti("string") end if currentmpx then return scan_string (currentmpx) end end
+scan.string = function() if trace then reporti("string") end return scan_string (currentmpx) end
scan.pair = function(t) if trace then reporti("pair") end return scan_pair (currentmpx,t) end
scan.color = function(t) if trace then reporti("color") end return scan_color (currentmpx,t) end
scan.cmykcolor = function(t) if trace then reporti("cmykcolor") end return scan_cmykcolor (currentmpx,t) end
diff --git a/tex/context/base/mkxl/mlib-mpf.lmt b/tex/context/base/mkxl/mlib-mpf.lmt
index 42cee676c..87b6c2d4e 100644
--- a/tex/context/base/mkxl/mlib-mpf.lmt
+++ b/tex/context/base/mkxl/mlib-mpf.lmt
@@ -22,7 +22,8 @@ local report_luarun = logs.reporter("metapost","lua")
local report_script = logs.reporter("metapost","script")
local report_message = logs.reporter("metapost")
-local trace_luarun = false trackers.register("metapost.lua",function(v) trace_luarun = v end)
+local trace_luarun = false trackers.register("metapost.lua", function(v) trace_luarun = v end)
+local trace_script = false trackers.register("metapost.script",function(v) trace_script = v end)
local be_tolerant = true directives.register("metapost.lua.tolerant", function(v) be_tolerant = v end)
@@ -86,11 +87,18 @@ do
else
runscripts[nofscripts] = name
end
+ if trace_script then
+ report_script("registering script %a as %i",name,nofscripts)
+ end
return nofscripts
end
function metapost.scriptindex(name)
- return runnames[name] or 0
+ local index = runnames[name] or 0
+ if trace_script then
+ report_script("fetching scriptindex %i of %a",index,name)
+ end
+ return index
end
-- The gbuffer sharing and such is not really needed now but make a dent when
diff --git a/tex/context/base/mkxl/mlib-run.lmt b/tex/context/base/mkxl/mlib-run.lmt
index a79ce99ef..eacb148cc 100644
--- a/tex/context/base/mkxl/mlib-run.lmt
+++ b/tex/context/base/mkxl/mlib-run.lmt
@@ -327,7 +327,9 @@ function metapost.pushformat(specification,f,m) -- was: instance, name, method
end
end
if preamble then
+ metapost.pushscriptrunner(mpx)
executempx(mpx,preamble)
+ metapost.popscriptrunner()
end
specification.mpx = mpx
return mpx
diff --git a/tex/context/base/mkxl/node-par.lmt b/tex/context/base/mkxl/node-par.lmt
index 9354d769f..125c1b687 100644
--- a/tex/context/base/mkxl/node-par.lmt
+++ b/tex/context/base/mkxl/node-par.lmt
@@ -11,7 +11,10 @@ local stoptiming = statistics.stoptiming
local sequencers = utilities.sequencers
--- This are called a lot!
+-- 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.
do
@@ -28,6 +31,10 @@ do
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?
+
do
local actions = sequencers.new {
@@ -41,11 +48,11 @@ do
sequencers.appendgroup(actions,"system") -- private
sequencers.appendgroup(actions,"after" ) -- user
- local function paragraph(mode,indented)
+ local function paragraph(mode,indented,context) -- context used to be the cmd code
local runner = actions.runner
if runner then
starttiming(builders)
- indented = runner(mode,indented)
+ indented = runner(mode,indented,context)
stoptiming(builders)
end
return indented
@@ -58,7 +65,8 @@ end
-- This one is a playground for some old metafun gimmicks that I want to improve
-- while I'm updating the manual to lmtx. but it might also be useful for other
-- purposes. It fits in the category obscure and probably takes while to stabelize
--- (if it stays at all).
+-- (if it stays at all). Again, this is one that has the danger of interference,
+-- so when it finally got an action handler it only got a system one.
do
@@ -86,3 +94,8 @@ do
callbacks.register("paragraph_context",parcontext,"when the context is dealt with")
end
+
+-- This means that we now have most callbacks in use, even the ones that I'm not sure
+-- about. It also means that with the above enabled we might have performance now at
+-- its worst. I can optimize this a little but it's not worth the effort (and added
+-- complication).
diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl
index b1af17413..2f4d817f2 100644
--- a/tex/context/base/mkxl/publ-ini.mkxl
+++ b/tex/context/base/mkxl/publ-ini.mkxl
@@ -398,12 +398,22 @@
\aliased\let\btxsetup\fastsetup
+\permanent\def\btxrawfield #1{\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}}
+
\permanent\def\btxfield #1{\dostarttagged\t!pubfld{#1}\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}
\permanent\def\btxdetail #1{\dostarttagged\t!pubfld{#1}\clf_btxdetail{\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}
\permanent\def\btxflush #1{\dostarttagged\t!pubfld{#1}\clf_btxflush {\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}
\permanent\def\btxdirect #1{\dostarttagged\t!pubfld{#1}\clf_btxdirect{\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}
%permanent\def\btxauthorfield#1{\dostarttagged\t!pubfld{#1}\clf_btxauthorfield \currentbtxauthorindex{#1}\dostoptagged}
+% Also possible but inefficient:
+%
+% \permanent\def\btxfield #1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}\localcontrolled{\dostoptagged}}
+% \permanent\def\btxdetail #1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxdetail{\currentbtxdataset}{\currentbtxtag}{#1}\localcontrolled{\dostoptagged}}
+% \permanent\def\btxflush #1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxflush {\currentbtxdataset}{\currentbtxtag}{#1}\localcontrolled{\dostoptagged}}
+% \permanent\def\btxdirect #1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxdirect{\currentbtxdataset}{\currentbtxtag}{#1}\localcontrolled{\dostoptagged}}
+% %permanent\def\btxauthorfield#1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxauthorfield \currentbtxauthorindex{#1}\localcontrolled{\dostoptagged}}
+
%D How complex will we go? Can we assume that e.g. an apa style will not be mixed
%D with another one? I think this assumption is okay. For manuals we might want to
%D mix but we can work around it.
@@ -691,7 +701,7 @@
\dostarttagged\t!publication\empty
\dotagpublication\currentbtxdataset\currentbtxtag
\redoconvertfont % see (**) in strc-lst, this will become an configuration option
- \edef\currentbtxcategory{\btxfield{category}}%
+ \edef\currentbtxcategory{\btxrawfield{category}}%
\ignorespaces
\ifconditional\c_btx_list_texts
\dostarttagged\t!listtext\s!left
diff --git a/tex/context/base/mkxl/spac-par.lmt b/tex/context/base/mkxl/spac-par.lmt
index 3af8ea415..179fc1f43 100644
--- a/tex/context/base/mkxl/spac-par.lmt
+++ b/tex/context/base/mkxl/spac-par.lmt
@@ -78,3 +78,4 @@ implement {
context(t and t[wrappers[id]] or 0)
end
}
+
diff --git a/tex/context/base/mkxl/spac-par.mkxl b/tex/context/base/mkxl/spac-par.mkxl
index 06aeee4d8..134a60e2a 100644
--- a/tex/context/base/mkxl/spac-par.mkxl
+++ b/tex/context/base/mkxl/spac-par.mkxl
@@ -453,59 +453,4 @@
\expandafter\firstofoneargument
\fi}
-%D Something new (experimental and evolving):
-%D
-%D \starttyping
-%D \parshape
-%D 3
-%D options 1 % repeat
-%D 0cm 10cm 2cm 8cm 4cm 6cm
-%D lots of text
-%D \stoptyping
-%D
-%D \starttyping
-%D \parshape 4 5mm 125mm 0mm 120mm 5mm 125mm 0mm 120mm
-%D \pushparagraphtweak {repeat}
-%D verse line 1\crlf
-%D verse line 2\crlf
-%D verse line 3\crlf
-%D verse line 4\par
-%D etc
-%D \popparagraphtweak
-%D \stoptyping
-
-%D But we wrap this in a more abstract interface:
-
-\installcorenamespace {parshapes}
-
-% \installcommandhandler \??shapedparagraph {shapedparagraph} \??shapedparagraph
-
-\aliased\let\stopparagraphshape\relax
-
-\permanent\protected\def\startparagraphshape[#1]#2\stopparagraphshape
- {\defcsname\??parshapes#1\endcsname{#2}}
-
-\permanent\protected\def\rawparagraphshape#1%
- {\begincsname\??parshapes#1\endcsname}
-
-\permanent\protected\def\setparagraphshape[#1]%
- {\ifcsname\??parshapes#1\endcsname
- \expandafter\clf_setparagraphshape\lastnamedcs done\relax
- \fi}
-
-% \permanent\protected\tolerant\def\startshapedparagraph[#1]#*[#2]% no grouping
-% {\setparshape[#1]%
-% \pushparagraphtweak{#2}\relax}
-
-\permanent\protected\tolerant\def\startshapedparagraph[#1]% no grouping
- {\begingroup
- \getdummyparameters[\c!method=,\c!list=,#1]%
- \normalexpanded
- {\endgroup
- \setparagraphshape[\dummyparameter\c!list]%
- \pushparagraphtweak{\dummyparameter\c!method}\relax}}
-
-\permanent\protected\def\stopshapedparagraph
- {\popparagraphtweak}
-
\protect \endinput
diff --git a/tex/context/base/mkxl/typo-par.lmt b/tex/context/base/mkxl/typo-par.lmt
index c7204ecd2..b5751e497 100644
--- a/tex/context/base/mkxl/typo-par.lmt
+++ b/tex/context/base/mkxl/typo-par.lmt
@@ -21,31 +21,44 @@ local appendaction = sequencers.appendaction
local enableaction = sequencers.enableaction
local disableaction = sequencers.disableaction
+local implement = interfaces.implement
+
local stack = { }
local top = nil
local enabled = false
-interfaces.implement {
+local trace = false trackers.register("paragraphs.tweaks",function(v) trace = v end)
+
+local report = logs.reporter("paragraphs","tweaks")
+
+implement {
name = "pushparagraphtweak",
public = true,
protected = true,
arguments = "string",
actions = function(t)
insert(stack,top)
- if not top then
+ if not enabled then
+ if trace then
+ report("enabling")
+ end
enableaction("paragraphcontext","builders.checkparcontext")
enabled = true
end
top = t
end
}
-interfaces.implement {
+
+implement {
name = "popparagraphtweak",
public = true,
protected = true,
actions = function()
top = remove(stack)
- if not top then
+ if enabled and not top then
+ if trace then
+ report("disabling")
+ end
disableaction("paragraphcontext","builders.checkparcontext")
enabled = false
end
@@ -61,12 +74,21 @@ function builders.checkparcontext(where)
while p > s do
p = p - s
end
+ if trace then
+ report("cycling %i",s)
+ end
shiftparshape(p,true)
+ return true
end
- return true
elseif top == "shift" then
- shiftparshape(texget("prevgraf"))
- return true
+ local s = texget("parshape",true)
+ if s then
+ if trace then
+ report("shifting %i", s)
+ end
+ shiftparshape(texget("prevgraf"))
+ return true
+ end
end
end
end
@@ -85,7 +107,7 @@ do
local scandimen = scanners.dimen
local scancardinal = scanners.cardinal
- interfaces.implement {
+ implement {
name = "setparagraphshape",
protected = true,
actions = function()
@@ -140,7 +162,7 @@ do
local NR = context.NR
local VL = context.VL
- interfaces.implement {
+ implement {
name = "showparagraphshape",
protected = true,
public = true,
diff --git a/tex/context/base/mkxl/typo-shp.lmt b/tex/context/base/mkxl/typo-shp.lmt
new file mode 100644
index 000000000..27cafe1bd
--- /dev/null
+++ b/tex/context/base/mkxl/typo-shp.lmt
@@ -0,0 +1,117 @@
+if not modules then modules = { } end modules ['meta-imp-txt'] = {
+ version = 1.001,
+ comment = "companion to meta-imp-txt.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files",
+}
+
+local setmetatableindex = table.setmetatableindex
+local settings_to_array = utilities.parsers.settings_to_array
+
+local texset = tex.set
+local texgetcount = tex.getcount
+
+local expandmacro = token.expand_macro
+
+local implement = interfaces.implement
+
+local scan = mp.scan
+local scannumeric = scan.numeric
+local scaninteger = scan.integer
+local scanboolean = scan.boolean
+local scanstring = scan.string
+
+local bpfactor = number.dimenfactors.bp
+
+local context = context
+
+local parshapes = { }
+local properties = { }
+
+metapost.registerscript("setparshapeproperty", function()
+ local k = scanstring()
+ if k == "line" then
+ local entry = properties.shape[scannumeric()]
+ local indent = scannumeric() / bpfactor
+ local width = scannumeric() / bpfactor
+ entry[1] = indent
+ entry[2] = width
+ elseif k == "lines" then
+ properties.lines = scaninteger()
+ properties.shape = setmetatableindex(function(t,k)
+ local v = { 0, properties.width or 0 }
+ t[k] = v
+ return v
+ end)
+ elseif k == "first" then
+ properties[k] = scanboolean()
+ elseif k == "inspect" then
+ inspect(properties)
+ else
+ properties[k] = scannumeric() / bpfactor
+ end
+end)
+
+implement {
+ name = "setparagraphmetashape",
+ public = true,
+ protected = true,
+ arguments = { "optional", "optional" }, -- array
+ actions = function(list,options)
+ if list and list ~= "" then
+ list = settings_to_array(list) -- array
+ options = settings_to_array(options) -- array
+ if #list > 0 then
+ parshapes = { }
+ properties = { }
+ for i=1,#list do
+ properties = { }
+ parshapes[i] = properties
+ expandmacro("spac_shapes_calculate","{"..list[i].."}")
+ end
+ local t, n = { }, 0
+ for i=1,#parshapes do
+ local p = parshapes[i]
+ local s = p.shape
+ if s then
+ for i=1,(p.lines or #s) do
+ n = n + 1
+ t[n] = s[i]
+ end
+ end
+ end
+ if n > 0 then
+ for i=1,#options do
+ t[options[i]] = true
+ end
+ texset("parshape",t)
+ end
+ end
+ end
+ end
+}
+
+-- implement {
+-- name = "resetparagraphmetashape",
+-- public = true,
+-- protected = true,
+-- actions = function(list)
+-- parshapes = { }
+-- properties = { }
+-- end
+-- }
+
+implement {
+ name = "getshapeparameter",
+ public = true,
+ arguments = "string",
+ actions = function(name)
+ local index = texgetcount("shapetextindex")
+ local value = parshapes[index][name]
+ if type(value) == "boolean" then
+ value = value and 1 or 0
+ end
+ context(value)
+ end
+}
diff --git a/tex/context/base/mkxl/typo-shp.mkxl b/tex/context/base/mkxl/typo-shp.mkxl
new file mode 100644
index 000000000..295fe3e1b
--- /dev/null
+++ b/tex/context/base/mkxl/typo-shp.mkxl
@@ -0,0 +1,125 @@
+%D \module
+%D [ file=typo-shp,
+%D version=2021.02.27, % was meta-txt / meta-imp-txt / 2000.07.06
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Paragraph Shapes,
+%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.
+
+%D I finally decided to move some of the code written in 2000 for the
+%D \METAFUN\ manual to its own core module. Of course it got adapted
+%D to the way \LMTX\ does things.
+
+\writestatus{loading}{ConTeXt Spacing Macros / Paragraph Shapes}
+
+\registerctxluafile{typo-shp}{autosuffix}
+
+\unprotect
+
+%D Something new (experimental and evolving):
+%D
+%D \starttyping
+%D \parshape
+%D 3
+%D options 1 % repeat
+%D 0cm 10cm 2cm 8cm 4cm 6cm
+%D lots of text
+%D \stoptyping
+%D
+%D \starttyping
+%D \parshape 4 5mm 125mm 0mm 120mm 5mm 125mm 0mm 120mm
+%D \pushparagraphtweak {repeat}
+%D verse line 1\crlf
+%D verse line 2\crlf
+%D verse line 3\crlf
+%D verse line 4\par
+%D etc
+%D \popparagraphtweak
+%D \stoptyping
+
+%D But we wrap this in a more abstract interface:
+
+\installcorenamespace {parshapes}
+
+\aliased\let\stopparagraphshape\relax
+
+\permanent\protected\def\startparagraphshape[#1]#2\stopparagraphshape
+ {\defcsname\??parshapes#1\endcsname{#2}}
+
+\permanent\protected\def\rawparagraphshape#1%
+ {\begincsname\??parshapes#1\endcsname}
+
+\permanent\protected\def\setparagraphshape[#1]%
+ {\ifcsname\??parshapes#1\endcsname
+ \expandafter\clf_setparagraphshape\lastnamedcs done\relax
+ \fi}
+
+\def\spac_shapes_calculate#1% called locally in \LUA
+ {\startMPcalculation \includeMPgraphic{#1} \stopMPcalculation}
+
+\permanent\protected\tolerant\def\startshapedparagraph[#1]% no grouping
+ {\begingroup
+ \getdummyparameters[\c!method=,\c!list=,\c!mp=,\c!repeat=,#1]%
+ \edef\p_mp {\dummyparameter\c!mp}%
+ \edef\p_repeat{\dummyparameter\c!repeat}%
+ \normalexpanded
+ {\endgroup
+ \ifempty\p_mp
+ \setparagraphshape[\dummyparameter\c!list]%
+ \else
+ \setparagraphmetashape[\dummyparameter\c!mp][\ifx\p_repeat\v!yes repeat\fi]%
+ \fi
+ \pushparagraphtweak{\dummyparameter\c!method}\relax}}
+
+\permanent\protected\def\stopshapedparagraph
+ {\popparagraphtweak}
+
+%D As it is not much code we now put it here:
+
+\newbox \shapetextbox
+\newcount\shapetextindex
+
+\permanent\protected\def\startshapetext[#1]%
+ {\begingroup
+ \global\shapetextindex\zerocount
+ \global\setbox\shapetextbox\vbox\bgroup
+ \setparagraphmetashape[#1]%
+ \forgetall
+ \dontcomplain
+ \setuptolerance[\v!verytolerant,\v!stretch]% default
+ % \setuplayout[\c!grid=\v!yes]% goes wrong, we need a local one
+ \pushparagraphtweak {shift}}
+
+\permanent\protected\def\stopshapetext
+ {\popparagraphtweak
+ \egroup
+ \endgroup}
+
+\permanent\protected\def\getshapetext
+ {\vbox\bgroup
+ \forgetall
+ \dontcomplain
+ \global\advance\shapetextindex\plusone
+ \scratchcounter\getshapeparameter{lines}\relax
+ \scratchwidth \getshapeparameter{width}\scaledpoint\relax
+ \scratchheight \getshapeparameter{height}\scaledpoint\relax
+ \setbox\scratchbox\vpack to \scratchheight
+ {\splittopskip\strutheight
+ \vskip\dimexpr\getshapeparameter{voffset}\scaledpoint\relax
+ \ifcase\numexpr\getshapeparameter{first}\relax\else
+ \vskip\lineheight
+ \fi
+ \hskip\dimexpr\getshapeparameter{hoffset}\scaledpoint\relax
+ \hpack{\vsplit\shapetextbox to \scratchcounter\lineheight}}%
+ \wd\scratchbox\scratchwidth
+ \ht\scratchbox\scratchheight
+ \dp\scratchbox\zeropoint
+ \box\scratchbox
+ \egroup}
+
+\protect
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 2880d77c0..c56b84c59 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-02-27 19:27
+-- merge date : 2021-03-01 15:33
do -- begin closure to overcome local limits and interference