From 705b807c950a697d3c8be592c452a6fb3e561c7e Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Wed, 4 Jan 2023 12:09:26 +0100
Subject: 2023-01-04 11:35:00

---
 tex/context/base/mkii/cont-new.mkii                |   2 +-
 tex/context/base/mkii/context.mkii                 |   2 +-
 tex/context/base/mkii/mult-it.mkii                 |   1 +
 tex/context/base/mkiv/cont-new.mkiv                |   2 +-
 tex/context/base/mkiv/context.mkiv                 |   2 +-
 tex/context/base/mkiv/grph-fil.lua                 |  30 ++++--
 tex/context/base/mkiv/status-files.pdf             | Bin 24610 -> 24596 bytes
 tex/context/base/mkiv/status-lua.pdf               | Bin 264786 -> 264787 bytes
 tex/context/base/mkxl/cont-new.mkxl                |   2 +-
 tex/context/base/mkxl/context.mkxl                 |   2 +-
 tex/context/base/mkxl/driv-shp.lmt                 |   1 +
 tex/context/base/mkxl/font-dsp.lmt                 |  31 +++---
 tex/context/base/mkxl/lpdf-img.lmt                 |   2 +
 tex/context/base/mkxl/math-ini.mkxl                |  22 ++--
 tex/context/base/mkxl/mlib-fnt.lmt                 | 120 +++++++++++++++------
 tex/context/base/mkxl/mlib-lmp.lmt                 |  17 +--
 tex/context/base/mkxl/mlib-pps.lmt                 |  28 +++--
 tex/context/base/mkxl/pack-lyr.mkxl                |   2 +-
 tex/context/base/mkxl/spac-ver.mkxl                |   9 +-
 tex/context/base/mkxl/strc-flt.mklx                |   4 +
 tex/context/base/mkxl/typo-shp.mkxl                |   5 +-
 tex/context/interface/mkii/keys-it.xml             |   1 +
 tex/context/modules/mkxl/m-tikz.mkxl               |  12 +++
 tex/generic/context/luatex/luatex-fonts-merged.lua |   2 +-
 24 files changed, 203 insertions(+), 96 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 5dc828952..e0d82c85c 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{2022.12.29 14:29}
+\newcontextversion{2023.01.04 11:32}
 
 %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 43ba6e35e..d238a096c 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{2022.12.29 14:29}
+\edef\contextversion{2023.01.04 11:32}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii
index cb91a058e..3526f81f1 100644
--- a/tex/context/base/mkii/mult-it.mkii
+++ b/tex/context/base/mkii/mult-it.mkii
@@ -591,6 +591,7 @@
 \setinterfacevariable{temporary}{temporaneo}
 \setinterfacevariable{test}{test}
 \setinterfacevariable{text}{testo}
+\setinterfacevariable{textdisplay}{textdisplay}
 \setinterfacevariable{textnote}{textnote}
 \setinterfacevariable{three}{tre}
 \setinterfacevariable{thursday}{giovedi}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index ff5584f5a..4d1a5f344 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{2022.12.29 14:29}
+\newcontextversion{2023.01.04 11:32}
 
 %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 eecce37d5..6df85ce83 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -49,7 +49,7 @@
 %D {YYYY.MM.DD HH:MM} format.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2022.12.29 14:29}
+\edef\contextversion{2023.01.04 11:32}
 
 %D Kind of special:
 
diff --git a/tex/context/base/mkiv/grph-fil.lua b/tex/context/base/mkiv/grph-fil.lua
index 4de30cd30..afb303acd 100644
--- a/tex/context/base/mkiv/grph-fil.lua
+++ b/tex/context/base/mkiv/grph-fil.lua
@@ -49,12 +49,12 @@ job.register('job.files.collected', tobesaved, initializer)
 local contextrunner = sandbox.registerrunner {
     name     = "hashed context run",
     program  = "context",
-    template = [[%options% %?path: --runpath=%path% ?% %filename%]],
+    template = [[%options% %?path: --path=%path% ?% %?runpath: --runpath=%runpath% ?% %filename%]],
     checkers = {
         options  = "string",
         filename = "readable",
         path     = "string",
-     -- runpath  = "string",
+        runpath  = "string",
     }
 }
 
@@ -73,12 +73,17 @@ function jobfiles.run(action)
     if filename and filename ~= "" then
         local result      = action.result
         local runner      = action.runner or contextrunner
+        local path        = action.path
+if not isfile(filename) and path and path ~= "" then
+    filename = file.join(path,filename)
+end
         local oldchecksum = collected[filename]
         local newchecksum = checksum(filename)
+-- print(filename,oldchecksum,newchecksum)
         local tobedone    = false
         local forcerun    = action.forcerun or jobfiles.forcerun
         if not result then
-            result = replacesuffix(usedname,resultsuffix)
+            result = replacesuffix(filename,resultsuffix)
             action.result = result
         end
         if forcerun then
@@ -144,20 +149,27 @@ local function analyzed(name,options)
     local usedname   = addsuffix(name,inputsuffix)      -- we assume tex if not set
     local resultname = replacesuffix(name,resultsuffix) -- we assume tex if not set
     local pathname   = file.pathpart(usedname)
-    local runpath    = environment.arguments.path -- sic, no runpath
-    if pathname ~= "" then
-        if runpath then
-            runpath = file.join(runpath,pathname)
+    local path       = environment.arguments.path -- sic, no runpath
+    local runpath    = environment.arguments.runpath
+    local resultname = replacesuffix(name,resultsuffix) -- we assume tex if not set
+    if runpath and runpath ~= "" then
+        -- not really needed but probably more robust for local leftovers
+        resultname = file.join(runpath,file.basename(resultname))
+    end
+    if path ~= "" then
+        if path then
+            path = file.join(path,pathname)
         else
-            runpath = pathname
+            path = pathname
         end
         usedname = file.basename(usedname)
     end
     return {
         options  = options,
-        path     = runpath, -- or nil
+        path     = path,
         filename = usedname,
         result   = resultname,
+        runpath  = runpath,
     }
 end
 
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 653a9e73b..f634b088d 100644
Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 8c0f230e1..e46cc1d23 100644
Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index a35ab8489..1a0c93600 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{2022.12.29 14:29}
+\newcontextversion{2023.01.04 11:32}
 
 %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 152850f03..af85d279a 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{2022.12.29 14:29}
+\immutable\edef\contextversion{2023.01.04 11:32}
 
 %overloadmode 1 % check frozen / warning
 %overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index 9a37ccf8a..7bc2f54c5 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -240,6 +240,7 @@ local flush_character do
                     csy = sy
                 end
                 -- here no current!
+             -- return flushcharacter(false,pos_h,pos_v,pos_r,fnt,chr,nil,csx,csy,factor,sx,sy)
                 return flush_character(false,fnt,chr,factor,nest,pos_h,pos_v,pos_r,csx,csy)
             else
                 return 0
diff --git a/tex/context/base/mkxl/font-dsp.lmt b/tex/context/base/mkxl/font-dsp.lmt
index 0cb05786b..1b54bf463 100644
--- a/tex/context/base/mkxl/font-dsp.lmt
+++ b/tex/context/base/mkxl/font-dsp.lmt
@@ -1186,25 +1186,30 @@ local function chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nof
             rules  = rules,
         }
     elseif subtype == 3 then
+        -- Maybe this one needs checking. Anyway zero current is bad.
         local before     = readarray(f)
         local current    = readarray(f)
         local after      = readarray(f)
         local noflookups = readushort(f)
-        local lookups    = readlookuparray(f,noflookups,#current)
-        before  = readcoveragearray(f,tableoffset,before,true)
-        current = readcoveragearray(f,tableoffset,current,true)
-        after   = readcoveragearray(f,tableoffset,after,true)
-        return {
-            format = "coverage",
-            rules  = {
-                {
-                    before  = before,
-                    current = current,
-                    after   = after,
-                    lookups = lookups,
+        local lookups    = current and readlookuparray(f,noflookups,#current)
+        if lookups then
+            before  = readcoveragearray(f,tableoffset,before,true)
+            current = readcoveragearray(f,tableoffset,current,true)
+            after   = readcoveragearray(f,tableoffset,after,true)
+            return {
+                format = "coverage",
+                rules  = {
+                    {
+                        before  = before,
+                        current = current,
+                        after   = after,
+                        lookups = lookups,
+                    }
                 }
             }
-        }
+        else
+            report("confusing subtype %a in %a %s",subtype,"chainedcontext",what)
+        end
     else
         report("unsupported subtype %a in %a %s",subtype,"chainedcontext",what)
     end
diff --git a/tex/context/base/mkxl/lpdf-img.lmt b/tex/context/base/mkxl/lpdf-img.lmt
index df658c236..c241ccdb7 100644
--- a/tex/context/base/mkxl/lpdf-img.lmt
+++ b/tex/context/base/mkxl/lpdf-img.lmt
@@ -1181,6 +1181,7 @@ do
             Filter           = filter,
             ColorSpace       = palette or pdfconstant(colorspace),
             Length           = #content,
+-- Decode = pdfarray { 0, .5, 0, .5, 0, .5 } -- darker (test for luatex list)
         } + specification.attr
         if mask then
             local d = pdfdictionary {
@@ -1190,6 +1191,7 @@ do
                 Height           = ysize,
                 BitsPerComponent = palette and 8 or colordepth,
                 ColorSpace       = pdfconstant("DeviceGray"),
+-- Decode = pdfarray { 0, .5, 0, .5, 0, .5 }, -- lighter (test for luatex list)
             }
             xobject.SMask = pdfreference(pdfflushstreamobject(mask,d()))
         end
diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl
index 8880956af..b007a64d1 100644
--- a/tex/context/base/mkxl/math-ini.mkxl
+++ b/tex/context/base/mkxl/math-ini.mkxl
@@ -1234,28 +1234,28 @@
   % \inherited\setmathspacing \mathclosecode           \mathradicalcode         \allmathstyles    \zeromuskip
     %
     \inherited\setmathspacing \mathpunctuationcode     \mathordinarycode        \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathordinarycode        \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathordinarycode        \allunsplitstyles \tinymuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathoperatorcode        \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathoperatorcode        \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathoperatorcode        \allunsplitstyles \tinymuskip
   % \inherited\setmathspacing \mathpunctuationcode     \mathbinarycode          \allmathstyles    \zeromuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathrelationcode        \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathrelationcode        \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathrelationcode        \allunsplitstyles \tinymuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathopencode            \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathopencode            \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathopencode            \allunsplitstyles \tinymuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathmiddlecode          \allsplitstyles   \thickmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathmiddlecode          \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathmiddlecode          \allunsplitstyles \tinymuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathclosecode           \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathclosecode           \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathclosecode           \allunsplitstyles \tinymuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathpunctuationcode     \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathpunctuationcode     \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathpunctuationcode     \allunsplitstyles \tinymuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathconstructcode       \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathconstructcode       \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathconstructcode       \allunsplitstyles \tinymuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathellipsiscode        \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathellipsiscode        \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathellipsiscode        \allunsplitstyles \tinymuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathfractioncode        \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathfractioncode        \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathfractioncode        \allunsplitstyles \tinymuskip
     \inherited\setmathspacing \mathpunctuationcode     \mathradicalcode         \allsplitstyles   \medmuskip
-    \inherited\setmathspacing \mathpunctuationcode     \mathradicalcode         \allunsplitstyles \thinmuskip
+    \inherited\setmathspacing \mathpunctuationcode     \mathradicalcode         \allunsplitstyles \tinymuskip
     %
     \inherited\setmathspacing \mathconstructcode       \mathordinarycode        \allsplitstyles   \thinmuskip
     \inherited\setmathspacing \mathconstructcode       \mathordinarycode        \allunsplitstyles \pettymuskip
diff --git a/tex/context/base/mkxl/mlib-fnt.lmt b/tex/context/base/mkxl/mlib-fnt.lmt
index e53ded38a..3209b2ee6 100644
--- a/tex/context/base/mkxl/mlib-fnt.lmt
+++ b/tex/context/base/mkxl/mlib-fnt.lmt
@@ -260,41 +260,44 @@ end
 -- right time. It's probably why I like watching https://www.youtube.com/watch?v=c5FqpddnJmc
 -- so much: precisely (and perfectly) timed too.
 
-local texgetbox        = tex.getbox
+local texgetbox          = tex.getbox
 
-local nodecodes        = nodes.nodecodes -- no nuts yet
-local rulecodes        = nodes.rulecodes
+local nodecodes          = nodes.nodecodes -- no nuts yet
+local rulecodes          = nodes.rulecodes
 
-local rule_code        = nodecodes.rule
+local rule_code          = nodecodes.rule
 
-local normalrule_code  = rulecodes.normal
-local outlinerule_code = rulecodes.outline
-local userrule_code    = rulecodes.user
-local emptyrule_code   = rulecodes.empty
+local normalrule_code    = rulecodes.normal
+local outlinerule_code   = rulecodes.outline
+local userrule_code      = rulecodes.user
+local emptyrule_code     = rulecodes.empty
 
-local nuts             = nodes.nuts
-local getwhd           = nuts.getwhd
-local getexpansion     = nuts.getexpansion
-local getscales        = nuts.getscales
-local isglyph          = nuts.isglyph
+local nuts               = nodes.nuts
+----- getwhd             = nuts.getwhd
+local getexpansion       = nuts.getexpansion
+local getscales          = nuts.getscales
+local isglyph            = nuts.isglyph
+local getglyphdimensions = nuts.getglyphdimensions
 
-local fonthashes       = fonts.hashes
-local fontcharacters   = fonthashes.characters
-local fontparameters   = fonthashes.parameters
-local fontshapes       = fonthashes.shapes
-local fontdescriptions = fonthashes.descriptions
+local fonthashes         = fonts.hashes
+local fontcharacters     = fonthashes.characters
+local fontparameters     = fonthashes.parameters
+local fontshapes         = fonthashes.shapes
+local fontdescriptions   = fonthashes.descriptions
 
-local topaths          = metapost.paths
+local topaths            = metapost.paths
 
-local f_text           = formatters["mfun_do_outline_text_flush(%q,%i,%N,%N,%q)(%,t);"]
-local f_rule           = formatters["mfun_do_outline_rule_flush(%q,%N,%N,%N,%N);"]
-local f_bounds         = formatters["checkbounds(%N,%N,%N,%N);"]
-local s_nothing        = "(origin scaled 10)"
+local f_text             = formatters["mfun_do_outline_text_flush(%q,%i,%N,%N,%q)(%,t);"]
+local f_rule             = formatters["mfun_do_outline_rule_flush(%q,%N,%N,%N,%N);"]
+local f_bounds           = formatters["checkbounds(%N,%N,%N,%N);"]
+local s_nothing          = "(origin scaled 10)"
 
-local sc               = 10
-local fc               = number.dimenfactors.bp
+local sc                 = 10
+local fc                 = number.dimenfactors.bp
 
-local function glyph(kind,font,char,advance,shift,ex,s, sx,sy)
+-- handle compact mode here:
+
+local function glyph(kind,font,char,advance,shift,ex,s,sx,sy)
     local character = fontcharacters[font][char]
     if character then
         local index = character.index
@@ -312,10 +315,20 @@ local function glyph(kind,font,char,advance,shift,ex,s, sx,sy)
                     local exfactor = ex or 0
                     local wfactor  = 1
                     local detail   = kind == "p" and tostring(char) or ""
+                    -- what about other effects
+                    local xoffset  = character.xoffset or 0
+                    local yoffset  = character.yoffset or 0 -- todo
+                    --
                     if exfactor ~= 0 then
                         wfactor = (1+(ex/units)/1000)
                         xfactor = xfactor * wfactor
                     end
+                    if xoffset ~= 0 then
+                        advance = advance + s * sx * xoffset * fc / 1000000
+                    end
+                    if yoffset ~= 0 then
+                        shift = shift + s * sy * yoffset * fc / 1000000
+                    end
                     if s then
                         xfactor = (s/1000) * ((sx or 1000)/1000) * xfactor
                         yfactor = (s/1000) * ((sy or 1000)/1000) * yfactor
@@ -342,16 +355,57 @@ local function reset()
 end
 
 local function flushcharacter(current, pos_h, pos_v, pod_r, font, char)
-    local char, font = isglyph(current)
-    local s, sx, sy = getscales(current)
-    local code = glyph(kind,font,char,pos_h*fc,pos_v*fc,getexpansion(current),s,sx,sy)
-    if code then
-        b = b + 1
-        buffer[b] = code
+    if current then
+        local char, font = isglyph(current)
+        local s, sx, sy = getscales(current)
+        local code = glyph(kind,font,char,pos_h*fc,pos_v*fc,getexpansion(current),s,sx,sy)
+        if code then
+            b = b + 1
+            buffer[b] = code
+        end
+    else
+        logs.report("mlib-fnt","check 'flushcharacter', no current")
     end
 end
 
-local function flushrule(current, pos_h, pos_v, pos_r, size_h, size_v, subtype)
+-- Messy ... todo:
+
+-- local function flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,csx,csy,factor,ssx,ssy)
+--     local width, height, depth, sx, sy
+--     if current then
+--         char, font = isglyph(current)
+--         width, height, depth, factor, sx, sy = getglyphdimensions(current)
+--     else
+--         if not data then
+--             data = fontcharacters[font][char] or { }
+--         end
+--         width  = data.width or 0
+--         height = data.height or 0
+--         depth  = data.depth or 0
+--         sx = 1
+--         sy = 1
+--     end
+--     if csx then
+--         sx = sx * csx
+--     end
+--     if csy then
+--         sy = sy * csy
+--     end
+--     if ssx then
+--         sx = sx * ssx
+--     end
+--     if ssy then
+--         sy = sy * ssy
+--     end
+--     local code = glyph(kind,font,char,pos_h*fc,pos_v*fc,factor,s,sx,sy)
+--     if code then
+--         b = b + 1
+--         buffer[b] = code
+--     end
+--     return width, height, depth
+-- end
+
+local function flushrule(current,pos_h,pos_v,pos_r,size_h,size_v,subtype)
     if subtype == normalrule_code then
         b = b + 1
         buffer[b] = f_rule(kind,pos_h*fc,pos_v*fc,size_h*fc,size_v*fc)
diff --git a/tex/context/base/mkxl/mlib-lmp.lmt b/tex/context/base/mkxl/mlib-lmp.lmt
index a6d17dd2c..db23fcede 100644
--- a/tex/context/base/mkxl/mlib-lmp.lmt
+++ b/tex/context/base/mkxl/mlib-lmp.lmt
@@ -216,14 +216,19 @@ do
         end
     end)
 
-    --
+    -- older:
 
-    local mpprint  = mp.print
-    local mpquoted = mp.quoted
-    local getmacro = tokens.getters.macro
+    registerscript("texvar", function()
+        if not expandtex(unknown_value,"mpcategoryparameter",true,scanstring()) then
+            injectnumeric(0)
+        end
+    end)
 
-    registerscript("texvar", function() mpprint (getmacro(metapost.namespace .. scanstring())) end)
-    registerscript("texstr", function() mpquoted(getmacro(metapost.namespace .. scanstring())) end)
+    registerscript("texstr", function()
+        if not expandtex(string_value,"mpcategoryparameter",true,scanstring()) then
+            injectstring("")
+        end
+    end)
 
 end
 
diff --git a/tex/context/base/mkxl/mlib-pps.lmt b/tex/context/base/mkxl/mlib-pps.lmt
index fbb507a3f..209656fbe 100644
--- a/tex/context/base/mkxl/mlib-pps.lmt
+++ b/tex/context/base/mkxl/mlib-pps.lmt
@@ -1362,16 +1362,24 @@ end
 local function ps_process(object,prescript,before,after)
     local ps_label = prescript.ps_label
     if ps_label then
-        local op     = object.path
-        local first  = op[1]
-        local third  = op[3]
-        local x      = first.x_coord
-        local y      = first.y_coord
-        local w      = third.x_coord - x
-        local h      = third.y_coord - y
-        local properties = metapost.properties
-        x = x - properties.llx
-        y = properties.ury - y
+        local op    = object.path
+        local first = op[1]
+        local third = op[3]
+        local x, y, w, h
+        if first and third then
+            local properties = metapost.properties
+            x = first.x_coord
+            y = first.y_coord
+            w = third.x_coord - x
+            h = third.y_coord - y
+            x = x - properties.llx
+            y = properties.ury - y
+        else
+            x = 0
+            y = 0
+            w = 0
+            h = 0
+        end
         before[#before+1] = function()
             context.MPLIBpositionwhd(ps_label,x,y,w,h)
         end
diff --git a/tex/context/base/mkxl/pack-lyr.mkxl b/tex/context/base/mkxl/pack-lyr.mkxl
index a3dd301c2..b93d32960 100644
--- a/tex/context/base/mkxl/pack-lyr.mkxl
+++ b/tex/context/base/mkxl/pack-lyr.mkxl
@@ -661,7 +661,7 @@
 %
       \pack_layers_bottom_fill}%
    % \edef\currentlayer{#2}% :\the\realpageno}% local .. check \anchor
-   % \edef\p_pack_layers_position{\layerparameter\c!position}% local
+   \edef\p_pack_layers_position{\layerparameter\c!position}% local
    \ifx\p_pack_layers_position\v!yes
      \edef\p_pack_layers_region{\layerparameter\c!region}%
      \ifempty\p_pack_layers_region\else
diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl
index 2b16e42ee..89632bd84 100644
--- a/tex/context/base/mkxl/spac-ver.mkxl
+++ b/tex/context/base/mkxl/spac-ver.mkxl
@@ -2420,20 +2420,23 @@
 \tolerant\protected\def\spac_textdisplay_start#1#:[#2]%
   {\par
    \begingroup
+   \whitespace
+   \forgetall
    \edef\currenttextdisplay{#1}%
    \setupcurrenttextdisplay[#2]%
    \textdisplayparameter\c!before
-   \dbox
+   \dpack
    \bgroup
    \strut
    \vskip-\lineheight
-   \vbox
+   \vpack
    \s!yoffset -\textdisplayparameter\c!factor\strutdp
    \bgroup}
 
 \protected\def\spac_textdisplay_stop
   {\egroup
-   \vskip-\lineheight\strut
+   \vskip-\lineheight
+   \strut
    \egroup
    \textdisplayparameter\c!after
    \endgroup
diff --git a/tex/context/base/mkxl/strc-flt.mklx b/tex/context/base/mkxl/strc-flt.mklx
index 40c627b2c..1f2aeaae5 100644
--- a/tex/context/base/mkxl/strc-flt.mklx
+++ b/tex/context/base/mkxl/strc-flt.mklx
@@ -679,8 +679,12 @@
 %D We abuse the settings to pick up some float parameters too which makes it
 %D messy.
 
+%D Do we need a \setuplayout here (kind of costly) in case we mix multi page text
+%D with a side float and less height.
+
 \permanent\tolerant\protected\def\startplacefloat[#tag]#spacer[#settings]#spacer[#userdata]%
   {\flushnotes
+  %\setuplayout
    \page_otr_command_flush_side_floats % here !
    \strc_floats_begin_group
    \strc_floats_set_current_tag{#tag}%
diff --git a/tex/context/base/mkxl/typo-shp.mkxl b/tex/context/base/mkxl/typo-shp.mkxl
index e6bc143c1..12d3c0115 100644
--- a/tex/context/base/mkxl/typo-shp.mkxl
+++ b/tex/context/base/mkxl/typo-shp.mkxl
@@ -190,7 +190,7 @@
      \dontcomplain
      \setuptolerance[\v!verytolerant,\v!stretch]% default
    % \setuplayout[\c!grid=\v!yes]% goes wrong, we need a local one
-     \pushparagraphtweak {shift}}
+     \pushparagraphtweak{shift}}
 
 \permanent\protected\def\stopshapetext
   {\popparagraphtweak
@@ -223,7 +223,7 @@
 %    \fi
 %    \egroup}
 
-\pushoverloadmode\permanent\protected\def\getshapetext
+\permanent\protected\def\getshapetext
   {\vbox\bgroup
    \forgetall
    \dontcomplain
@@ -251,5 +251,4 @@
    \fi
    \egroup}
 
-
 \protect
diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml
index 92dbfde4c..ffffb9611 100644
--- a/tex/context/interface/mkii/keys-it.xml
+++ b/tex/context/interface/mkii/keys-it.xml
@@ -594,6 +594,7 @@
 		<cd:variable name='temporary' value='temporaneo'/>
 		<cd:variable name='test' value='test'/>
 		<cd:variable name='text' value='testo'/>
+		<cd:variable name='textdisplay' value='textdisplay'/>
 		<cd:variable name='textnote' value='textnote'/>
 		<cd:variable name='three' value='tre'/>
 		<cd:variable name='thursday' value='giovedi'/>
diff --git a/tex/context/modules/mkxl/m-tikz.mkxl b/tex/context/modules/mkxl/m-tikz.mkxl
index 394709c3c..3d6c649d6 100644
--- a/tex/context/modules/mkxl/m-tikz.mkxl
+++ b/tex/context/modules/mkxl/m-tikz.mkxl
@@ -40,6 +40,8 @@
   {\pushoverloadmode
    \pushcatcodetable
    \setcatcodetable\texcatcodes
+   \pushmacro\meaning
+   \let\meaning\meaningless
    \catcode`\@=11
    \catcode`\|=12
    \catcode`\!=12
@@ -48,6 +50,7 @@
 \permanent\protected\def\stoptikzinput
   {\autoparagraphmode\plusone
    \popcatcodetable
+   \popmacro\meaning
    \popoverloadmode}
 
 \permanent\protected\def\tikzinputfile#1%
@@ -66,16 +69,21 @@
 
 \permanent\protected\def\starttikzsettings
   {\pushoverloadmode
+   \pushmacro\meaning
+   \let\meaning\meaningless
    \autoparagraphmode\zerocount}
 
 \permanent\protected\def\stoptikzsettings
   {\autoparagraphmode\plusone
+   \popmacro\meaning
    \popoverloadmode}
 
 \permanent\protected\def\starttikzpicture
   {\dontleavehmode
    \hcontainer\bgroup
    \autoparagraphmode\zerocount
+   \pushmacro\meaning
+   \let\meaning\meaningless
  % \pushoverloadmode
    \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi
    \tikzpicture}
@@ -83,6 +91,7 @@
 \permanent\protected\def\stoptikzpicture
   {\endtikzpicture
  % \popoverloadmode
+   \popmacro\meaning
    \egroup}
 
 \let\pgfdefined    \relax
@@ -125,4 +134,7 @@
 \usepgfmodule[matrix]
 \usepgfmodule[decorations]
 
+\definefilesynonym [pgfplots]      [tikz-pgfplots]
+\definefilesynonym [pgfplotstable] [tikz-pgfplotstable]
+
 \stopmodule
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 60c5485fe..df0e9399b 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  : 2022-12-29 14:29
+-- merge date  : 2023-01-04 11:32
 
 do -- begin closure to overcome local limits and interference
 
-- 
cgit v1.2.3