Hi Hans,
Thanks. More detail on the three you asked about, with patches for the easy
ones (attached as small-fixes.diff, against 2026.10.01). Line numbers are
from 2026.10.01.
1. --sandbox and MetaPost. You are right, nothing sets mplib to nil by
name. But in a --sandbox run the global mplib is no longer there when the
run statistics are printed. metapost.nofscriptruns() (mlib-mpf.lmt line
305) uses the global mplib at that moment, so the run ends with "attempt to
index a nil value (global 'mplib')" and exit code 1. trac-inf.lmt line 196
already keeps a local copy for this reason. The same line near the top of
mlib-mpf.lmt fixes it (tested: exit 1 without it, 0 with it):
--- a/tex/context/base/mkxl/mlib-mpf.lmt
+++ b/tex/context/base/mkxl/mlib-mpf.lmt
@@ -13,2 +13,3 @@
local concat = table.concat
+local mplib = mplib -- needed for --sandbox
We hit it because all our renders run with --sandbox.
2. Rounded corners. The attached image shows the corner at high zoom:
\framed with corner=round and rulethickness=4pt, at radius=10pt (top) and
radius=1pt (bottom), 2026.10.01 on the left, patched on the right. With
radius=1pt you can see the small notch in the corner. The cause is that
half (in bp) is added to radius (in sp):
--- a/tex/context/base/mkxl/lpdf-rul.lmt
+++ b/tex/context/base/mkxl/lpdf-rul.lmt
@@ -341 +341 @@
- local full = ( radius + half)
+ local full = ( radius + half / bpfactor)
3. The four small ones. None of them is visible; I list them only for
completeness.
- lpdf-emb.lmt line 1399: "if nomimalwidth == 0" tests a misspelled
(undefined) name, so a zero nominalWidthX is never dropped. Only a
redundant default gets written:
--- a/tex/context/base/mkxl/lpdf-emb.lmt
+++ b/tex/context/base/mkxl/lpdf-emb.lmt
@@ -1399 +1399 @@
- if nomimalwidth == 0 then nominalwidth = nil end
+ if nominalwidth == 0 then nominalwidth = nil end
- lpdf-emb.lmt lines 1154 and 1404: BlueScale goes through todictreal,
which formats with %g, so only 6 significant digits are kept.
- font-cff.lmt line 2269: fractional values are written as 16.16 with
floor((k - v1) * 0x10000), which truncates. Rounding would be closer; the
error is at most 1/65536 unit.
- lpdf-emb.lmt lines 1004 and 1734: /StemV is derived from the weight
class, which an AFM-loaded Type 1 font does not have, so the descriptor
gets /StemV 0. pdfTeX writes the font's real value (StdVW).
I left the last three without a patch because how to format the numbers is
your call.
Dax
On Mon, Oct 05, 2026 11:16 AM, Hans Hagen via ntg-context <
[email protected]> wrote:
> On 10/5/2026 12:06 AM, Dax Kelson via ntg-context wrote:
> > Dear Hans,
> >
> > Porting a large document set to LMTX turned up a few small things. As
> > far as I can see they are all still in 2026.10.01:
> >
> > 1. context --sandbox with any MetaPost graphic ends with "mlib-
> > mpf.lmt:291: attempt to index a nil value (global 'mplib')" and exit
> > code 1. The sandbox finalizer sets mplib to nil, and the "metapost"
> > statistic calls metapost.nofscriptruns() at the end of the run. Example:
> > \starttext \startMPcode draw fullcircle scaled 1cm ; \stopMPcode
> \stoptext
>
> afaiks we don't set mplib to nil in lmtx but i'll check anyway
>
> so you're using --sandbox .. it is a bit in flux as it's being more more
> integrated in the engine
>
> > 2. os.timezone() returns "-02:-30" in America/St_Johns (and in any
> > negative zone with minutes). pdftimestamp() then does not match, and /
> > CreationDate and /ModDate are empty. Taking the sign from the difference
> > and formatting the absolute value avoids it; abs(min) alone would still
> > get a -00:30 zone wrong.
>
> ok, i'll fix it
>
> > 3. \setupbackend[space=no] does not switch real spaces off: back-ini.lmt
> > passes v == yes to directives.enable(), which ignores it.
> > \disabledirectives[backends.spaces] works.
>
> idem
> > 4. In lpdf-rul.lmt round(), "full = (radius + half)" adds half the line
> > width in bp to a radius in sp, so rounded fills and frames start their
> > arcs at the radius while the straight sides are inset by half the rule.
> > Example:
> >
> \framed[corner=round,radius=10pt,rulethickness=4pt,width=4cm,height=2cm,background=color,backgroundcolor=gray]{}
>
> hard to see
> > 5. A document whose list entries come only from \writetolist has no
> > section block and gets no bookmarks: bookmarks.place loops over
> > #lists.sectionblocks, which is 0 there (the comment says "always >= 1").
>
> for wolfgang to check
>
> > And four tiny ones, none of them visible: the "nomimalwidth" typo; %g
> > writing BlueScale with 6 digits; fractional charstring operands
> > truncated, not rounded, to 16.16; /StemV 0 for AFM-loaded Type 1 fonts.
>
> fuzzy .. needs more explanation
>
> > Would a directive for UTC dates, and one to leave out
> > pdfx:LuaTeX.Platform, also be acceptable, so that builds on different
> > machines differ only in dates and IDs?
>
> maybe
>
> Hans
>
> -----------------------------------------------------------------
> Hans Hagen | PRAGMA ADE
> Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : [email protected] /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>
--- a/tex/context/base/mkxl/mlib-mpf.lmt
+++ b/tex/context/base/mkxl/mlib-mpf.lmt
@@ -11,6 +11,7 @@
local type, tostring, tonumber, select, loadstring = type, tostring, tonumber,
select, loadstring
local find, gsub = string.find, string.gsub
local concat = table.concat
+local mplib = mplib -- needed for --sandbox
local formatters = string.formatters
local lpegmatch = lpeg.match
--- a/tex/context/base/mkxl/lpdf-rul.lmt
+++ b/tex/context/base/mkxl/lpdf-rul.lmt
@@ -338,7 +338,7 @@
end
else
local method = roundmapping[corner]
- local full = ( radius + half)
+ local full = ( radius + half / bpfactor)
local xxxmin = full * bpfactor
local xxxmax = ( width - full) * bpfactor
local yyymax = ( height - full) * bpfactor
--- a/tex/context/base/mkxl/lpdf-emb.lmt
+++ b/tex/context/base/mkxl/lpdf-emb.lmt
@@ -1396,7 +1396,7 @@
local stemsnapv = cffinfo.stemsnapv
--
if defaultwidth == 0 then defaultwidth = nil end
- if nomimalwidth == 0 then nominalwidth = nil end
+ if nominalwidth == 0 then nominalwidth = nil end
if bluevalues then bluevalues =
todictarray(bluevalues) end
if otherblues then otherblues =
todictarray(otherblues) end
if familyblues then familyblues =
todictarray(familyblues) end
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________