summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2021-01-21 18:48:54 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2021-01-21 18:48:54 +0100
commitaea52f4b97d1be9ba194cd9a1d0ff1865c413691 (patch)
tree6b6fe6b48a7b8f161442e391ab03c34f2b4222b4
parente7016154c1f84ab4f9420c19d14af6a28f53bac8 (diff)
downloadcontext-aea52f4b97d1be9ba194cd9a1d0ff1865c413691.tar.gz
2021-01-21 18:04:00
-rw-r--r--metapost/context/base/mpxl/mp-lmtx.mpxl28
-rw-r--r--metapost/context/fonts/mpiv/demo-symbols.tex35
-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/font-one.lua1
-rw-r--r--tex/context/base/mkiv/font-otl.lua1
-rw-r--r--tex/context/base/mkiv/font-prv.lua33
-rw-r--r--tex/context/base/mkiv/font-tfm.lua1
-rw-r--r--tex/context/base/mkiv/meta-fnt.lua7
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26107 -> 26114 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin254911 -> 255046 bytes
-rw-r--r--tex/context/base/mkiv/strc-ref.lua7
-rw-r--r--tex/context/base/mkxl/buff-ver.mkxl22
-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-two.mkxl5
-rw-r--r--tex/context/base/mkxl/driv-shp.lmt28
-rw-r--r--tex/context/base/mkxl/file-res.mklx10
-rw-r--r--tex/context/base/mkxl/font-col.lmt35
-rw-r--r--tex/context/base/mkxl/font-con.lmt37
-rw-r--r--tex/context/base/mkxl/font-ctx.lmt18
-rw-r--r--tex/context/base/mkxl/font-def.lmt5
-rw-r--r--tex/context/base/mkxl/font-ini.mklx20
-rw-r--r--tex/context/base/mkxl/font-mpf.lmt174
-rw-r--r--tex/context/base/mkxl/font-ogr.lmt133
-rw-r--r--tex/context/base/mkxl/font-set.mklx1
-rw-r--r--tex/context/base/mkxl/lang-ini.mkxl12
-rw-r--r--tex/context/base/mkxl/lpdf-col.lmt3
-rw-r--r--tex/context/base/mkxl/lpdf-emb.lmt2
-rw-r--r--tex/context/base/mkxl/lpdf-lmt.lmt10
-rw-r--r--tex/context/base/mkxl/math-stc.mklx6
-rw-r--r--tex/context/base/mkxl/meta-fnt.lmt120
-rw-r--r--tex/context/base/mkxl/meta-fnt.mkxl1
-rw-r--r--tex/context/base/mkxl/meta-imp-demo.mkxl187
-rw-r--r--tex/context/base/mkxl/meta-ini.mkxl2
-rw-r--r--tex/context/base/mkxl/mult-aux.mkxl2
-rw-r--r--tex/context/base/mkxl/mult-ini.mkxl2
-rw-r--r--tex/context/base/mkxl/pack-lyr.mkxl22
-rw-r--r--tex/context/base/mkxl/pack-rul.mkxl2
-rw-r--r--tex/context/base/mkxl/page-bck.mkxl4
-rw-r--r--tex/context/base/mkxl/page-lay.mkxl10
-rw-r--r--tex/context/base/mkxl/page-one.mkxl4
-rw-r--r--tex/context/base/mkxl/page-txt.mklx6
-rw-r--r--tex/context/base/mkxl/publ-ini.mkxl4
-rw-r--r--tex/context/base/mkxl/spac-ali.mkxl30
-rw-r--r--tex/context/base/mkxl/spac-ver.mkxl4
-rw-r--r--tex/context/base/mkxl/strc-flt.mklx4
-rw-r--r--tex/context/base/mkxl/strc-itm.mklx58
-rw-r--r--tex/context/base/mkxl/strc-lst.mklx4
-rw-r--r--tex/context/base/mkxl/strc-pag.mkxl10
-rw-r--r--tex/context/base/mkxl/strc-ref.mklx2
-rw-r--r--tex/context/base/mkxl/strc-reg.mkxl6
-rw-r--r--tex/context/base/mkxl/strc-sec.mkxl4
-rw-r--r--tex/context/base/mkxl/syst-aux.mkxl10
-rw-r--r--tex/context/base/mkxl/syst-ini.mkxl5
-rw-r--r--tex/context/base/mkxl/tabl-ntb.mkxl4
-rw-r--r--tex/context/base/mkxl/tabl-tab.mkxl51
-rw-r--r--tex/context/base/mkxl/tabl-tbl.mkxl8
-rw-r--r--tex/context/base/mkxl/tabl-tsp.mkxl2
-rw-r--r--tex/context/base/mkxl/typo-mar.mkxl2
-rw-r--r--tex/context/base/mkxl/typo-scr.mkxl4
-rw-r--r--tex/context/base/mkxl/unic-ini.mkxl2
-rw-r--r--tex/context/modules/mkiv/s-system-macros.mkxl2
-rw-r--r--tex/context/sample/third/herbert-es.tex2
-rw-r--r--tex/context/sample/third/pope-es.tex6
-rw-r--r--tex/context/sample/third/shakespeare-es.tex4
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua4
69 files changed, 1014 insertions, 226 deletions
diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl
index 88a0450d6..ae00f43f1 100644
--- a/metapost/context/base/mpxl/mp-lmtx.mpxl
+++ b/metapost/context/base/mpxl/mp-lmtx.mpxl
@@ -2221,6 +2221,34 @@ def lmt_registerglyph = applyparameters "mpsglyph" "lmt_do_registerglyph" end
newscriptindex mfid_registerglyphs ; mfid_registerglyphs := scriptindex "registerglyphs" ; def lmt_do_registerglyphs = runscript mfid_registerglyphs enddef ;
newscriptindex mfid_registerglyph ; mfid_registerglyph := scriptindex "registerglyph" ; def lmt_do_registerglyph = runscript mfid_registerglyph enddef ;
+% An experimental macro:
+
+vardef composeglyph(suffix snippets) =
+ save llx, lly, urx, ury, u ;
+ u := getparameter "mpsfont" "unicode" ;
+ snippets[u] := image (
+ for i=1 upto getparametercount "mpsfont" "shapes" :
+ draw scantokens ( getparameter "mpsfont" "shapes" i "shape" )
+ withcolor getparameter "mpsfont" "shapes" i "color" ;
+ endfor ;
+ ) ;
+ llx := xpart llcorner snippets[u] ;
+ lly := ypart llcorner snippets[u] ;
+ urx := xpart urcorner snippets[u] ;
+ ury := ypart urcorner snippets[u] ;
+ lmt_registerglyph [
+ category = getparameter "mpsfont" "category",
+ unicode = u,
+ code = "draw " & str snippets & "[" & decimal u & "]",
+ height = ury,
+ depth = - lly,
+ width = urx - llx,
+ boundingbox = { llx, lly, urx, ury }
+ ] ;
+enddef ;
+
+permanent composeglyph ;
+
% Again an experiment (todo: the faster method):
newscriptindex mfid_remaptext ; mfid_remaptext := scriptindex "remaptext" ; def lmt_remaptext = runscript mfid_remaptext enddef ;
diff --git a/metapost/context/fonts/mpiv/demo-symbols.tex b/metapost/context/fonts/mpiv/demo-symbols.tex
index e9af4a027..b85803b24 100644
--- a/metapost/context/fonts/mpiv/demo-symbols.tex
+++ b/metapost/context/fonts/mpiv/demo-symbols.tex
@@ -1,21 +1,36 @@
+%\setupbodyfont[dejavu]
+
\starttext
- \definemetafont[demo-symbols][demo-symbols.mp]
+ \ifcase\contextlmtxmode
+
+ \definemetafont[demo-symbols][demo-symbols.mp]
+
+ \startbuffer
+ watch this: {\demo\char"261A} \quad \ruledhbox{\demo\char"261A}
+ \stopbuffer
+
+ \definefont[demo][demo@demo-symbols]
+
+ \getbuffer \blank
+
+ \definefont[demo][demo@demo-symbols at \the\dimexpr3\exheight]
- \startbuffer
- watch this: {\demo\char"261A} \quad \ruledhbox{\demo\char"261A}
- \stopbuffer
+ \getbuffer \blank
- \definefont[demo][demo@demo-symbols]
+ \definefont[demo][demo@demo-symbols at \the\dimexpr4\exheight]
- \getbuffer \blank
+ \getbuffer \blank
- \definefont[demo][demo@demo-symbols at \the\dimexpr3\exheight]
+ \else
- \getbuffer \blank
+ \showglyphs
- \definefont[demo][demo@demo-symbols at \the\dimexpr4\exheight]
+ \startTEXpage[offset=10pt]
+ \definemetafont[MyDemoA][demo-symbols][at 10pt]\MyDemoA\char9754
+ \definemetafont[MyDemoB][demo-symbols][at 30pt]\MyDemoB\char9754
+ \stopTEXpage
- \getbuffer \blank
+ \fi
\stoptext
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index ece22d7b0..cb5ab4de1 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.01.18 18:15}
+\newcontextversion{2021.01.21 18:01}
%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 0b84c302c..e0b21635f 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.01.18 18:15}
+\edef\contextversion{2021.01.21 18:01}
%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 6012a3fb2..957f20c84 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.01.18 18:15}
+\newcontextversion{2021.01.21 18:01}
%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 edb5c2de8..1333eb16f 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.01.18 18:15}
+\edef\contextversion{2021.01.21 18:01}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-one.lua b/tex/context/base/mkiv/font-one.lua
index 5ef6e4749..829f52ea0 100644
--- a/tex/context/base/mkiv/font-one.lua
+++ b/tex/context/base/mkiv/font-one.lua
@@ -727,6 +727,7 @@ local function read_from_afm(specification)
local tfmdata = afmtotfm(specification)
if tfmdata then
tfmdata.properties.name = specification.name
+ tfmdata.properties.id = specification.id
tfmdata = constructors.scale(tfmdata, specification)
local allfeatures = tfmdata.shared.features or specification.features.normal
constructors.applymanipulators("afm",tfmdata,allfeatures,trace_features,report_afm)
diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua
index 19de2bb77..8159db180 100644
--- a/tex/context/base/mkiv/font-otl.lua
+++ b/tex/context/base/mkiv/font-otl.lua
@@ -608,6 +608,7 @@ local function read_from_otf(specification)
-- this late ? .. needs checking
tfmdata.properties.name = specification.name
tfmdata.properties.sub = specification.sub
+ tfmdata.properties.id = specification.id
--
tfmdata = constructors.scale(tfmdata,specification)
local allfeatures = tfmdata.shared.features or specification.features.normal
diff --git a/tex/context/base/mkiv/font-prv.lua b/tex/context/base/mkiv/font-prv.lua
index c3323ca74..15057e255 100644
--- a/tex/context/base/mkiv/font-prv.lua
+++ b/tex/context/base/mkiv/font-prv.lua
@@ -80,3 +80,36 @@ end
function helpers.newprivateslot(name)
return sharedprivates[name]
end
+
+do
+
+ local context = context
+ local utfchar = utf.char
+
+ interfaces.implement {
+ name = "privatecharacter",
+ public = true,
+ -- protected = true,
+ arguments = "string",
+ actions = function(name)
+ local c = sharedprivates[name]
+ if c then
+ context(utfchar(c))
+ end
+ end
+ }
+
+ interfaces.implement {
+ name = "privatecharactercode",
+ public = true,
+ -- protected = true,
+ arguments = "string",
+ actions = function(name)
+ local c = sharedprivates[name]
+ if c then
+ context(c) -- serialized, not a number
+ end
+ end
+ }
+
+end
diff --git a/tex/context/base/mkiv/font-tfm.lua b/tex/context/base/mkiv/font-tfm.lua
index 4dbd5fc66..945421a42 100644
--- a/tex/context/base/mkiv/font-tfm.lua
+++ b/tex/context/base/mkiv/font-tfm.lua
@@ -163,6 +163,7 @@ local function read_from_tfm(specification)
shared.features = features
shared.resources = resources
--
+ properties.id = specification.id
properties.name = tfmdata.name -- todo: fallback
properties.fontname = tfmdata.fontname -- todo: fallback
properties.psname = tfmdata.psname -- todo: fallback
diff --git a/tex/context/base/mkiv/meta-fnt.lua b/tex/context/base/mkiv/meta-fnt.lua
index 92bbe0716..54c66ceb9 100644
--- a/tex/context/base/mkiv/meta-fnt.lua
+++ b/tex/context/base/mkiv/meta-fnt.lua
@@ -12,6 +12,7 @@ local format = string.format
local formatters = string.formatters
local chardata = characters.data
local fontdata = fonts.hashes.identifiers
+local round = math.round
local vffonts = fonts.handlers.vf
@@ -97,7 +98,7 @@ local function process(mpxformat,name,instances,scalefactor)
local fontname = file.removesuffix(file.basename(name))
local modification = attributes.modification
local filesize = attributes.size
- local hash = file.robustname(formatters["%s %05i %03i"](fontname,scalefactor*1000,instances))
+ local hash = file.robustname(formatters["%s %05i %03i"](fontname,round(scalefactor*1000),instances))
local lists = containers.read(mpfonts.cache,hash)
if not lists or lists.modification ~= modification or lists.filesize ~= filesize or lists.instances ~= instances or lists.scalefactor ~= scalefactor then
statistics.starttiming(flusher)
@@ -167,8 +168,8 @@ local function build(g,v)
local t = { }
for d=1,#data do
t = fonts.constructors.scale(data[d],-1000)
- -- local id = font.nextid()
- -- t.fonts = { { id = id } }
+ local id = font.nextid()
+ t.fonts = { { id = id } }
fontdata[id] = t
if v[5] then
vffonts.helpers.composecharacters(t)
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index ef1dbd7f2..d7e78e066 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 256f66ef8..27fb6a984 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/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua
index 4203e6aac..bca36ccef 100644
--- a/tex/context/base/mkiv/strc-ref.lua
+++ b/tex/context/base/mkiv/strc-ref.lua
@@ -2615,9 +2615,10 @@ implement {
-- }
implement {
- name = "askedreference",
- public = true,
- actions = function()
+ name = "askedreference",
+ public = true,
+ protected = true,
+ actions = function()
local actions = references.currentset
if actions then
context("[p=%s,r=%s]",actions.prefix or "",actions.reference)
diff --git a/tex/context/base/mkxl/buff-ver.mkxl b/tex/context/base/mkxl/buff-ver.mkxl
index b497c694a..7d193553c 100644
--- a/tex/context/base/mkxl/buff-ver.mkxl
+++ b/tex/context/base/mkxl/buff-ver.mkxl
@@ -404,14 +404,14 @@
%D decided not to use that slow and sometimes troublesome solution. Instead we stick
%D to some 'old' \CONTEXT\ macros for typesetting typical \TEX\ characters.
-\def\lesscharacter {<} % obsolete
-\def\morecharacter {>} % obsolete
+\immutable\def\lesscharacter {<} % obsolete
+\immutable\def\morecharacter {>} % obsolete
-\let\texescape \textbackslash
-\let\leftargument \textbraceleft
-\let\rightargument \textbraceright
-\let\inlinemathmarker \textdollar
-\def\displaymathmarker{\textdollar\textdollar}
+\immutable\let\texescape \textbackslash
+\immutable\let\leftargument \textbraceleft
+\immutable\let\rightargument \textbraceright
+\immutable\let\inlinemathmarker \textdollar
+\immutable\def\displaymathmarker{\textdollar\textdollar}
\def\buff_verbatim_special_type#1#2#% # gobbles spaces
{\dontleavehmode\bgroup
@@ -429,10 +429,10 @@
\protected\def\mat{\buff_verbatim_special_type\inlinemathmarker \inlinemathmarker}
\protected\def\dis{\buff_verbatim_special_type\displaymathmarker\displaymathmarker}
-\let\normaltexttex\tex
-\let\normaltextarg\arg
-\let\normaltextmat\mat
-\let\normaltextdis\dis
+\aliased\let\normaltexttex\tex
+\aliased\let\normaltextarg\arg
+\aliased\let\normaltextmat\mat
+\aliased\let\normaltextdis\dis
\permanent\protected\def\astype
{\dontleavehmode
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 715937da0..fd44f4c82 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.01.18 18:15}
+\newcontextversion{2021.01.21 18:01}
%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 0cc4a77ea..123558d39 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.01.18 18:15}
+\immutable\edef\contextversion{2021.01.21 18:01}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/core-two.mkxl b/tex/context/base/mkxl/core-two.mkxl
index af48dc7c3..322765a39 100644
--- a/tex/context/base/mkxl/core-two.mkxl
+++ b/tex/context/base/mkxl/core-two.mkxl
@@ -81,8 +81,9 @@
% temp hack: needs a proper \starteverytimeluacode
\setfalse\twopassdatafound
-\let \twopassdata \empty
-\let \twopassdatalist \empty
+
+\mutable\let\twopassdata \empty
+\mutable\let\twopassdatalist\empty
\def\syst_twopass_check % can be delegated to lua once obsolete is gone
{\ifempty\twopassdata
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index cfa61e30e..7f305877d 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -284,8 +284,11 @@ local flush_character do
pos_v = pos_v + v * sy
end
elseif command == "offset" then
+ local ph = pos_h
+ local pv = pos_v
local h = packet[2] or 0
local v = packet[3] or 0
+ local c = packet[4]
if h ~= 0 then
if factor ~= 0 then
h = h + h * factor / 1000 -- expansion
@@ -295,6 +298,31 @@ local flush_character do
if v and v ~= 0 then
pos_v = pos_v + v * sy
end
+ if c then
+ flushchar(font,char,fnt,c)
+ pos_h = ph
+ pos_v = pv
+ end
+ elseif command == "compose" then
+ local ph = pos_h
+ local pv = pos_v
+ local h = packet[2] or 0
+ local v = packet[3] or 0
+ local c = packet[4]
+ if h ~= 0 then
+ if factor ~= 0 then
+ h = h + h * factor / 1000 -- expansion
+ end
+ pos_h = pos_h + h * sx
+ end
+ if v and v ~= 0 then
+ pos_v = pos_v + v * sy
+ end
+ if c then
+ flushchar(font,char,fnt,c)
+ pos_h = ph
+ pos_v = pv
+ end
elseif command == "push" then
level = level + 1
local s = stack[level]
diff --git a/tex/context/base/mkxl/file-res.mklx b/tex/context/base/mkxl/file-res.mklx
index a523302d1..a796f3e97 100644
--- a/tex/context/base/mkxl/file-res.mklx
+++ b/tex/context/base/mkxl/file-res.mklx
@@ -124,11 +124,11 @@
\readfile{#name}{#true}{#false}%
\popcatcodetable}
-\permanent\protected\def\readxmlfile#name#true#false%
- {\pushcatcodetable
- \catcodetable\xmlcatcodes
- \readfile{#name}{#true}{#false}%
- \popcatcodetable}
+% \permanent\protected\def\readxmlfile#name#true#false%
+% {\pushcatcodetable
+% \catcodetable\xmlcatcodes
+% \readfile{#name}{#true}{#false}%
+% \popcatcodetable}
%D \macros
%D {doiflocfileelse,locfilename}
diff --git a/tex/context/base/mkxl/font-col.lmt b/tex/context/base/mkxl/font-col.lmt
index 21c731946..05de35903 100644
--- a/tex/context/base/mkxl/font-col.lmt
+++ b/tex/context/base/mkxl/font-col.lmt
@@ -399,15 +399,27 @@ local function monoslot(font,char,parent,factor)
end
end
+function collections.register(font,char,handler)
+ if font and char and type(handler) == "function" then
+ local vector = vectors[font]
+ if not vector then
+ vector = { }
+ vectors[font] = vector
+ end
+ vector[char] = handler
+ end
+end
+
+-- todo: also general one for missing
+
function collections.process(head) -- this way we keep feature processing
for n, char, font in nextchar, head do
local vector = validvectors[font]
if vector then
local vect = vector[char]
- if not vect then
- -- keep it
- else
- if type(vect) == "table" then
+ if vect then
+ local kind = type(vect)
+ if kind == "table" then
local newfont = vect[1]
local newchar = vect[2]
if trace_collecting then
@@ -416,6 +428,21 @@ function collections.process(head) -- this way we keep feature processing
)
end
setfont(n,newfont,newchar)
+ elseif kind == "function" then
+ local newfont, newchar = vect(font,char,vector)
+ if not newfont then
+ newfont = font
+ end
+ if not newchar then
+ newchar = char
+ end
+ if trace_collecting then
+ report_fonts("remapping character %C in font %a to character %C in font %a%s",
+ char,font,newchar,newfont,not chardata[newfont][newchar] and " (missing)" or ""
+ )
+ end
+ setfont(n,newfont,newchar)
+ vector[char] = { newfont, newchar }
else
local fakemono = vector.factor
if trace_collecting then
diff --git a/tex/context/base/mkxl/font-con.lmt b/tex/context/base/mkxl/font-con.lmt
index 60e3f0233..d737d28ce 100644
--- a/tex/context/base/mkxl/font-con.lmt
+++ b/tex/context/base/mkxl/font-con.lmt
@@ -1156,6 +1156,7 @@ do
initializers = { base = { }, node = { }, plug = { } },
processors = { base = { }, node = { }, plug = { } },
manipulators = { base = { }, node = { }, plug = { } },
+ finalizers = { base = { }, node = { }, plug = { } },
}
features.register = function(specification) return register(features,specification) end
handler.features = features -- will also become hidden
@@ -1454,23 +1455,23 @@ end
-- after scaling
-function constructors.applymanipulators(what,tfmdata,features,trace,report)
+local function apply(key,what,tfmdata,features,trace,report)
if features and next(features) then
- local properties = tfmdata.properties
- local whathandler = handlers[what]
- local whatfeatures = whathandler.features
- local whatmanipulators = whatfeatures.manipulators
- local mode = properties.mode
- local manipulators = whatmanipulators[mode]
- if manipulators then
- for i=1,#manipulators do
- local step = manipulators[i]
+ local properties = tfmdata.properties
+ local whathandler = handlers[what]
+ local whatfeatures = whathandler.features
+ local whatactions = whatfeatures[key]
+ local mode = properties.mode
+ local actions = whatactions[mode]
+ if actions then
+ for i=1,#actions do
+ local step = actions[i]
local feature = step.name
- local value = features[feature]
+ local value = features[feature]
if value then
local action = step.action
if trace then
- report("applying feature manipulator %a for mode %a for font %a",feature,mode,properties.fullname)
+ report("applying feature %s %a for mode %a for font %a",key,feature,mode,properties.fullname)
end
if action then
action(tfmdata,feature,value)
@@ -1481,6 +1482,18 @@ function constructors.applymanipulators(what,tfmdata,features,trace,report)
end
end
+function constructors.applymanipulators(what,tfmdata,features,trace,report)
+ if features and next(features) then
+ apply("manipulators",what,tfmdata,features,trace,report)
+ end
+end
+
+function constructors.applyfinalizers(what,tfmdata,features,trace,report)
+ if features and next(features) then
+ apply("finalizers",what,tfmdata,features,trace,report)
+ end
+end
+
function constructors.addcoreunicodes(unicodes) -- maybe make this a metatable if used at all
if not unicodes then
unicodes = { }
diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt
index b307f8f5d..d60333766 100644
--- a/tex/context/base/mkxl/font-ctx.lmt
+++ b/tex/context/base/mkxl/font-ctx.lmt
@@ -1227,9 +1227,9 @@ do -- else too many locals
name = o_name
sub = o_sub
end
-if texconditionals["c_font_compact"] then
- size = 655360
-end
+ if texconditionals["c_font_compact"] then
+ size = 655360
+ end
-- so far
-- some settings can have been overloaded
if lookup and lookup ~= "" then
@@ -1364,10 +1364,10 @@ end
context(function()
busy = false
mathematics.finishfallbacks(tfmdata,specification,fallbacks)
-tfmdata.original = specification.specification
- local id = definefont(tfmdata)
+ tfmdata.original = specification.specification
+ local id = definefont(tfmdata,properties.id)
csnames[id] = specification.cs
- properties.id = id
+ properties.id = id -- already set
definers.register(tfmdata,id) -- to be sure, normally already done
texdefinefont(global,cs,id)
constructors.finalize(tfmdata)
@@ -1401,10 +1401,10 @@ tfmdata.original = specification.specification
end)
return
else
-tfmdata.original = specification.specification
- local id = definefont(tfmdata)
+ tfmdata.original = specification.specification
+ local id = definefont(tfmdata,properties.id)
csnames[id] = specification.cs
- properties.id = id
+ properties.id = id -- already set
definers.register(tfmdata,id) -- to be sure, normally already done
texdefinefont(global,cs,id)
constructors.finalize(tfmdata)
diff --git a/tex/context/base/mkxl/font-def.lmt b/tex/context/base/mkxl/font-def.lmt
index 01513f1e6..614f98036 100644
--- a/tex/context/base/mkxl/font-def.lmt
+++ b/tex/context/base/mkxl/font-def.lmt
@@ -29,6 +29,8 @@ local report_defining = logs.reporter("fonts","defining")
default loader that only handles <l n='tfm'/>.</p>
--ldx]]--
+local nextfont = font.nextid
+
local fonts = fonts
local fontdata = fonts.hashes.identifiers
local readers = fonts.readers
@@ -368,6 +370,8 @@ function definers.loadfont(specification)
if not tfmdata then
-- normally context will not end up here often (if so there is an issue somewhere)
local forced = specification.forced or ""
+local id = nextfont(true)
+specification.id = id
if forced ~= "" then
local reader = readers[lower(forced)] -- normally forced is already lowered
tfmdata = reader and reader(specification)
@@ -477,7 +481,6 @@ function definers.read(specification,size,id) -- id can be optional, name can al
end
else
tfmdata = definers.loadfont(specification) -- can be overloaded
--- put in properties instead
if tfmdata then
tfmdata.original = specification.specification
if trace_defining then
diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx
index 0a158e69d..c52fb7f4b 100644
--- a/tex/context/base/mkxl/font-ini.mklx
+++ b/tex/context/base/mkxl/font-ini.mklx
@@ -2267,11 +2267,11 @@
%D math families and finally we activate the default typeface and also set the font
%D specific parameters assigned to \type {\everybodyfont}.
-\permanent\def\textface {\currentbodyfontdimension\s!text }
-\permanent\def\scriptface {\currentbodyfontdimension\s!script }
-\permanent\def\scriptscriptface{\currentbodyfontdimension\s!scriptscript}
-\permanent\def\xtextface {\currentbodyfontdimension\s!x }
-\permanent\def\xxtextface {\currentbodyfontdimension\s!xx }
+\permanent\protected\def\textface {\currentbodyfontdimension\s!text }
+\permanent\protected\def\scriptface {\currentbodyfontdimension\s!script }
+\permanent\protected\def\scriptscriptface{\currentbodyfontdimension\s!scriptscript}
+\permanent\protected\def\xtextface {\currentbodyfontdimension\s!x }
+\permanent\protected\def\xxtextface {\currentbodyfontdimension\s!xx }
\installcorenamespace{fontbodyfaces}
@@ -2286,11 +2286,11 @@
\def\font_basics_set_faces_preset
{\edef\font_basics_set_faces{% 0.2 sec on 10K \tfa
- \enforced\noexpand\edef\noexpand\textface {\currentbodyfontdimension\s!text }%
- \enforced\noexpand\edef\noexpand\scriptface {\currentbodyfontdimension\s!script }%
- \enforced\noexpand\edef\noexpand\scriptscriptface{\currentbodyfontdimension\s!scriptscript}%
- \enforced\noexpand\edef\noexpand\xtextface {\currentbodyfontdimension\s!x }%
- \enforced\noexpand\edef\noexpand\xxtextface {\currentbodyfontdimension\s!xx }%
+ \enforced\permanent\protected\def\textface {\currentbodyfontdimension\s!text }%
+ \enforced\permanent\protected\def\scriptface {\currentbodyfontdimension\s!script }%
+ \enforced\permanent\protected\def\scriptscriptface{\currentbodyfontdimension\s!scriptscript}%
+ \enforced\permanent\protected\def\xtextface {\currentbodyfontdimension\s!x }%
+ \enforced\permanent\protected\def\xxtextface {\currentbodyfontdimension\s!xx }%
}%
\gletcsname\??fontbodyfaces\fontbody\endcsname\font_basics_set_faces}
diff --git a/tex/context/base/mkxl/font-mpf.lmt b/tex/context/base/mkxl/font-mpf.lmt
new file mode 100644
index 000000000..5934c1037
--- /dev/null
+++ b/tex/context/base/mkxl/font-mpf.lmt
@@ -0,0 +1,174 @@
+if not modules then modules = { } end modules ['font-ogr'] = {
+ version = 1.001,
+ comment = "companion to font-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local tonumber, unpack, type = tonumber, unpack, type
+
+local context = context
+local metapost = metapost
+
+local metafonts = { }
+metapost.metafonts = metafonts
+
+local fastserialize = table.fastserialize
+local sortedhash = table.sortedhash
+local settings_to_hash = utilities.parsers.settings_to_hash
+local settings_to_array = utilities.parsers.settings_to_array
+
+local addcharacters = fonts.constructors.addcharacters
+local fontdata = fonts.hashes.identifiers
+
+local otf = fonts.handlers.otf
+local otfregister = otf.features.register
+
+local getshapes = fonts.dropins.getshapes
+
+local setparameterset = metapost.setparameterset
+local simplemetapost = metapost.simple
+
+local register = fonts.collections.register
+local checkenabled = fonts.collections.checkenabled
+local newprivateslot = fonts.helpers.newprivateslot
+
+local currentfont = font.current
+
+local function setmetaglyphs(category,fontid,unicode,specification)
+ local tfmdata = fontdata[fontid]
+ if unicode then
+ local characters = tfmdata.characters
+ specification.unicode = unicode
+ specification.category = category
+ -- Generate one shape, make a use we pass the unicode as that is
+ -- the index in a picture list (normally). We could actually already
+ -- fetch the stream but for now we do that later (i.e. we delay the
+ -- serialization to pdf).
+ local code = specification.code
+ if code then
+ setparameterset("mpsfont",specification)
+ -- simplemetapost(instance,"begingroup;",true,true)
+ simplemetapost("simplefun",code)
+ -- simplemetapost(instance,"endgroup;",true,true)
+ end
+ -- We now know (hopefully) the dimensions of the image which is what
+ -- we need to pass to the engine in order to let it do its work.
+ local shapes = getshapes(category)
+ local units = shapes.parameters.units
+ local scale = tfmdata.parameters.size / units
+ local shape = shapes.glyphs[unicode]
+ --
+ local llx, lly, urx, ury = unpack(shape.boundingbox)
+ llx = llx * scale
+ urx = urx * scale
+ lly = lly * scale
+ ury = ury * scale
+ --
+ local newdata = { }
+ characters[unicode] = newdata -- so that we can register commands
+ fonts.dropins.swapone("mps",tfmdata,shape,unicode)
+ --
+ local olddata = characters[unicode]
+ newdata.width = urx - llx
+ newdata.height = ury
+ newdata.depth = -lly
+ newdata.unicode = unicode
+ -- commands = { { "offset", -llx, 0, newdata.commands[1][1], newdata.commands[1][2] } }
+ newdata.commands = { { "offset", -llx, 0 }, newdata.commands[1] }
+ -- pass dimensions to lua
+ characters[unicode] = newdata
+ -- pass dimensions to tex
+ addcharacters(fontid, { characters = { [unicode] = newdata } })
+ return fontid, unicode
+ end
+end
+
+local function setmetaglyph(specification)
+ if specification then
+ local category = specification.category
+ local name = specification.name
+ if category and name then
+ local fontid = currentfont()
+ local private = newprivateslot(name)
+ register(fontid,private,function(font,char)
+ return setmetaglyphs(category,font,char,specification) end
+ )
+ checkenabled()
+ end
+ end
+end
+
+local function initializempf(tfmdata,kind,value)
+ local metafont = metafonts[value]
+ if value then
+ local font = tfmdata.properties.id
+ for char, spec in sortedhash(metafont) do
+ if type(char) == "string" then
+ char = newprivateslot(char)
+ end
+ register(font,char,function(font,char)
+ return setmetaglyphs(value,font,char,spec)
+ end)
+ end
+ checkenabled()
+ end
+end
+
+fonts.helpers.setmetaglyphs = setmetaglyphs
+fonts.helpers.setmetaglyph = setmetaglyph
+
+otfregister {
+ name = "metafont",
+ description = "metafont glyphs",
+ manipulators = {
+ base = initializempf,
+ node = initializempf,
+ }
+}
+
+do
+
+ local scanners = tokens.scanners
+ local scanopen = scanners.scanopen
+ local scanclose = scanners.scanclose
+ local scanword = scanners.word
+ local scanstring = scanners.string
+
+ interfaces.implement {
+ name = "setmetaglyph",
+ public = true,
+ protected = true,
+ actions = function(t)
+ local t = { }
+ if scanopen() then
+ while not scanclose() do
+ local key = scanword()
+ if key == "shapes" then
+ if scanopen() then
+ local tt = { }
+ local nn = 0
+ while not scanclose() do
+ if scanopen() then
+ local ttt = { }
+ while not scanclose() do
+ local key = scanword()
+ ttt[key] = scanstring()
+ end
+ nn= nn + 1
+ tt[nn] = ttt
+ end
+ end
+ t[key] = tt
+ end
+ else
+ t[key] = scanstring()
+ end
+ end
+ end
+ setmetaglyph(t)
+ end
+ }
+
+end
diff --git a/tex/context/base/mkxl/font-ogr.lmt b/tex/context/base/mkxl/font-ogr.lmt
index a3f8acb3c..1f37ec901 100644
--- a/tex/context/base/mkxl/font-ogr.lmt
+++ b/tex/context/base/mkxl/font-ogr.lmt
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['font-ogr'] = {
-- Here we deal with graphic variants and for now also color support ends up here
-- but that might change. It's lmtx only code.
-local tostring, tonumber, next, type = tostring, tonumber, next, type
+local tostring, tonumber, next, type, rawget = tostring, tonumber, next, type, rawget
local round, max, mod, div = math.round, math.max, math.mod, math.div
local find = string.find
local concat, setmetatableindex, sortedhash = table.concat, table.setmetatableindex, table.sortedhash
@@ -121,13 +121,57 @@ do
end
end
- function dropins.swap(method,tfmdata,shapes,...) -- by unicode
+-- function dropins.swap(method,tfmdata,shapes,...) -- by unicode
+-- if method and shapes then
+-- local characters = tfmdata.characters
+-- local descriptions = tfmdata.descriptions
+-- local droppedin, tfmdrop, dropchars, dropdescs, colrshapes
+-- local idx = 255
+-- local slot = 0
+-- -- we can have a variant where shaped are by unicode and not by index
+-- for k, v in next, characters do
+-- local description = descriptions[k]
+-- if description then
+-- local shape = shapes[k]
+-- if shape then
+-- if idx >= 255 then
+-- idx = 1
+-- colrshapes = setmetatableindex({ },shapes)
+-- slot, droppedin, tfmdrop = dropins.provide(method,tfmdata,colrshapes)
+-- dropchars = tfmdrop.characters
+-- dropdescs = tfmdrop.descriptions
+-- else
+-- idx = idx + 1
+-- end
+-- colrshapes[idx] = shape -- so not: description
+-- -- todo: prepend
+-- v.commands = { { "slot", slot, idx } }
+-- -- hack to prevent that type 3 also gets 'use' flags .. todo
+-- local c = { commands = false, index = idx, dropin = tfmdrop }
+-- local d = { } -- index = idx, dropin = tfmdrop }
+-- setmetatableindex(c,v)
+-- setmetatableindex(d,description)
+-- dropchars[idx] = c
+-- dropdescs[idx] = d -- not needed
+-- end
+-- end
+-- end
+-- else
+-- -- error
+-- end
+-- end
+
+ function dropins.swap(method,tfmdata,shapes) -- by unicode
if method and shapes then
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
- local droppedin, tfmdrop, dropchars, dropdescs, colrshapes
- local idx = 255
- local slot = 0
+ local droppedin = tfmdata.droppedin
+ local tfmdrop = tfmdata.tfmdrop
+ local dropchars = tfmdata.dropchars
+ local dropdescs = tfmdata.dropdescs
+ local colrshapes = tfmdata.colrshapes
+ local idx = tfmdata.dropindex or 255
+ local slot = tfmdata.dropslot or 0
-- we can have a variant where shaped are by unicode and not by index
for k, v in next, characters do
local description = descriptions[k]
@@ -156,11 +200,63 @@ do
end
end
end
+ tfmdata.droppedin = droppedin
+ tfmdata.tfmdrop = tfmdrop
+ tfmdata.dropchars = dropchars
+ tfmdata.dropdescs = dropdescs
+ tfmdata.colrshapes = colrshapes
+ tfmdata.dropindex = idx
+ tfmdata.dropslot = slot
else
-- error
end
end
+ function dropins.swapone(method,tfmdata,shape,unicode)
+ if method and shape then
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ local droppedin = tfmdata.droppedin
+ local tfmdrop = tfmdata.tfmdrop
+ local dropchars = tfmdata.dropchars
+-- local dropdescs = tfmdata.dropdescs
+ local colrshapes = tfmdata.colrshapes
+ local idx = tfmdata.dropindex or 255
+ local slot = tfmdata.dropslot or 0
+ local character = characters[unicode]
+-- local description = descriptions[unicode] or { }
+ if character then
+ if idx >= 255 then
+ idx = 1
+ colrshapes = setmetatableindex({ },shapes)
+ slot, droppedin, tfmdrop = dropins.provide(method,tfmdata,colrshapes)
+ dropchars = tfmdrop.characters
+ dropdescs = tfmdrop.descriptions
+ else
+ idx = idx + 1
+ end
+ colrshapes[idx] = shape.code -- so not: description
+ -- todo: prepend
+ character.commands = { { "slot", slot, idx } }
+ -- hack to prevent that type 3 also gets 'use' flags .. todo
+ local c = { commands = false, index = idx, dropin = tfmdrop }
+-- local d = { } -- index = idx, dropin = tfmdrop }
+ setmetatableindex(c,character)
+-- setmetatableindex(d,description)
+ dropchars[idx] = c
+-- dropdescs[idx] = d -- not needed
+ end
+ tfmdata.droppedin = droppedin
+ tfmdata.tfmdrop = tfmdrop
+ tfmdata.dropchars = dropchars
+-- tfmdata.dropdescs = dropdescs
+ tfmdata.colrshapes = colrshapes
+ tfmdata.dropindex = idx
+ tfmdata.dropslot = slot
+ return
+ end
+ end
+
end
do -- this will move to its own module
@@ -171,13 +267,22 @@ do -- this will move to its own module
local v = {
glyphs = { },
parameters = {
- units = 1000
+ units = 10
},
}
t[k] = v
return v
end)
+ function dropins.getshape(name,n)
+ local s = shapes[name]
+ return s and s.glyphs and s.glyphs[n]
+ end
+
+ function dropins.getshapes(name)
+ return shapes[name]
+ end
+
function dropins.registerglyphs(parameters)
local category = parameters.name
local target = shapes[category].parameters
@@ -308,16 +413,22 @@ do -- this will move to its own module
local wd = shape.width or defaultwidth
local ht = shape.height or defaultheight
local dp = shape.depth or defaultdepth
+ local bb = shape.boundingbox
local uc = shape.tounicode
if uc then
uc = round(uc) -- brrr can be 123.0
end
+ if bb then
+ for i=1,4 do bb[i] = scale * bb[i] end
+ end
local newc = {
- index = index, -- into usedshapes
- width = scale * (wd + spread),
- height = scale * ht,
- depth = scale * dp,
- unicode = uc or unicode,
+ index = index, -- into usedshapes -- used?
+ width = scale * (wd + spread),
+ height = scale * ht,
+ depth = scale * dp,
+ boundingbox = bb,
+ unicode = uc or unicode,
+ -- shape = shape, -- maybe a copy
}
--
characters [unicode] = newc
diff --git a/tex/context/base/mkxl/font-set.mklx b/tex/context/base/mkxl/font-set.mklx
index 44d4cff15..fd6a2f1ff 100644
--- a/tex/context/base/mkxl/font-set.mklx
+++ b/tex/context/base/mkxl/font-set.mklx
@@ -75,7 +75,6 @@
\glet\font_preloads_first_stage \relax
\glet\font_preloads_second_stage \relax
%\glet\font_preloads_third_stage \relax
- \glet\fourthstagepreloadfonts \relax
\global\everyhbox\emptytoks
\global\everyvbox\emptytoks
% old: \font_preloads_reset_nullfont, new:
diff --git a/tex/context/base/mkxl/lang-ini.mkxl b/tex/context/base/mkxl/lang-ini.mkxl
index 2644d1d76..c95f57fda 100644
--- a/tex/context/base/mkxl/lang-ini.mkxl
+++ b/tex/context/base/mkxl/lang-ini.mkxl
@@ -138,16 +138,16 @@
{\setcurrentlanguage\currentmainlanguage{#1}}
\permanent\protected\def\setcurrentlanguage#1#2% sets modes: **id (currentmain) *id (current)
- {\edef\xaskedlanguage{#1}% otherwise clash with \askedlanguage
- \ifempty\xaskedlanguage \else
+ {\edef\p_askedlanguage{#1}% otherwise clash with \askedlanguage
+ \ifempty\p_askedlanguage \else
\ifempty\currentmainlanguage\else\resetsystemmode{\systemmodeprefix\currentmainlanguage}\fi
- \let\currentmainlanguage\xaskedlanguage
+ \let\currentmainlanguage\p_askedlanguage
\setsystemmode{\systemmodeprefix\currentmainlanguage}%
\fi
- \edef\xaskedlanguage{#2}%
- \ifempty\xaskedlanguage \else
+ \edef\p_askedlanguage{#2}%
+ \ifempty\p_askedlanguage \else
\ifempty\currentlanguage\else\resetsystemmode\currentlanguage\fi
- \let\currentlanguage\xaskedlanguage
+ \let\currentlanguage\p_askedlanguage
\setsystemmode\currentlanguage
\fi}
diff --git a/tex/context/base/mkxl/lpdf-col.lmt b/tex/context/base/mkxl/lpdf-col.lmt
index a999cb2c7..ea60e0551 100644
--- a/tex/context/base/mkxl/lpdf-col.lmt
+++ b/tex/context/base/mkxl/lpdf-col.lmt
@@ -785,7 +785,8 @@ do
end
vfinjectors.stopcolor = function()
- pdfprint("text", "Q")
+ -- pdfprint("text", "Q")
+ pdfprint("page", "Q")
end
end)
diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt
index 53bbfe5da..796b9dfd1 100644
--- a/tex/context/base/mkxl/lpdf-emb.lmt
+++ b/tex/context/base/mkxl/lpdf-emb.lmt
@@ -1642,7 +1642,7 @@ do
if decompress then
mp = decompress(mp)
end
- local pdf = simplemprun(instance,mp,true) -- can be sped up, minifun
+ local pdf = simplemprun(instance,mp,true)
local width = width * factor
if usecolor then
return f_stream_c(width,pdf), width
diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt
index b57557aee..a0c730b71 100644
--- a/tex/context/base/mkxl/lpdf-lmt.lmt
+++ b/tex/context/base/mkxl/lpdf-lmt.lmt
@@ -899,7 +899,9 @@ do
flushers.startclipping = function(current,pos_h,pos_v)
flushsave(current,pos_h,pos_v)
- flushliteral("origin",formatters["0 w %s W n"](properties[current].path))
+ -- lpdf.print("origin",formatters["0 w %s W n"](nodeproperties[current].path))
+ pdf_goto_pagemode()
+ b = b + 1 ; buffer[b] = formatters["0 w %s W n"](nodeproperties[current].path)
end
flushers.stopclipping = function(current,pos_h,pos_v)
@@ -2368,7 +2370,7 @@ local openfile, closefile do
local f_link = formatters["%010i 00000 f\013\010"]
local f_first = formatters["%010i 65535 f\013\010"]
- local f_pdf = formatters["%%PDF-%i.%i\010"]
+ local f_pdf_tag = formatters["%%PDF-%i.%i\010"]
local f_xref = formatters["xref\0100 %i\010"]
local f_trailer_id = formatters["trailer\010<< %s /ID [ <%s> <%s> ] >>\010startxref\010%i\010%%%%EOF"]
local f_trailer_no = formatters["trailer\010<< %s >>\010startxref\010%i\010%%%%EOF"]
@@ -2422,7 +2424,7 @@ local openfile, closefile do
f:write(s)
end
end
- local v = f_pdf(majorversion,minorversion)
+ local v = f_pdf_tag(majorversion,minorversion)
-- local b = "%\xCC\xD5\xC1\xD4\xC5\xD8\xD0\xC4\xC6\010" -- LUATEXPDF (+128)
local b = "%\xC3\xCF\xCE\xD4\xC5\xD8\xD4\xD0\xC4\xC6\010" -- CONTEXTPDF (+128)
flush(f,v)
@@ -2631,7 +2633,7 @@ local openfile, closefile do
flush(f,f_trailer_no(trailer(),xrefoffset))
end
end
- update(f,f_pdf(majorversion,minorversion))
+ update(f,f_pdf_tag(majorversion,minorversion))
close(f)
end
io.flush()
diff --git a/tex/context/base/mkxl/math-stc.mklx b/tex/context/base/mkxl/math-stc.mklx
index 1f9047394..e7541f61c 100644
--- a/tex/context/base/mkxl/math-stc.mklx
+++ b/tex/context/base/mkxl/math-stc.mklx
@@ -895,11 +895,11 @@
\permanent\tolerant\protected\def\mathovertext[#category]%
{\begingroup
- \math_stackers_direct_double_text\plusone {\ifargument#category\or#category\else\v!top\fi}}
+ \math_stackers_direct_double_text\plusone {\ifarguments#category\or#category\else\v!top\fi}}
\permanent\tolerant\protected\def\mathundertext[#category]%
{\begingroup
- \math_stackers_direct_double_text\zerocount{\ifargument#category\or#category\else\v!bottom\fi}}
+ \math_stackers_direct_double_text\zerocount{\ifarguments#category\or#category\else\v!bottom\fi}}
\def\math_stackers_direct_double_text#where#category#codepoint#text#extra%%
{\math_stackers_make_double_text#where{#category}{#codepoint}{#text}{#extra}%
@@ -910,7 +910,7 @@
\permanent\tolerant\protected\def\mathtriplet[#category]#:#middletext#toptext#bottomtext%
{\begingroup
- \math_stackers_triplet\plusone{\ifargument#category\or#category\else\currentmathstackers\fi}{#middletext}{#toptext}{#bottomtext}%
+ \math_stackers_triplet\plusone{\ifarguments#category\or#category\else\currentmathstackers\fi}{#middletext}{#toptext}{#bottomtext}%
\endgroup}
\permanent\tolerant\protected\def\definemathtriplet[#1]#*[#2]#*[#3]% category name default
diff --git a/tex/context/base/mkxl/meta-fnt.lmt b/tex/context/base/mkxl/meta-fnt.lmt
index a0feb0b52..91acd9c02 100644
--- a/tex/context/base/mkxl/meta-fnt.lmt
+++ b/tex/context/base/mkxl/meta-fnt.lmt
@@ -28,3 +28,123 @@ end
-- fontname = "bidi",
-- filename = "bidi-symbols.mp",
-- }
+
+-- okay, let's for the moment put this here:
+
+local tonumber = tonumber
+local find = string.find
+
+local context = context
+
+local fastserialize = table.fastserialize
+local settings_to_hash = utilities.parsers.settings_to_hash
+local settings_to_array = utilities.parsers.settings_to_array
+
+local addcharacters = fonts.constructors.addcharacters
+local fontdata = fonts.hashes.identifiers
+
+-- This is a prelude to a more advance mechanism: when we are in mp we can construct the
+-- whole composed character there.
+
+function fonts.helpers.combineglyphs(fnt, specification)
+ local hash = fastserialize(specification)
+ local fontid = fnt or font.current()
+ local tfmdata = fontdata[fontid]
+ local combhash = tfmdata.combhash or { }
+ local unicode = combhash[hash]
+ if not unicode then
+ local t = { }
+ local h = 0
+ local d = 0
+ local w = 0
+ local o = 0
+ local characters = tfmdata.characters
+ for i=1,#specification do
+ local s = specification[i]
+ local l = find(s,"=") and settings_to_hash(s)
+ local n = tonumber(l and l.unicode or s) or tonumber(s)
+ if n then
+ local data = characters[n]
+ if data then
+ local bb = data.boundingbox
+ if bb then
+ local llx = bb[1]
+ local lly = bb[2]
+ local urx = bb[3]
+ local ury = bb[4]
+ if ury > h then
+ h = ury
+ elseif - ury > d then
+ d = - ury
+ end
+ if - lly > d then
+ d = - lly
+ elseif lly > h then
+ h = lly
+ end
+ if llx < o then
+ o = llx
+ end
+ -- could be an extension to the "offset" command
+ local c = l and l.color
+ if c then
+ t[#t+1] = { "startcolor", c }
+ end
+ t[#t+1] = { "offset", 0, 0, n }
+ if c then
+ t[#t+1] = { "stopcolor" }
+ end
+ -- t[#t+1] = { "push" }
+ -- if c then
+ -- t[#t+1] = { "startcolor", c }
+ -- end
+ -- t[#t+1] = { "right", 0 }
+ -- t[#t+1] = { "char", n }
+ -- if c then
+ -- t[#t+1] = { "stopcolor" }
+ -- end
+ -- t[#t+1] = { "pop" }
+ if urx > w then
+ w = urx
+ end
+ else
+ local ht = data.height or 0 if ht > h then h = ht end
+ local dp = data.depth or 0 if dp > d then d = dp end
+ local wd = data.width or 0 if wd > w then w = wd end
+ t[#t+1] = { "char", n }
+ end
+ end
+ end
+ end
+ for i=1,#t do
+-- if t[i][1] == "right" then
+ if t[i][1] == "offset" then
+ t[i][2] = -o
+-- t[i][2] = o
+ end
+ end
+ -- cheat one: we get a private slot
+ unicode = fonts.helpers.addprivate(tfmdata,nil,{
+ commands = t,
+ width = w - o,
+ height = h,
+ depth = d,
+ })
+ -- cheat two: we overload it later
+ addcharacters(fontid,{ characters = { [unicode] = characters[unicode] } })
+ tfmdata.combhash = combhash
+ combhash[hash] = unicode
+ end
+ return unicode
+end
+
+interfaces.implement {
+ name = "combineglyphs",
+ public = true,
+ arguments = "string",
+ actions = function(list)
+ local list = settings_to_array(list)
+ local unicode = fonts.helpers.combineglyphs(font.current(),list)
+ context(unicode)
+ end,
+}
diff --git a/tex/context/base/mkxl/meta-fnt.mkxl b/tex/context/base/mkxl/meta-fnt.mkxl
index 0a2cab991..45d1db298 100644
--- a/tex/context/base/mkxl/meta-fnt.mkxl
+++ b/tex/context/base/mkxl/meta-fnt.mkxl
@@ -14,6 +14,7 @@
\writestatus{loading}{MetaPost Graphics / Fonts}
\registerctxluafile{meta-fnt}{autosuffix}
+\registerctxluafile{font-mpf}{autosuffix}
\unprotect
diff --git a/tex/context/base/mkxl/meta-imp-demo.mkxl b/tex/context/base/mkxl/meta-imp-demo.mkxl
new file mode 100644
index 000000000..220d5206d
--- /dev/null
+++ b/tex/context/base/mkxl/meta-imp-demo.mkxl
@@ -0,0 +1,187 @@
+%D \module
+%D [ file=meta-imp-demo,
+%D version=2021.01.21,
+%D title=\METAPOST\ Graphics,
+%D subtitle=Demo Font,
+%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 This is just a demo of defining a font in \METAPOST. The rendering as well as definitions
+%D are delayed till we actually need the glyph.
+
+\startMPcalculation{simplefun}
+
+ picture DemoSnippets[];
+
+ vardef DemoCircle = image(fill fullcircle scaled 10 ;) enddef ;
+ vardef DemoCenter = image(fill fullcircle scaled 3 ;) enddef ;
+
+ vardef DemoLeft = image(fill fullcircle scaled 3 shifted (-5, 0) ;) enddef ;
+ vardef DemoRight = image(fill fullcircle scaled 3 shifted ( 5, 0) ;) enddef ;
+ vardef DemoUp = image(fill fullcircle scaled 3 shifted ( 0, 5) ;) enddef ;
+ vardef DemoDown = image(fill fullcircle scaled 3 shifted ( 0,-5) ;) enddef ;
+ vardef DemoLowerLeft = image(fill fullcircle scaled 3 shifted (-5,-5) ;) enddef ;
+ vardef DemoLowerRight = image(fill fullcircle scaled 3 shifted ( 5,-5) ;) enddef ;
+ vardef DemoUpperRight = image(fill fullcircle scaled 3 shifted ( 5, 5) ;) enddef ;
+ vardef DemoUpperLeft = image(fill fullcircle scaled 3 shifted (-5, 5) ;) enddef ;
+
+ vardef DemoGlyph =
+ composeglyph(DemoSnippets) ;
+ enddef ;
+
+ lmt_registerglyphs [
+ name = "demo",
+ units = 10,
+ width = 10,
+ height = 10,
+ depth = 0,
+ ] ;
+
+ % we need to set up some basics (signals to the backend and such) at definition
+ % time so we just force a bogus shape (zero)
+
+ lmt_registerglyph [
+ category = "demo",
+ ] ;
+
+\stopMPcalculation
+
+\startluacode
+
+metapost.metafonts.demo = {
+ [utf.byte("g")] = {
+ code = "DemoGlyph",
+ shapes = {
+ { shape = "DemoCircle", color = "gray" },
+ { shape = "DemoLeft", color = "cyan" },
+ { shape = "DemoUp", color = "magenta" },
+ { shape = "DemoCenter", color = "yellow" },
+ }
+ },
+ [utf.byte("h")] = {
+ code = "DemoGlyph",
+ shapes = {
+ { shape = "DemoCircle", color = "gray" },
+ { shape = "DemoRight", color = "red" },
+ { shape = "DemoDown", color = "green" },
+ { shape = "DemoCenter", color = "blue" },
+ }
+ },
+ [19] = {
+ code = "DemoGlyph",
+ shapes = {
+ { shape = "DemoCircle", color = "gray" },
+ { shape = "DemoUp", color = "darkgray" },
+ { shape = "DemoDown", color = "darkgray" },
+ { shape = "DemoLeft", color = "darkgray" },
+ { shape = "DemoRight", color = "darkgray" },
+ { shape = "DemoCenter", color = "darkgray" },
+ }
+ },
+ ["weirdsymbol"] = {
+ code = "DemoGlyph",
+ shapes = {
+ { shape = "DemoCircle", color = "middlegray" },
+ { shape = "DemoUp", color = "red" },
+ { shape = "DemoDown", color = "green" },
+ { shape = "DemoLeft", color = "blue" },
+ { shape = "DemoRight", color = "magenta" },
+ { shape = "DemoCenter", color = "yellow" },
+ }
+ },
+ ["weirdersymbol"] = {
+ code = "DemoGlyph",
+ shapes = {
+ -- { shape = "DemoCircle", color = "gray" },
+ { shape = "DemoCenter", color = "darkgray" },
+ { shape = "DemoLowerLeft", color = "red" },
+ { shape = "DemoLowerRight", color = "green" },
+ { shape = "DemoUpperRight", color = "blue" },
+ { shape = "DemoUpperLeft", color = "yellow" },
+ { shape = "DemoUp", color = "darkred" },
+ { shape = "DemoDown", color = "darkgreen" },
+ { shape = "DemoLeft", color = "darkblue" },
+ { shape = "DemoRight", color = "darkmagenta" },
+ }
+ }
+}
+
+\stopluacode
+
+\continueifinputfile{meta-imp-demo.mkxl}
+
+\setuplayout[tight]
+
+\setupbodyfont[dejavu]
+
+\definefontfeature[demo][metapost=demo,metafont=demo]
+
+\definefont[DemoA][Serif*demo]
+\definefont[DemoB][Serif*demo sa .5]
+\definefont[DemoC][Serif*demo sa .25]
+
+\starttext
+
+ \startbuffer
+ x\ruledhbox{gh}%
+ x\ruledhbox{\char19}%
+ x\privatecharacter{weirdsymbol}%
+ x\privatecharacter{weirdersymbol}%
+ x%
+ \stopbuffer
+
+ \startTEXpage[offset=2pt]
+ \DemoA\getbuffer\par
+ \DemoB\getbuffer\quad\DemoC\getbuffer\par
+ \stopTEXpage
+
+ {\DemoA\ctxlua{fonts.helpers.setmetaglyph {
+ category = "demo",
+ name = "whatever",
+ code = "DemoGlyph",
+ shapes = {
+ { shape = "DemoCenter", color = "darkgray" },
+ { shape = "DemoLowerLeft", color = "darkred" },
+ { shape = "DemoLowerRight", color = "darkgreen" },
+ { shape = "DemoUpperRight", color = "darkblue" },
+ { shape = "DemoUpperLeft", color = "darkyellow" },
+ { shape = "DemoUp", color = "red" },
+ { shape = "DemoDown", color = "green" },
+ { shape = "DemoLeft", color = "blue" },
+ { shape = "DemoRight", color = "magenta" },
+ }
+ }}}
+
+ {\DemoA\setmetaglyph {
+ category {demo}
+ name {forever}
+ code {DemoGlyph}
+ shapes {
+ { shape {DemoCenter} color {middlegray} }
+ { shape {DemoLowerLeft} color {darkgray} }
+ { shape {DemoLowerRight} color {darkgray} }
+ { shape {DemoUpperRight} color {darkgray} }
+ { shape {DemoUpperLeft} color {darkgray} }
+ { shape {DemoUp} color {lightgray} }
+ { shape {DemoDown} color {lightgray} }
+ { shape {DemoLeft} color {lightgray} }
+ { shape {DemoRight} color {lightgray} }
+ }
+ }}
+
+ \startTEXpage[offset=2pt]
+ \DemoA
+ \privatecharacter{whatever}
+ \privatecharacter{forever}
+ \stopTEXpage
+
+ \DemoA\setupinterlinespace \dorecurse{10}{\dorecurse{1000}{g h }\par}\page
+ \DemoB\setupinterlinespace \dorecurse{20}{\dorecurse{1000}{g h }\par}\page
+ \DemoC\setupinterlinespace \dorecurse{30}{\dorecurse{1000}{g h }\par}\page
+
+\stoptext
diff --git a/tex/context/base/mkxl/meta-ini.mkxl b/tex/context/base/mkxl/meta-ini.mkxl
index 70fab112b..d9b8eeff8 100644
--- a/tex/context/base/mkxl/meta-ini.mkxl
+++ b/tex/context/base/mkxl/meta-ini.mkxl
@@ -876,7 +876,7 @@
\permanent\protected\def\resetMPenvironment
{\clf_mptexreset}
-\protected\def\useMPenvironmentbuffer[#1]%
+\permanent\protected\def\useMPenvironmentbuffer[#1]%
{\clf_mptexsetfrombuffer{#1}}
%D This command takes \type {[reset]} as optional argument.
diff --git a/tex/context/base/mkxl/mult-aux.mkxl b/tex/context/base/mkxl/mult-aux.mkxl
index a8ab97fb1..5db4c1677 100644
--- a/tex/context/base/mkxl/mult-aux.mkxl
+++ b/tex/context/base/mkxl/mult-aux.mkxl
@@ -746,7 +746,7 @@
% yes:\twoparameter{beta}\par
\permanent\protected\def\relateparameterhandlers#1#2#3#4% {from} {instance} {to} {instance}
- {\immutable\edefcsname#1namespace\endcsname#2:\s!parent\endcsname{\csname#3namespace\endcsname#4}}
+ {\immutable\edefcsname\csname#1namespace\endcsname#2:\s!parent\endcsname{\csname#3namespace\endcsname#4}}
\permanent\protected\def\relateparameterhandlersbyns#1#2#3#4% {from} {instance} {to} {instance}
{\edefcsname#1#2:\s!parent\endcsname{#3#4}}
diff --git a/tex/context/base/mkxl/mult-ini.mkxl b/tex/context/base/mkxl/mult-ini.mkxl
index 1dad4858a..ce8d12069 100644
--- a/tex/context/base/mkxl/mult-ini.mkxl
+++ b/tex/context/base/mkxl/mult-ini.mkxl
@@ -366,7 +366,7 @@
\def\mult_messages_start_nop#1#2\stopmessages
{\endgroup}
-\let\stopmessages\relax
+\aliased\let\stopmessages\relax
\permanent\protected\def\setinterfacemessage#1#2#3%
{\ifcsname\m!prefix!#1\endcsname\else\immutable\setgvalue{\m!prefix!#1}{#1}\fi
diff --git a/tex/context/base/mkxl/pack-lyr.mkxl b/tex/context/base/mkxl/pack-lyr.mkxl
index ccf4290d4..2950782f7 100644
--- a/tex/context/base/mkxl/pack-lyr.mkxl
+++ b/tex/context/base/mkxl/pack-lyr.mkxl
@@ -143,11 +143,11 @@
\newdimen\layerwidth
\newdimen\layerheight
-\let\lastlayerxpos\!!zeropoint
-\let\lastlayerypos\!!zeropoint
-\let\lastlayerwd \!!zeropoint
-\let\lastlayerht \!!zeropoint
-\let\lastlayerdp \!!zeropoint
+\mutable\let\lastlayerxpos\!!zeropoint
+\mutable\let\lastlayerypos\!!zeropoint
+\mutable\let\lastlayerwd \!!zeropoint
+\mutable\let\lastlayerht \!!zeropoint
+\mutable\let\lastlayerdp \!!zeropoint
\appendtoks
\edef\p_pack_layers_doublesided{\layerparameter\c!doublesided}%
@@ -370,11 +370,11 @@
\global\setbox\layerpagebox\vpack %to \layerparameter\c!height % new, otherwise no negative y possible
{\offinterlineskip
\ifvoid\layerpagebox
- \let\lastlayerwidth \zeropoint
- \let\lastlayerheight\zeropoint
+ \scratchwidth \zeropoint
+ \scratchheight\zeropoint
\else
- \edef\lastlayerwidth {\the\wd\layerpagebox}%
- \edef\lastlayerheight{\the\ht\layerpagebox}%
+ \scratchwidth \wd\layerpagebox
+ \scratchheight\ht\layerpagebox
\ht\layerpagebox\zeropoint
\dp\layerpagebox\zeropoint
\wd\layerpagebox\zeropoint
@@ -410,14 +410,14 @@
\gsetboxllx\layerpagebox\scratchdimen
\fi
\advance\scratchdimen\wd\nextbox
- \wd\nextbox\ifdim\scratchdimen>\lastlayerwidth \scratchdimen \else \lastlayerwidth \fi
+ \wd\nextbox\ifdim\scratchdimen>\scratchwidth \scratchdimen \else \scratchwidth \fi
\scratchdimen\dimexpr\d_pack_layers_y_position+\d_pack_layers_y_offset\relax
\ifdim\scratchdimen<\getboxlly\layerpagebox
\gsetboxlly\layerpagebox\scratchdimen
\fi
% ll compensation
\advance\scratchdimen\dimexpr\ht\nextbox+\dp\nextbox\relax
- \ht\nextbox\ifdim\scratchdimen>\lastlayerheight \scratchdimen \else \lastlayerheight \fi
+ \ht\nextbox\ifdim\scratchdimen>\scratchheight \scratchdimen \else \scratchheight \fi
\dp\nextbox\zeropoint
% placement
\hsize\p_pack_layers_width
diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl
index 18a667dd6..d3db64d2e 100644
--- a/tex/context/base/mkxl/pack-rul.mkxl
+++ b/tex/context/base/mkxl/pack-rul.mkxl
@@ -943,7 +943,7 @@
\pack_framed_initialize
\pack_framed_process_box_indeed} % group ends here
-\let\postprocessframebox\relax
+\mutable\let\postprocessframebox\relax
%D A nice example by Aditya:
%D
diff --git a/tex/context/base/mkxl/page-bck.mkxl b/tex/context/base/mkxl/page-bck.mkxl
index 5bdeb53fa..9790cf3bf 100644
--- a/tex/context/base/mkxl/page-bck.mkxl
+++ b/tex/context/base/mkxl/page-bck.mkxl
@@ -352,7 +352,7 @@
\def\page_backgrounds_set_box#1% #2%
{\global\setbox#1\vpack
{\dontcomplain
- \swapmargins
+ \page_layouts_swap_margins
\ifconditional\swapbackgroundmargins
\doifelsemarginswap \donothing
{\enforced\swapcsvalues\v!rightmargin\v!leftmargin
@@ -361,7 +361,7 @@
\calculatereducedvsizes
\offinterlineskip
% \ifconditional#2\relax
- % \doswapmargins % hm, this one gets nilled in \swapmargins anyway
+ % \page_layouts_swap_margins_indeed % hm, this one gets nilled in \page_layouts_swap_margin anyway
% \fi
\ifdim\topheight>\zeropoint
\kern\dimexpr-\topheight-\topdistance\relax
diff --git a/tex/context/base/mkxl/page-lay.mkxl b/tex/context/base/mkxl/page-lay.mkxl
index 01098ae3b..dbdcfc323 100644
--- a/tex/context/base/mkxl/page-lay.mkxl
+++ b/tex/context/base/mkxl/page-lay.mkxl
@@ -1233,12 +1233,12 @@
\aliased\let\doifmarginswapelse\doifelsemarginswap
-\def\swapmargins % name will change, frozen?
- {\doifelsemarginswap\relax\doswapmargins}
+\protected\def\page_layouts_swap_margins % name will change, frozen?
+ {\doifelsemarginswap\relax\page_layouts_swap_margins_indeed}
-\permanent\protected\def\doswapmargins
- {\enforced\let\swapmargins \relax % to prevent local swapping
- \enforced\let\doswapmargins\relax % to prevent local swapping
+\protected\def\page_layouts_swap_margins_indeed
+ {\let\page_layouts_swap_margins \relax % to prevent local swapping
+ \let\page_layouts_swap_margins_indeed\relax % to prevent local swapping
\the\everyswapmargins}
\permanent\def\rightorleftpageaction
diff --git a/tex/context/base/mkxl/page-one.mkxl b/tex/context/base/mkxl/page-one.mkxl
index 2169c6018..444feff1d 100644
--- a/tex/context/base/mkxl/page-one.mkxl
+++ b/tex/context/base/mkxl/page-one.mkxl
@@ -216,8 +216,8 @@
\vskip\s_page_one_between_top_insert
\egroup}
-\let\totaltopinserted\!!zeropoint
-\let\totalbotinserted\!!zeropoint
+\mutable\let\totaltopinserted\!!zeropoint
+\mutable\let\totalbotinserted\!!zeropoint
\protected\def\page_one_command_set_top_insertions
{\bgroup
diff --git a/tex/context/base/mkxl/page-txt.mklx b/tex/context/base/mkxl/page-txt.mklx
index b20650341..a5a5a97ab 100644
--- a/tex/context/base/mkxl/page-txt.mklx
+++ b/tex/context/base/mkxl/page-txt.mklx
@@ -854,7 +854,7 @@
{\setbox\b_page_layouts_element\vpack
{\dontcomplain
\calculatereducedvsizes
- \swapmargins
+ \page_layouts_swap_margins
\offinterlineskip
\vkern\dimexpr-\topheight-\topdistance\relax
\the\toptextcontent
@@ -888,13 +888,13 @@
{\offinterlineskip
\calculatereducedvsizes
\calculatehsizes
- \swapmargins
+ \page_layouts_swap_margins
\vkern\dimexpr\headerheight+\headerdistance+\textdistance\relax
\dontleavehmode
%\page_prepare_backgrounds{#2}%
\hpack to \makeupwidth
{\begingroup
- \swapmargins
+ \page_layouts_swap_margins
\goleftonpage
\ifdim\leftedgewidth>\zeropoint
\the\leftedgetextcontent
diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl
index 0104cc4eb..c2d421e4c 100644
--- a/tex/context/base/mkxl/publ-ini.mkxl
+++ b/tex/context/base/mkxl/publ-ini.mkxl
@@ -1893,14 +1893,14 @@
{\begingroup
\let\savedcurrentbtx\currentbtx
\def\currentbtx{#1}%
- \usebtxstyle\c!style
+ \usebtxstyleparameter\c!style
\let\currentbtx\savedcurrentbtx}
\permanent\protected\def\btxstartcolor[#1]%
{\begingroup
\let\savedcurrentbtx\currentbtx
\def\currentbtx{#1}%
- \usebtxcolor\c!color
+ \usebtxcolorparameter\c!color
\let\currentbtx\savedcurrentbtx}
\permanent\protected\def\btxstartstyleandcolor[#1]%
diff --git a/tex/context/base/mkxl/spac-ali.mkxl b/tex/context/base/mkxl/spac-ali.mkxl
index d0530d138..56ac53a3e 100644
--- a/tex/context/base/mkxl/spac-ali.mkxl
+++ b/tex/context/base/mkxl/spac-ali.mkxl
@@ -292,7 +292,7 @@
\parfillleftskip \zeropoint
\parfillskip \s_zero_plus_one_fil % new
\setfalse \raggedonelinerstate % now here
- \let\updateraggedskips\relax} % no need for adaption
+ \enforced\aliased\let\updateraggedskips\relax} % no need for adaption
\permanent\protected\def\spac_align_set_horizontal_left
{\setraggedness \spac_align_set_raggedness_left
@@ -537,8 +537,8 @@
\newtoks\t_spac_align_collected
-\let\raggedcommand \relax
-\let\updateraggedskips\relax
+\aliased\let\raggedcommand \relax
+\aliased\let\updateraggedskips\relax
\def\spac_align_add_to_cache
{\enforced\let\raggedbox\relax % why
@@ -564,10 +564,10 @@
\spac_align_flush_page
\spac_align_flush_parfill
}}% kept, nice for tracing
- \edef\raggedcommand {\the\t_spac_align_collected }%
- \edef\updateraggedskips{\spac_align_flush_horizontal}%
- \gletcsname\??alignmentnormalcache\m_spac_align_asked\endcsname\raggedcommand
- \gletcsname\??alignmentraggedcache\m_spac_align_asked\endcsname\updateraggedskips}
+ \enforced\permanent\protected\edef\raggedcommand {\the\t_spac_align_collected }%
+ \enforced\permanent\protected\edef\updateraggedskips{\spac_align_flush_horizontal}%
+ \enforced\aliased\gletcsname\??alignmentnormalcache\m_spac_align_asked\endcsname\raggedcommand
+ \enforced\aliased\gletcsname\??alignmentraggedcache\m_spac_align_asked\endcsname\updateraggedskips}
\def\spac_align_collect#1%
{\csname\??aligncommand#1\endcsname}
@@ -576,11 +576,11 @@
\permanent\protected\def\spac_align_prepare#1% deferred
{\edef\m_spac_align_asked{#1}%
- \expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align_asked\endcsname
+ \enforced\aliased\expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align_asked\endcsname
\ifrelax\raggedcommand
\spac_align_add_to_cache
\else
- \expandafter\let\expandafter\updateraggedskips\csname\??alignmentraggedcache\m_spac_align_asked\endcsname
+ \enforced\aliased\expandafter\let\expandafter\updateraggedskips\csname\??alignmentraggedcache\m_spac_align_asked\endcsname
\fi}
\aliased\let\dosetraggedcommand\spac_align_prepare % sort of public
@@ -589,11 +589,11 @@
\permanent\tolerant\protected\def\setupalign[#1]% immediate
{\edef\m_spac_align_asked{#1}%
- \expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align_asked\endcsname
+ \enforced\expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align_asked\endcsname
\ifrelax\raggedcommand
\spac_align_add_to_cache
\else
- \expandafter\let\expandafter\updateraggedskips\csname\??alignmentraggedcache\m_spac_align_asked\endcsname
+ \enforced\aliased\expandafter\let\expandafter\updateraggedskips\csname\??alignmentraggedcache\m_spac_align_asked\endcsname
\fi
\raggedcommand}
@@ -610,11 +610,11 @@
\fi}
\def\spac_align_use_indeed
- {\expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align_asked\endcsname
+ {\enforced\aliased\expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align_asked\endcsname
\ifrelax\raggedcommand
\spac_align_add_to_cache
\else
- \expandafter\let\expandafter\updateraggedskips\csname\??alignmentraggedcache\m_spac_align_asked\endcsname
+ \enforced\aliased\expandafter\let\expandafter\updateraggedskips\csname\??alignmentraggedcache\m_spac_align_asked\endcsname
\fi
\raggedcommand}
@@ -623,7 +623,7 @@
\protected\def\spac_align_use_later#1%
{\begingroup
\edef\m_spac_align_asked{#1}%
- \expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align_asked\endcsname
+ \enforced\aliased\expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align_asked\endcsname
\ifrelax\raggedcommand
\spac_align_add_to_cache
\fi
@@ -848,7 +848,7 @@
% be aware of possible interference.
\permanent\protected\def\setraggedskips#1#2#3#4#5#6#7% never change this name (todo: inline this one .. less tracingall)
- {\protected\def\updateraggedskips{\dosetraggedskips{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
+ {\enforced\permanent\protected\def\updateraggedskips{\dosetraggedskips{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
\updateraggedskips}
\permanent\protected\def\dosetraggedskips#1#2#3#4#5#6#7%
diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl
index fe74ee06e..9a7912abf 100644
--- a/tex/context/base/mkxl/spac-ver.mkxl
+++ b/tex/context/base/mkxl/spac-ver.mkxl
@@ -1234,8 +1234,8 @@
\permanent\protected\def\pseudostrut
{\noindent} % better: \dontleavehmode
-\let\pseudobegstrut\pseudostrut
-\let\pseudoendstrut\removeunwantedspaces
+\aliased\let\pseudobegstrut\pseudostrut
+\aliased\let\pseudoendstrut\removeunwantedspaces
\permanent\protected\def\resetteststrut
{\strutwidth\zeropoint
diff --git a/tex/context/base/mkxl/strc-flt.mklx b/tex/context/base/mkxl/strc-flt.mklx
index d55a6c77e..58c72c0fc 100644
--- a/tex/context/base/mkxl/strc-flt.mklx
+++ b/tex/context/base/mkxl/strc-flt.mklx
@@ -595,8 +595,8 @@
\let\m_strc_floats_saved_userdata\empty
\let\currentfloatcaption\currentfloat}
-\let\askedfloatmethod \empty
-\let\askedfloatoptions\empty
+\mutable\let\askedfloatmethod \empty
+\mutable\let\askedfloatoptions\empty
\def\strc_floats_reset_variables
{\global\emptyfloatcaptionfalse
diff --git a/tex/context/base/mkxl/strc-itm.mklx b/tex/context/base/mkxl/strc-itm.mklx
index 33d5c324d..01155fa10 100644
--- a/tex/context/base/mkxl/strc-itm.mklx
+++ b/tex/context/base/mkxl/strc-itm.mklx
@@ -1132,7 +1132,7 @@
% \stopitemize
% \stopitemize
-\tolerant\protected\def\startitemgroupitem[#reference]% we can reuse more
+\tolerant\permanent\protected\def\startitemgroupitem[#reference]% we can reuse more
{\def\currentitemreference{#reference}%
\ifconditional\c_strc_itemgroups_text
% begin of item
@@ -1170,7 +1170,7 @@
\hskip\d_strc_itemgroups_signal % concat
\itemgroupparameter\c!command}
-\protected\def\stopitemgroupitem
+\protected\permanent\def\stopitemgroupitem
{\ifhmode
\endstrut % new per 2017-12-15
\fi
@@ -1180,7 +1180,7 @@
\endgraf
\fi}
-\tolerant\protected\def\startitemgrouphead[#reference]%
+\tolerant\permanent\protected\def\startitemgrouphead[#reference]%
{\ifconditional\c_strc_itemgroups_first \else
\strc_itemgroups_insert_breakallow
\fi
@@ -1201,7 +1201,7 @@
\strc_itemgroups_stop_head_indeed
\strc_itemgroups_head_body_indeed}
-\protected\def\stopitemgrouphead
+\protected\permanent\def\stopitemgrouphead
{\dostoptagged
\stopitemgroupitem}
@@ -1306,14 +1306,14 @@
{\dorecurse{0\itemgroupparameter\c!items}{\strc_itemgroups_used_symbol\hss}%
\unskip}}
-\protected\def\startspecialitemgroupitem[#name]% todo: frozen
+\protected\permanent\def\startspecialitemgroupitem[#name]% todo: frozen
{\ifcsname\??itemgroupstart#name\endcsname
\expandafter\lastnamedcs
\else
\expandafter\strc_itemgroups_start_do_item
\fi}
-\protected\def\stopspecialitemgroupitem % todo: frozen
+\protected\permanent\def\stopspecialitemgroupitem % todo: frozen
{\stopitemgroupitem}
\letvalue{\??itemgroupstart\v!item}\strc_itemgroups_start_do_item
@@ -1579,25 +1579,25 @@
%D The local commands:
-\ifdefined\item \else \let\item \relax \fi
-\ifdefined\sub \else \let\sub \relax \fi
-\ifdefined\sym \else \let\sym \relax \fi
-\ifdefined\ran \else \let\ran \relax \fi
-\ifdefined\its \else \let\its \relax \fi
-\ifdefined\mar \else \let\mar \relax \fi
-\ifdefined\noitem \else \let\noitem \relax \fi
-\ifdefined\itm \else \let\itm \relax \fi
-\ifdefined\but \else \let\but \relax \fi
-\ifdefined\nop \else \let\nop \relax \fi
-\ifdefined\txt \else \let\txt \relax \fi
-\ifdefined\head \else \let\head \relax \fi
-\ifdefined\headsym \else \let\headsym \relax \fi
-\ifdefined\startitem \else \let\startitem \relax \fi
-\ifdefined\stopitem \else \let\stopitem \relax \fi
-\ifdefined\starthead \else \let\starthead \relax \fi
-\ifdefined\stophead \else \let\stophead \relax \fi
-\ifdefined\startspecialitem \else \let\startspecialitem\relax \fi
-\ifdefined\stopspecialitem \else \let\stopspecialitem \relax \fi
+\ifdefined\item \else \let\item \relax \fi % defined later
+\ifdefined\sub \else \aliased\let\sub \relax \fi
+\ifdefined\sym \else \aliased\let\sym \relax \fi
+\ifdefined\ran \else \aliased\let\ran \relax \fi
+\ifdefined\its \else \aliased\let\its \relax \fi
+\ifdefined\mar \else \aliased\let\mar \relax \fi
+\ifdefined\noitem \else \aliased\let\noitem \relax \fi
+\ifdefined\itm \else \aliased\let\itm \relax \fi
+\ifdefined\but \else \aliased\let\but \relax \fi
+\ifdefined\nop \else \aliased\let\nop \relax \fi
+\ifdefined\txt \else \aliased\let\txt \relax \fi
+\ifdefined\head \else \let\head \relax \fi % defined later
+\ifdefined\headsym \else \aliased\let\headsym \relax \fi
+\ifdefined\startitem \else \let\startitem \relax \fi % defined later
+\ifdefined\stopitem \else \aliased\let\stopitem \relax \fi
+\ifdefined\starthead \else \aliased\let\starthead \relax \fi
+\ifdefined\stophead \else \aliased\let\stophead \relax \fi
+\ifdefined\startspecialitem \else \aliased\let\startspecialitem\relax \fi
+\ifdefined\stopspecialitem \else \aliased\let\stopspecialitem \relax \fi
\appendtoks
@@ -1624,7 +1624,7 @@
\ifx\currentinterface \s!english \else
- \def\next#1#2{\ifcsname#1\endcsname\else\enforced\letcsname#1\endcsname#2\fi}
+ \def\next#1#2{\ifcsname#1\endcsname\else\enforced\aliased\letcsname#1\endcsname#2\fi}
\etoksapp\itemgroupcommands{%
\next{\v!item }\strc_itemgroups_start_do_item
@@ -1735,7 +1735,7 @@
\expandafter\strc_itemgroups_collected_flush
\fi}
-\protected\def\stopcollectitems % todo: frozen
+\protected\permanent\def\stopcollectitems % todo: frozen
{\ifconditional\c_strc_itemgroups_collecting
\c_strc_itemgroups_collected_done \zerocount
\c_strc_itemgroups_collected_current\zerocount
@@ -1751,10 +1751,10 @@
\fi
\fi}
-\protected\def\startcollectitems % todo: frozen
+\protected\permanent\def\startcollectitems % todo: frozen
{\ifconditional\c_strc_itemgroups_collecting
\c_strc_itemgroups_collected_stored\zerocount
- \letcsname\e!start\v!item\endcsname\strc_itemgroups_collected_store
+ \enforced\letcsname\e!start\v!item\endcsname\strc_itemgroups_collected_store
\fi}
%D Left-overs:
diff --git a/tex/context/base/mkxl/strc-lst.mklx b/tex/context/base/mkxl/strc-lst.mklx
index 0b8c2e2a3..725faff9a 100644
--- a/tex/context/base/mkxl/strc-lst.mklx
+++ b/tex/context/base/mkxl/strc-lst.mklx
@@ -1551,9 +1551,9 @@
% todo:
-\def\utilitylistlength{\listlength} % old name ... uses in styles
+\permanent\def\utilitylistlength{\listlength} % also in strc-reg (downward compatible name)
-\mutable\let\listlength\!!zerocount % better use listmode
+\mutable\let\listlength\!!zerocount % also in strc-reg
\permanent\tolerant\protected\def\determinelistcharacteristics[#list]#spacer[#settings]%
{\begingroup
diff --git a/tex/context/base/mkxl/strc-pag.mkxl b/tex/context/base/mkxl/strc-pag.mkxl
index abab94e72..3af694e81 100644
--- a/tex/context/base/mkxl/strc-pag.mkxl
+++ b/tex/context/base/mkxl/strc-pag.mkxl
@@ -327,16 +327,6 @@
\strc_pagenumbers_set_location
\to \everysetuppagenumbering
-\appendtoks
- \ifdefined\trackingmarginnotestrue
- \ifdoublesided
- \trackingmarginnotestrue
- \else
- \trackingmarginnotesfalse
- \fi
- \fi
-\to \everysidedswitch
-
\ifdefined \page_backgrounds_recalculate \else
\let\page_backgrounds_recalculate\relax
\fi
diff --git a/tex/context/base/mkxl/strc-ref.mklx b/tex/context/base/mkxl/strc-ref.mklx
index 758f2855f..680cf2e29 100644
--- a/tex/context/base/mkxl/strc-ref.mklx
+++ b/tex/context/base/mkxl/strc-ref.mklx
@@ -736,6 +736,8 @@
%D When a reference is not found, we typeset a placeholder (two glyphs are often
%D enough to represent the reference text).
+% \askedreference defined in lua
+
\def\dummyreference{{\tttf ??}}
\def\emptyreference{{\tttf !!}}
diff --git a/tex/context/base/mkxl/strc-reg.mkxl b/tex/context/base/mkxl/strc-reg.mkxl
index dcfdd0946..2a8cc50fe 100644
--- a/tex/context/base/mkxl/strc-reg.mkxl
+++ b/tex/context/base/mkxl/strc-reg.mkxl
@@ -602,13 +602,15 @@
% todo: c!language ipv s!language
-\let\utilityregisterlength\!!zerocount
+\permanent\def\utilityregisterlength{\listlength} % also in strc-lst (downward compatible name)
+
+% \mutable\let\listlength\!!zerocount % also in strc-lst
\permanent\tolerant\protected\def\determineregistercharacteristics[#1]#*[#2]%
{\begingroup
\setupregister[#1][#2]%
\edef\currentregister{\firstinset{#1}}%
- \normalexpanded{\endgroup\noexpand\xdef\noexpand\utilityregisterlength{\clf_analyzeregister
+ \normalexpanded{\endgroup\noexpand\xdef\noexpand\listlength{\clf_analyzeregister
{\currentregister}%
{%
language {\registerparameter\s!language}%
diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl
index 81e0248e6..acc7e494e 100644
--- a/tex/context/base/mkxl/strc-sec.mkxl
+++ b/tex/context/base/mkxl/strc-sec.mkxl
@@ -888,6 +888,10 @@
\newtoks\everybeforesectionheadhandle
\newtoks\everyaftersectionheadhandle
+\mutable\let\getheadnumber\empty
+\mutable\let\getheadtitle \empty
+\mutable\let\getheadsyncs \empty
+
\def\strc_sectioning_handle#1#2#3% name data userdata (we can move #1 to the caller)
{\xdef\currenthead {#1}%
\xdef\currentheadcoupling{\sectionheadcoupling\currenthead}%
diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl
index 9dea8e5bb..ce6177b3b 100644
--- a/tex/context/base/mkxl/syst-aux.mkxl
+++ b/tex/context/base/mkxl/syst-aux.mkxl
@@ -2769,7 +2769,7 @@
\permanent\protected\def\relaxvalueifundefined#1%
{\ifcsname#1\endcsname \else
- \letcsname#1\endcsname\relax
+ \aliased\letcsname#1\endcsname\relax
\fi}
%D \macros
@@ -2778,7 +2778,7 @@
%D The next macro hardly needs explanation. Because no nesting is to be expected, we
%D can reuse \type {\wait} within \type {\wait} itself.
-\protected\def\wait
+\permanent\protected\def\wait
{\begingroup
\read16 to \wait
\endgroup}
@@ -3003,7 +3003,7 @@
%D unexpected results, for instance execution of \type {\doif} even if both numbers
%D are unequal.
-\def\zerocountervalue{0}
+\immutable\def\zerocountervalue{0}
\permanent\protected\def\newcounter#1%
{\dodoglobal\let#1\zerocountervalue}
@@ -6241,7 +6241,7 @@
\permanent\protected\def\retestfeature % timer support is new per 10/5/2005
{\bgroup
- \ifcase\interactionmode\let\wait\relax\fi
+ \ifcase\interactionmode\enforced\let\wait\relax\fi
\clf_resettimer
\c_syst_helpers_test_feature_n\zerocount
\syst_helpers_test_feature_nop
@@ -6263,7 +6263,7 @@
\permanent\protected\def\testfeatureonce#1#2%
{\begingroup
- \let\wait\relax
+ \enforced\let\wait\relax
\testfeature{#1}{#2}%
\endgroup}
diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl
index a12a83064..50b61231f 100644
--- a/tex/context/base/mkxl/syst-ini.mkxl
+++ b/tex/context/base/mkxl/syst-ini.mkxl
@@ -143,8 +143,11 @@
function tex.enableprimitives() end % so we kind of protect what's there
}
+\permanent\let\undefined\undefined
+
\immutable\def\space{ }
\immutable\def\empty{}
+\mutable \def\temp {}
\immutable\letcharcode \formfeedasciicode \par % \def ^^L{\par} formfeed
\immutable\letcharcode \tildeasciicode \ % tilde
@@ -259,7 +262,7 @@
%D 255. Users can use the scratch registers upto 31 without problem but all others
%D are reserved.
-\let\wlog\gobbleoneargument % Let's get rid of this one.
+\permanent\let\wlog\gobbleoneargument % Let's get rid of this one.
%D The allocators share a common helper macro.
diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl
index 2840a9cd1..668a10f5b 100644
--- a/tex/context/base/mkxl/tabl-ntb.mkxl
+++ b/tex/context/base/mkxl/tabl-ntb.mkxl
@@ -1138,8 +1138,8 @@
\tabl_ntb_let_tag\c_tabl_ntb_current_row\c_tabl_ntb_current_col\c_tabl_ntb_none
\fi}
-\let\startTBLprocessing\relax % public
-\let\stopTBLprocessing \relax % public
+\mutable\let\startTBLprocessing\relax % public
+\mutable\let\stopTBLprocessing \relax % public
\newcount\c_tabl_prelocated_rows % \prelocateTBLrows{1000} may speed up large tables
diff --git a/tex/context/base/mkxl/tabl-tab.mkxl b/tex/context/base/mkxl/tabl-tab.mkxl
index 5b053abb5..45dc36b36 100644
--- a/tex/context/base/mkxl/tabl-tab.mkxl
+++ b/tex/context/base/mkxl/tabl-tab.mkxl
@@ -40,13 +40,13 @@
\newdimen \d_tabl_table_column_width_unit
\newdimen \d_tabl_table_kern_unit
-\def\tablestrutheightfactor {8}
-\def\tablestrutdepthfactor {3}
-\def\tableintercolumnspacefactor {3}
-\def\tablecolumnwidthfactor {10}
-\def\tablevspacefactor {2}
-\def\tablekernfactor {1}
-\def\tablelinethicknessfactor {4}
+\mutable\def\tablestrutheightfactor {8}
+\mutable\def\tablestrutdepthfactor {3}
+\mutable\def\tableintercolumnspacefactor {3}
+\mutable\def\tablecolumnwidthfactor {10}
+\mutable\def\tablevspacefactor {2}
+\mutable\def\tablekernfactor {1}
+\mutable\def\tablelinethicknessfactor {4}
\newtoks\everytable
\newtoks\everytableparbox
@@ -283,6 +283,8 @@
\tabl_table_use_bar
\expanded{\endgroup\noexpand\doreadtableformatkeys#1]}}% appear in a \tabl_table_reformat cmd; this is here as a safeguard.
+\aliased\let\ReFormat\relax
+
\appendtoks
\enforced\let\ReFormat\tabl_table_reformat
\to \everytable
@@ -290,7 +292,9 @@
\def\!tfEndReFormat
{\!tfReFormat}
-\appendtoks \tabl_table_paralignment \to \everytableparbox
+\appendtoks
+ \tabl_table_paralignment
+\to \everytableparbox
\def\!tfReFormat#1%
{\the \!taLeftGlue
@@ -424,6 +428,9 @@
% Key "\LeftGlue": Specifies the glue (usually \hfil, or nothing) to be
% added to extreme left of the template to position a column
+\aliased\let\LeftGlue \relax
+\aliased\let\RightGlue\relax
+
\newtableformatkey \LeftGlue#1%
{\!taLeftGlue{#1}%
\doreadtableformatkeys}
@@ -774,6 +781,10 @@
\def\tabl_table_enlarge#1#2% 3rd argument is picked up later
{\tabl_table_Enlarge{#1\d_tabl_table_strut_unit}{#2\d_tabl_table_strut_unit}}
+
+\aliased\let\enlarge\relax
+\aliased\let\Enlarge\relax
+
\appendtoks
\enforced\let\enlarge\tabl_table_enlarge
\enforced\let\Enlarge\tabl_table_Enlarge
@@ -955,6 +966,9 @@
{\tabl_table_use{#1}%
\tabl_table_reformat[}
+\aliased\let\use\relax
+\aliased\let\Use\relax
+
\appendtoks
\enforced\let\use\tabl_table_use
\enforced\let\Use\tabl_table_Use
@@ -1118,6 +1132,19 @@
\fi
\egroup} % Ends the \noalign
+\aliased\let\JustLeft \relax
+\aliased\let\JustCenter \relax
+\aliased\let\JustRight \relax
+\aliased\let\Smash \relax
+\aliased\let\Raise \relax
+\aliased\let\Lower \relax
+\aliased\let\BackSpace \relax
+\aliased\let\Vspace \relax
+\aliased\let\OpenUp \relax
+\aliased\let\TableLeft \relax
+\aliased\let\TableCenter\relax
+\aliased\let\TableRight \relax
+
\appendtoks
\enforced\let\JustLeft \tabl_table_JustLeft
\enforced\let\JustCenter \tabl_table_JustCenter
@@ -2087,6 +2114,14 @@
\permanent\def\tabl_table_FIVE {\use\plusfive}
\permanent\def\tabl_table_SIX {\use\plussix}
+\aliased\let\TWO \relax
+\aliased\let\THREE\relax
+\aliased\let\FOUR \relax
+\aliased\let\FIVE \relax
+\aliased\let\SIX \relax
+\aliased\let\SPAN \relax
+\aliased\let\REF \relax
+
\appendtoks
\enforced\let\TWO \tabl_table_TWO
\enforced\let\THREE\tabl_table_THREE
diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl
index a4e6e6fed..f29389f15 100644
--- a/tex/context/base/mkxl/tabl-tbl.mkxl
+++ b/tex/context/base/mkxl/tabl-tbl.mkxl
@@ -228,12 +228,10 @@
\aliased\let\tabulatesplitlinemode\c_tabl_tabulate_splitlinemode % temp hack, we need an interface
-
\newtoks \everytabulatepar % where used ?
\newtoks \everytabulate % public ?
-\protected\def\tolerantTABLEbreaktrue {\settrue \c_tabl_tabulate_tolerant_break} % used in styles !
-%protected\def\handletabulatepbreakfalse{\setfalse\c_tabl_tabulate_handlepbreak } % depricated
+\permanent\protected\def\tolerantTABLEbreaktrue{\settrue\c_tabl_tabulate_tolerant_break} % used in styles !
\permanent\def\noftabulaterows{\number\c_tabl_tabulate_noflines} % handy for testing if a table is empty
@@ -1109,8 +1107,8 @@
% todo: make footer synonym to tail
-\setuvalue{\e!start\v!tabulatehead}{\doifelsenextoptionalcs\tabl_tabulate_start_head_yes\tabl_tabulate_start_head_nop}
-\setuvalue{\e!start\v!tabulatetail}{\doifelsenextoptionalcs\tabl_tabulate_start_foot_yes\tabl_tabulate_start_foot_nop}
+\permanent\protected\defcsname\e!start\v!tabulatehead\endcsname{\doifelsenextoptionalcs\tabl_tabulate_start_head_yes\tabl_tabulate_start_head_nop}
+\permanent\protected\defcsname\e!start\v!tabulatetail\endcsname{\doifelsenextoptionalcs\tabl_tabulate_start_foot_yes\tabl_tabulate_start_foot_nop}
\let\m_tabl_tabulate_data\empty
diff --git a/tex/context/base/mkxl/tabl-tsp.mkxl b/tex/context/base/mkxl/tabl-tsp.mkxl
index 9d4a13380..83ad0350a 100644
--- a/tex/context/base/mkxl/tabl-tsp.mkxl
+++ b/tex/context/base/mkxl/tabl-tsp.mkxl
@@ -248,6 +248,8 @@
\let\postprocesstsplit \donothing
\to \everyresettsplit
+\mutable\let\postprocesstsplit\donothing
+
\permanent\protected\def\resettsplit
{\the\everyresettsplit}
diff --git a/tex/context/base/mkxl/typo-mar.mkxl b/tex/context/base/mkxl/typo-mar.mkxl
index 946199f87..daed1ee3d 100644
--- a/tex/context/base/mkxl/typo-mar.mkxl
+++ b/tex/context/base/mkxl/typo-mar.mkxl
@@ -174,7 +174,7 @@
\docheckpagestate\s!margintext\nofmargintexts
%\doifelserightpagestate\s!margintext\nofmargintexts\relax\relax
\realpageno\realpagestateno
- \swapmargins}
+ \page_layouts_swap_margins}
\permanent\protected\def\margindata
{\iftrialtypesetting
diff --git a/tex/context/base/mkxl/typo-scr.mkxl b/tex/context/base/mkxl/typo-scr.mkxl
index f1e56cbaa..bb67228cd 100644
--- a/tex/context/base/mkxl/typo-scr.mkxl
+++ b/tex/context/base/mkxl/typo-scr.mkxl
@@ -45,8 +45,8 @@
\setuplow [\c!style=\tx,\c!distance=\zeropoint,\c!down=.48\exheight] % historical
\setuphigh[\c!style=\tx,\c!distance=\zeropoint,\c!up =.86\exheight] % values
-\appendtoks \setuevalue\currentlow {\typo_scripts_low [\currentlow ]}\to \everydefinelow
-\appendtoks \setuevalue\currenthigh{\typo_scripts_high[\currenthigh]}\to \everydefinehigh
+\appendtoks \frozen\protected\edefcsname\currentlow \endcsname{\typo_scripts_low [\currentlow ]}\to \everydefinelow
+\appendtoks \frozen\protected\edefcsname\currenthigh\endcsname{\typo_scripts_high[\currenthigh]}\to \everydefinehigh
\protected\def\typo_scripts_low[#1]#2%
{\dontleavehmode
diff --git a/tex/context/base/mkxl/unic-ini.mkxl b/tex/context/base/mkxl/unic-ini.mkxl
index 3fccd2feb..aedfe47ed 100644
--- a/tex/context/base/mkxl/unic-ini.mkxl
+++ b/tex/context/base/mkxl/unic-ini.mkxl
@@ -31,6 +31,6 @@
\permanent\protected\def\unknownchar
{\dontleavehmode\hpack{\vrule\s!width.5\emwidth\s!height\exheight\s!depth\zeropoint}}
-\ifdefined\zwnbsp\else \let\zwnbsp\relax \fi % zerowidthnonbreakablespace
+% \ifdefined\zwnbsp\else \let\zwnbsp\relax \fi % zerowidthnonbreakablespace
\protect \endinput
diff --git a/tex/context/modules/mkiv/s-system-macros.mkxl b/tex/context/modules/mkiv/s-system-macros.mkxl
index c3564f5ea..c6251319d 100644
--- a/tex/context/modules/mkiv/s-system-macros.mkxl
+++ b/tex/context/modules/mkiv/s-system-macros.mkxl
@@ -192,6 +192,8 @@ scanning for alignment specific primitives.
\BC number of flagged macros \NC \NumberOfFlagged \NC \NR
\stoptabulate
+\stoptext
+
\page
% \startMPcalculation
diff --git a/tex/context/sample/third/herbert-es.tex b/tex/context/sample/third/herbert-es.tex
index f3cf751d4..8bcd1b5c1 100644
--- a/tex/context/sample/third/herbert-es.tex
+++ b/tex/context/sample/third/herbert-es.tex
@@ -1,7 +1,7 @@
\startlanguage[es]
\startlines
Dulces nupcias del cielo con la tierra,
-Oh puro dia añil,
+Oh puro día añil,
Llorará tu crepúsculo el rocío,
Pues tendrás que morir.
diff --git a/tex/context/sample/third/pope-es.tex b/tex/context/sample/third/pope-es.tex
index d7fc414de..78166c1fe 100644
--- a/tex/context/sample/third/pope-es.tex
+++ b/tex/context/sample/third/pope-es.tex
@@ -5,19 +5,19 @@ De unas hectáreas del sol paterno,
Feliz quien puede respirar, gozoso,
Su aire nativo.
-Cuyo hato brindale espumosa leche,
+Cuyo hato bríndale espumosa leche,
Pan sus trigales, sus ovejas lana,
Sombra en verano sus frondosos árboles,
Fuego en invierno.
Feliz de aquel que indiferente observa
Cómo las horas se deslizan mansas,
-Sano de cuerpo y con tranquilo espiritu,
+Sano de cuerpo y con tranquilo espíritu,
Día por día.
Quien duerme, plácido, y el estudio alterna
Con el reposo, y ameniza el tiempo,
-Y une a su pura sencillez dulcisimas
+Y une a su pura sencillez dulcísimas
Meditaciones.
Dejad que viva en dulce paz oculto,
diff --git a/tex/context/sample/third/shakespeare-es.tex b/tex/context/sample/third/shakespeare-es.tex
index 1567368f2..eacc54931 100644
--- a/tex/context/sample/third/shakespeare-es.tex
+++ b/tex/context/sample/third/shakespeare-es.tex
@@ -6,7 +6,7 @@ El huracán desflora a su albedrío,
Y el paso del verano es del ave.
La pupila del cielo es harto cálida;
-La faz de oro amenudo palidece;
+La faz de oro a menudo palidece;
La más pura belleza queda pálida,
Pues todo en la Natura descaece.
@@ -16,6 +16,6 @@ Y la muerte en sus sombras ocultarte,
Cuando acabes la senda, no podrá.
Mientras la humanidad no esté extinguida
-Tu estio vivirá y te dará vida.
+Tu estío vivirá y te dará vida.
\stoplines
\stoplanguage
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 66d6d2580..f332a013b 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-01-18 18:15
+-- merge date : 2021-01-21 18:01
do -- begin closure to overcome local limits and interference
@@ -21237,6 +21237,7 @@ local function read_from_otf(specification)
if tfmdata then
tfmdata.properties.name=specification.name
tfmdata.properties.sub=specification.sub
+ tfmdata.properties.id=specification.id
tfmdata=constructors.scale(tfmdata,specification)
local allfeatures=tfmdata.shared.features or specification.features.normal
constructors.applymanipulators("otf",tfmdata,allfeatures,trace_features,report_otf)
@@ -34833,6 +34834,7 @@ local function read_from_afm(specification)
local tfmdata=afmtotfm(specification)
if tfmdata then
tfmdata.properties.name=specification.name
+ tfmdata.properties.id=specification.id
tfmdata=constructors.scale(tfmdata,specification)
local allfeatures=tfmdata.shared.features or specification.features.normal
constructors.applymanipulators("afm",tfmdata,allfeatures,trace_features,report_afm)