summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2021-05-31 14:38:45 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2021-05-31 14:38:45 +0200
commit316fec3fcb4b5e6f352a3a58db1656e08659202c (patch)
tree29cbe6e3e21a683e586edeae37e277af1b075017 /tex
parentc1f664df24bd6c6d1222d479e2f0f88856685990 (diff)
downloadcontext-316fec3fcb4b5e6f352a3a58db1656e08659202c.tar.gz
2021-05-31 14:12:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-pe.mkii3
-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/lxml-ini.lua51
-rw-r--r--tex/context/base/mkiv/lxml-tex.lua4
-rw-r--r--tex/context/base/mkiv/mult-def.lua3
-rw-r--r--tex/context/base/mkiv/mult-fun.lua2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin23940 -> 23957 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin229594 -> 229993 bytes
-rw-r--r--tex/context/base/mkiv/syst-lua.lua4
-rw-r--r--tex/context/base/mkxl/anch-loc.lmt372
-rw-r--r--tex/context/base/mkxl/anch-loc.mkxl108
-rw-r--r--tex/context/base/mkxl/cldf-bas.lmt247
-rw-r--r--tex/context/base/mkxl/cldf-bas.mkxl14
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl4
-rw-r--r--tex/context/base/mkxl/driv-shp.lmt95
-rw-r--r--tex/context/base/mkxl/driv-shp.mkxl1
-rw-r--r--tex/context/base/mkxl/driv-usr.lmt393
-rw-r--r--tex/context/base/mkxl/luat-log.lmt4
-rw-r--r--tex/context/base/mkxl/pack-rul.lmt8
-rw-r--r--tex/context/base/mkxl/pack-rul.mkxl239
-rw-r--r--tex/context/base/mkxl/page-ini.mkxl15
-rw-r--r--tex/context/base/mkxl/page-ins.mkxl58
-rw-r--r--tex/context/base/mkxl/strc-mat.mkxl4
-rw-r--r--tex/context/base/mkxl/syst-ini.mkxl170
-rw-r--r--tex/context/base/mkxl/toks-scn.lmt4
-rw-r--r--tex/context/interface/mkii/keys-pe.xml3
-rw-r--r--tex/context/modules/mkiv/x-mathml.mkiv186
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
32 files changed, 1621 insertions, 383 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 84c5862ab..7ab6e4160 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.05.27 14:12}
+\newcontextversion{2021.05.31 14:09}
%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 f84ac0910..f04382825 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.05.27 14:12}
+\edef\contextversion{2021.05.31 14:09}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii
index 9b19ce661..4eed24cd9 100644
--- a/tex/context/base/mkii/mult-pe.mkii
+++ b/tex/context/base/mkii/mult-pe.mkii
@@ -141,6 +141,7 @@
\setinterfacevariable{chemistry}{chemistry}
\setinterfacevariable{cite}{cite}
\setinterfacevariable{closed}{closed}
+\setinterfacevariable{collapsed}{collapsed}
\setinterfacevariable{color}{رنگ}
\setinterfacevariable{column}{ستون}
\setinterfacevariable{columns}{ستونها}
@@ -392,6 +393,7 @@
\setinterfacevariable{nostopper}{nostopper}
\setinterfacevariable{not}{بدون}
\setinterfacevariable{notation}{notation}
+\setinterfacevariable{notcollapsed}{notcollapsed}
\setinterfacevariable{note}{note}
\setinterfacevariable{nothanging}{بدون‌آویزان‌کردن}
\setinterfacevariable{nothyphenated}{بدون‌شکست}
@@ -1263,6 +1265,7 @@
\setinterfaceconstant{symbolset}{مجموعه‌نماد}
\setinterfaceconstant{symcolor}{رنگ‌نماد}
\setinterfaceconstant{symstyle}{سبک‌نماد}
+\setinterfaceconstant{synchronize}{synchronize}
\setinterfaceconstant{synonym}{مترادف}
\setinterfaceconstant{synonymcolor}{رنگ‌مترادف}
\setinterfaceconstant{synonymcommand}{synonymcommand}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 98a99ad06..2a6b72405 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.05.27 14:12}
+\newcontextversion{2021.05.31 14:09}
%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 f6324f7f0..88000966e 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.05.27 14:12}
+\edef\contextversion{2021.05.31 14:09}
%D Kind of special:
diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua
index 43643f71a..43bc3efc8 100644
--- a/tex/context/base/mkiv/lxml-ini.lua
+++ b/tex/context/base/mkiv/lxml-ini.lua
@@ -154,6 +154,57 @@ implement { name = "xmlstoptiming", actions = function() statistics.stopt
implement { name = "xmlloadentities", actions = characters.registerentities, onceonly = true }
+if CONTEXTLMTXMODE > 0 then
+
+ local boolean_code = tokens.values.boolean
+
+ local getid = lxml.getid
+ local found = xml.found
+ local empty = xml.empty
+ local checkedempty = xml.checkedempty
+
+ implement {
+ name = "ifxml",
+ public = true,
+ usage = "condition",
+ arguments = "2 arguments",
+ actions = function(id,pattern)
+ return boolean_code, found(getid(id),pattern) and true
+ end
+ }
+
+ implement {
+ name = "ifxmltext",
+ public = true,
+ usage = "condition",
+ arguments = "2 arguments",
+ actions = function(id,pattern)
+ return boolean_code, not empty(getid(id),pattern) and true
+ end
+ }
+
+ implement {
+ name = "ifxmlempty",
+ public = true,
+ usage = "condition",
+ arguments = "2 arguments",
+ actions = function(id,pattern)
+ return boolean_code, not checkedempty(getid(id),pattern) and true
+ end
+ }
+
+ implement {
+ name = "ifxmlselfempty",
+ public = true,
+ usage = "condition",
+ arguments = "argument",
+ actions = function(id)
+ return boolean_code, not checkedempty(getid(id)) and true
+ end
+ }
+
+end
+
-- kind of special (3rd argument is a function)
commands.xmlsetfunction = lxml.setaction
diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua
index 73ad1b684..75bd9b84c 100644
--- a/tex/context/base/mkiv/lxml-tex.lua
+++ b/tex/context/base/mkiv/lxml-tex.lua
@@ -2328,6 +2328,8 @@ do
end
end
+ xml.checkedempty = checkedempty
+
function lxml.doifempty (id,pattern) doif (checkedempty(id,pattern)) end
function lxml.doifnotempty (id,pattern) doifnot (checkedempty(id,pattern)) end
function lxml.doifelseempty(id,pattern) doifelse(checkedempty(id,pattern)) end
@@ -2733,6 +2735,8 @@ do
end
+-- hm, maybe to ini to, these implements
+
implement {
name = "xmlsetinjectors",
actions = xml.setinjectors,
diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua
index 2bcfdf74c..c097f2419 100644
--- a/tex/context/base/mkiv/mult-def.lua
+++ b/tex/context/base/mkiv/mult-def.lua
@@ -11961,6 +11961,9 @@ return {
["en"]="surnamesep",
["fr"]="seprenom",
},
+ ["synchronize"]={
+ ["en"]="synchronize",
+ },
["svgstyle"]={
["en"]="svgstyle",
["fr"]="stylesvg",
diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua
index 9fc125bcd..1b774afa3 100644
--- a/tex/context/base/mkiv/mult-fun.lua
+++ b/tex/context/base/mkiv/mult-fun.lua
@@ -37,6 +37,8 @@ return {
"pushparameters",
"popparameters",
"definecolor",
+ --
+ "anchorxy", "anchorx", "anchory",
},
commands = {
"loadfile", "loadimage", "loadmodule",
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index bfff547ae..08ce08e1b 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 7180e25c2..4eed9795d 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/syst-lua.lua b/tex/context/base/mkiv/syst-lua.lua
index 1bd20214a..fa980aa76 100644
--- a/tex/context/base/mkiv/syst-lua.lua
+++ b/tex/context/base/mkiv/syst-lua.lua
@@ -191,7 +191,9 @@ implement {
do
- local result = { "return " }
+ local result = CONTEXTLMTXMODE > 0 and
+ { "local xmath = xmath local xcomplex = xcomplex return " }
+ or { "local xmath = math local xcomplex = { } return " }
local word = { }
local r = 1
local w = 0
diff --git a/tex/context/base/mkxl/anch-loc.lmt b/tex/context/base/mkxl/anch-loc.lmt
new file mode 100644
index 000000000..d16ff94a4
--- /dev/null
+++ b/tex/context/base/mkxl/anch-loc.lmt
@@ -0,0 +1,372 @@
+if not modules then modules = { } end modules ['anch-loc'] = {
+ version = 1.001,
+ comment = "companion to anch-loc.lmtx",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local next, type = next, type
+local setmetatableindex, sortedhash, insert, remove = table.setmetatableindex, table.sortedhash, table.insert, table.remove
+
+local context = context
+
+local nuts = nodes.nuts
+local nodepool = nodes.pool
+local whatever = nodepool.userids["localanchor"]
+local new_usernode = nodepool.usernode
+local new_kern = nuts.pool.kern
+local getbox = nuts.getbox
+local getwidth = nuts.getwidth
+local setwidth = nuts.setwidth
+local getprop = nuts.getprop
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
+local setattributelist = nuts.setattributelist
+
+local texgetbox = tex.getbox
+
+local implement = interfaces.implement
+
+local analyze = drivers.converters.analyze
+
+local dimension_value = tokens.values.dimension
+
+local v_left = interfaces.variables.left
+local v_middle = interfaces.variables.middle
+
+local positionsstack = setmetatableindex("table")
+
+local function allocate2(t,k)
+ local v = { min = false, max = false }
+ t[k] = v
+ return v
+end
+
+local function allocate1(t,k)
+ local v = setmetatableindex({ cnt = { }, min = false, max = false }, allocate2)
+ t[k] = v
+ return v
+end
+
+local positions = setmetatableindex(allocate1)
+
+-- The basics:
+
+local function pushpositions()
+ insert(positionsstack,positions)
+ positions = setmetatableindex(allocate1)
+end
+
+local function poppositions()
+ positions = remove(positionsstack) or { }
+end
+
+local function initializepositions(driver,specification)
+ -- positions.width = specification.boundingbox[3]
+ -- positions.height = specification.boundingbox[4]
+end
+
+-- local function finalizepositions(...)
+-- end
+
+local function collectpositions(current,pos_h,pos_v)
+ -- beware, we actually can have a copy due to setting trialrun so we cannot
+ -- fetch the nodetable directly but go via the metatable ... fast enough
+ local data = getprop(current,"data")
+ local hash = positions[data.name]
+ local x = data.x
+ local y = data.y
+ if not hash.min then
+ hash.min = x
+ hash.max = x
+ elseif x > hash.max then
+ hash.max = x
+ end
+ hash = hash[x]
+ if not hash.min then
+ hash.min = y
+ hash.max = y
+ elseif y > hash.max then
+ hash.max = y
+ end
+ hash[y] = { pos_h, pos_v, data, current, 0, false }
+end
+
+local function valid(name,x,y)
+ if positions then
+ local xlist = positions[name]
+ if xlist then
+ xlist = xlist[x]
+ return xlist and xlist[y]
+ end
+ end
+end
+
+local function anchorx(name,x,y)
+ local v = valid(name,x,y)
+ return v and v[1] or 0
+end
+
+local function anchory(name,x,y)
+ local v = valid(name,x,y)
+ return v and v[2] or 0
+end
+
+local function anchorxy(name,x,y)
+ local v = valid(name,x,y)
+ if v then
+ return v[1], v[2]
+ else
+ return 0, 0
+ end
+end
+
+local driver = {
+ actions = {
+ initialize = initializepositions,
+ -- finalize = finalizepositions,
+ },
+ flushers = {
+ userdefined = {
+ [whatever] = collectpositions,
+ }
+ }
+}
+
+function drivers.converters.resyncbox(n)
+ local b = getbox(n)
+ analyze(driver,b)
+ for name, position in next, positions do
+ local xlast = { }
+ local aligned = false
+ for c=position.min,position.max do
+ local column = position[c]
+ if column then
+ local min = column.min
+ if min then
+ local max = column.max
+ local xlimit = 0
+ for r=min,max do
+ local cell = column[r]
+ if cell and cell[3].kind == "sync" then
+ local x = cell[1]
+ local l = xlast[r]
+ if l and l ~= 0 then
+ x = x + l
+ cell[1] = x
+ end
+ if x > xlimit then
+ xlimit = x
+ end
+ if not aligned then
+ aligned = cell[3].align
+ end
+ end
+ end
+ for r=min,max do
+ local cell = column[r]
+ if cell and cell[3].kind == "sync" then
+ local progress = xlimit - cell[1]
+ if aligned or progress ~= 0 then
+ local kern = new_kern(progress)
+ local current = cell[4]
+ setattributelist(kern,current)
+ insertafter(current,current,kern) -- why does before not work
+ cell[5] = progress
+ cell[6] = kern
+ xlast[r] = (xlast[r] or 0) + progress
+ end
+ end
+ end
+ end
+ end
+ end
+
+ if aligned then
+ local min = position.min
+ local max = position.max
+ local previous = { }
+ for c=min,max do
+ local column = position[c]
+ if column then
+ local min = column.min
+ if min then
+ local max = column.max
+ for r=min,max do
+ local cell = column[r]
+ if cell then
+ local prev = previous[r]
+ if prev then
+ local align = prev[3].align
+ if align then
+ local p = prev[6]
+ local n = cell[6]
+ local d = cell[5]
+ if align == "r" or align == v_right then
+ setwidth(p,getwidth(p)+d)
+ setwidth(n,getwidth(n)-d)
+ elseif align == "c" or align == "m" or align == v_middle then
+ setwidth(p,getwidth(p)+d/2)
+ setwidth(n,getwidth(n)-d/2)
+ end
+ end
+ end
+ previous[r] = cell
+ end
+ end
+ end
+ end
+ end
+ end
+
+ end
+ return b
+end
+
+-- The ConTeXt interface (at that end we call them localanchors):
+
+implement {
+ name = "pushlocalanchors",
+ public = true,
+ protected = true,
+ actions = pushpositions,
+}
+
+implement {
+ name = "poplocalanchors",
+ public = true,
+ protected = true,
+ actions = poppositions,
+}
+
+implement {
+ name = "analyzelocalanchors",
+ arguments = { "integerargument" },
+ public = true,
+ protected = true,
+ actions = function(n)
+ analyze(driver,texgetbox(n))
+ end
+}
+
+implement {
+ name = "synchronizelocalanchors",
+ arguments = { "integerargument" },
+ public = true,
+ protected = true,
+ actions = drivers.converters.resyncbox,
+}
+
+implement {
+ name = "setlocalsyncanchor",
+ arguments = { "argument", "integerargument", "integerargument" },
+ public = true,
+ protected = true,
+ usage = "value",
+ actions = function(name,x,y)
+ -- value node ... only hlist or vlist or whatsit but we need trialmode so:
+ context(new_usernode(whatever,{ name = name, kind = "sync", x = x, y = y }))
+ end
+}
+implement {
+ name = "setlocalalignanchor",
+ arguments = { "argument", "integerargument", "integerargument", "argument" },
+ public = true,
+ protected = true,
+ usage = "value",
+ actions = function(name,x,y,align)
+ -- value node ... only hlist or vlist or whatsit but we need trialmode so:
+ context(new_usernode(whatever,{ name = name, kind = "sync", x = x, y = y, align = align }))
+ end
+}
+
+implement {
+ name = "setlocalmarkanchor",
+ arguments = { "argument", "integerargument", "integerargument" },
+ public = true,
+ protected = true,
+ usage = "value",
+ actions = function(name,x,y)
+ context(new_usernode(whatever,{ name = name, kind = "mark", x = x, y = y }))
+ end
+}
+
+implement {
+ name = "localanchorx",
+ arguments = { "argument", "integerargument", "integerargument" },
+ public = true,
+ usage = "value",
+ actions = function(name,x,y)
+ return dimension_value, anchorx(name,x,y)
+ end
+}
+
+implement {
+ name = "localanchory",
+ arguments = { "argument", "integerargument", "integerargument" },
+ public = true,
+ usage = "value",
+ actions = function(name,x,y)
+ return dimension_value, anchory(name,x,y)
+ end
+}
+
+interfaces.implement {
+ name = "sync",
+ arguments = { "argument", "integerargument" },
+ protected = true,
+ public = true,
+ actions = function(name,x)
+ local t = positions[name].cnt
+ local y = (t[x] or 0) + 1
+ t[x] = y
+ context(new_usernode(whatever,{ name = name, kind = "sync", x = x, y = y }))
+ end,
+}
+
+interfaces.implement {
+ name = "async",
+ arguments = { "argument", "integerargument", "argument" },
+ protected = true,
+ public = true,
+ actions = function(name,x,align)
+ local t = positions[name].cnt
+ local y = (t[x] or 0) + 1
+ t[x] = y
+ context(new_usernode(whatever,{ name = name, kind = "sync", x = x, y = y, align = align }))
+ end,
+}
+
+-- The MetaFun interface:
+
+do
+
+ local injectors = mp.inject
+ local scanners = mp.scan
+
+ local injectnumeric = injectors.numeric
+ local injectpair = injectors.pair
+
+ local scaninteger = scanners.integer
+ local scanstring = scanners.string
+
+ local bpfactor = number.dimenfactors.bp
+
+ local registerscript = metapost.registerscript
+ local registerdirect = metapost.registerdirect
+
+ registerscript("anchorxy", function()
+ x, y = anchorxy(scanstring(),scaninteger(),scaninteger())
+ return injectpair(x*bpfactor, y*bpfactor)
+ end)
+
+ registerdirect("anchorx", function()
+ return anchorx(scanstring(),scaninteger(),scaninteger()) * bpfactor
+ end)
+
+ registerdirect("anchory", function()
+ return anchory(scanstring(),scaninteger(),scaninteger()) * bpfactor
+ end)
+
+end
diff --git a/tex/context/base/mkxl/anch-loc.mkxl b/tex/context/base/mkxl/anch-loc.mkxl
new file mode 100644
index 000000000..eef2ba09d
--- /dev/null
+++ b/tex/context/base/mkxl/anch-loc.mkxl
@@ -0,0 +1,108 @@
+%D \module
+%D [ file=anch-loc,
+%D version=2021.05.27,
+%D title=\CONTEXT\ Anchoring Macros,
+%D subtitle=Local Positioning Support,
+%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.
+
+\writestatus{loading}{ConTeXt Anchoring Macros / Local Positioning}
+
+%D This is a typical \LMTX\ feature that could have been provided in \MKIV\ but I
+%D never finished it there. In \LMTX\ we have already a bit better infrastructure
+%D for it.
+%D
+%D When watching the brilliant positive yt videos of Yoyoka Soma (よよか) drum
+%D performances one realizes that a covers can improve the original. Let's see if
+%D this module can improve some of the position related mechanisms. (Btw, quite
+%D often covers impress me more than originals I'd never list too anyway.)
+
+% todo:
+%
+% - make box fit and inject glue
+% - set height / depth or just insert something between
+
+\registerctxluafile{anch-loc}{autosuffix}
+
+\unprotect
+
+\aliased\let\syncanchor \gobblethreearguments
+\aliased\let\alignanchor\gobblefourarguments
+\aliased\let\markanchor \gobblethreearguments
+
+\permanent\protected\def\anch_local_withanchor_s #1#2#3{\leftboundary\setlocalsyncanchor {#1} #2 #3\rightboundary}
+\permanent\protected\def\anch_local_withanchor_a#1#2#3#4{\leftboundary\setlocalalignanchor{#1} #2 #3{#4}\rightboundary}
+\permanent\protected\def\anch_local_withanchor_m #1#2#3{\leftboundary\setlocalmarkanchor {#1} #2 #3\rightboundary}
+
+\permanent\protected\def\setlocalanchoring
+ {\enforced\let\syncanchor \anch_local_withanchor_s
+ \enforced\let\alignanchor\anch_local_withanchor_a
+ \enforced\let\markanchor \anch_local_withanchor_m}
+
+\aliased\let\stopanchoring\relax
+
+\permanent\protected\def\startanchoring#1\stopanchoring % todo: boundary
+ {\begingroup
+ \pushlocalanchors
+ \setlocalanchoring
+ \setbox\scratchbox\vbox{\settrialtypesetting#1}%
+ \analyzelocalanchors\scratchbox
+ \vbox{#1}%
+ \poplocalanchors
+ \endgroup}
+
+\aliased\let\stopsynchronizing\relax
+
+\permanent\protected\def\startsynchronizing#1\stopsynchronizing % todo: boundary
+ {\begingroup
+ \pushlocalanchors
+ \setlocalanchoring
+ \setbox\scratchbox\vbox{#1}%
+ \synchronizelocalanchors\scratchbox
+ \unvbox\scratchbox
+ \poplocalanchors
+ \endgroup}
+
+% variant on \sync (defined at the lua end)
+
+\permanent\protected\def\autosync#1#2{\leftboundary\sync{#1}{#2}\rightboundary}
+
+% \startsynchronizing
+% $a = a + a $\par
+% $a \mathsnc{1}= a + a $\par
+% $ \mordsnc{1}= a + a + a $\par
+% $ \mordsnc{1}= a \mathsnc{2}+ a + a + a$\par
+% $ \mordsnc{1} \mordsnc{2}+ a + a + a$
+% \stopsynchronizing
+
+\permanent\protected\def\mathsync#1{\sync{m}{#1}}
+\permanent\protected\def\mordsync#1{\mathord{}\sync{m}{#1}}
+\permanent\protected\def\mrelsync#1{\mathrel{}\sync{m}{#1}}
+\permanent\protected\def\mbinsync#1{\mathbin{}\sync{m}{#1}}
+
+\setlocalanchoring
+
+%D These are defined at the \LUA\ end.
+%D
+%D \starttyping
+%D \pushlocalanchors
+%D \poplocalanchors
+%D \analyzelocalanchors
+%D \synchronizelocalanchors
+%D \setlocalsyncanchor {name} x y | {name} {x} {y}
+%D \setlocalmarkanchor {name} x y | {name} {x} {y}
+%D \localanchorx {name} x y | {name} {x} {y}
+%D \localanchory {name} x y | {name} {x} {y}
+%D \sync {name} x | {name} {x}
+%D \stoptyping
+
+% \permanent\def\anchorxy#1#2#3{(\todimension\localanchorx{#1} #2 #3,\todimension\localanchory{#1} #2 #3)}
+
+\protect \endinput
+
+% Musical timestamp: Nightwish Decades bluray in loop mode.
diff --git a/tex/context/base/mkxl/cldf-bas.lmt b/tex/context/base/mkxl/cldf-bas.lmt
new file mode 100644
index 000000000..6fc6e03a4
--- /dev/null
+++ b/tex/context/base/mkxl/cldf-bas.lmt
@@ -0,0 +1,247 @@
+if not modules then modules = { } end modules ['cldf-bas'] = {
+ version = 1.001,
+ comment = "companion to cldf-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- -- speedtest needed:
+--
+-- local flush, writer = context.getlogger()
+--
+-- trackers.register("context.trace",function(v)
+-- flush, writer = context.getlogger()
+-- end)
+--
+-- function context.bgroup()
+-- flush(ctxcatcodes,"{")
+-- end
+--
+-- function context.egroup()
+-- flush(ctxcatcodes,"}")
+-- end
+
+local tonumber = tonumber
+local type = type
+local format = string.format
+local utfchar = utf.char
+local concat = table.concat
+
+local context = context
+local ctxcore = context.core
+
+local variables = interfaces.variables
+
+local ctx_flushnode = context.nuts.flush
+local ctx_sprint = context.sprint
+local txtcatcodes = tex.txtcatcodes
+
+local nuts = nodes.nuts
+local tonode = nuts.tonode
+local nodepool = nuts.pool
+local new_rule = nodepool.rule
+local new_glyph = nodepool.glyph
+local new_latelua = nodepool.latelua
+
+local setattrlist = nuts.setattrlist
+
+local texgetcount = tex.getcount
+local texsetcount = tex.setcount
+local texchardef = tex.chardef
+local expandmacro = token.expandmacro
+
+local is_letter = characters.is_letter
+
+-- a set of basic fast ones
+
+function context.setfontid(n)
+ -- isn't there a setter?
+ context("\\setfontid%i\\relax",n)
+end
+
+function context.char(k) -- used as escape too, so don't change to utf
+ if type(k) == "table" then
+ local n = #k
+ if n == 1 then
+ context([[\char%s\relax]],k[1])
+ elseif n > 0 then
+ context([[\char%s\relax]],concat(k,[[\relax\char]]))
+ end
+ else
+ if type(k) == "string" then
+ k = tonumber(k)
+ end
+ if type(k) == "number" then
+ context([[\char%s\relax]],k)
+ end
+ end
+end
+
+function context.safechar(c)
+ if characters.is_letter[c] then -- not yet loaded
+ ctx_sprint(c)
+ else
+ ctx_sprint(txtcatcodes,c)
+ end
+end
+
+function context.utfchar(k)
+ if type(k) == "string" then
+ k = tonumber(k)
+ end
+ if type(k) == "number" then
+ context(utfchar(k))
+ end
+end
+
+function context.rule(w,h,d,direction)
+ local rule
+ if type(w) == "table" then
+ rule = new_rule(w.width,w.height,w.depth,w.direction)
+ else
+ rule = new_rule(w,h,d,direction)
+ end
+ setattrlist(rule,true)
+ context(tonode(rule))
+ -- ctx_flushnode(tonode(rule))
+end
+
+function context.glyph(id,k)
+ if id then
+ if not k then
+ id, k = true, id
+ end
+ local glyph = new_glyph(id,k)
+ setattrlist(glyph,true)
+ context(tonode(glyph))
+ -- ctx_flushnode(tonode(glyph))
+ end
+end
+
+-- local function ctx_par () context("\\par") end
+-- local function ctx_space() context("\\space") end
+
+local ctx_par = context.cs.par
+local ctx_space = context.cs.space
+
+context.par = ctx_par
+context.space = ctx_space
+
+ctxcore.par = ctx_par
+ctxcore.space = ctx_space
+
+-- local function ctx_bgroup() context("{") end
+-- local function ctx_egroup() context("}") end
+
+local ctx_bgroup = context.cs.bgroup
+local ctx_egroup = context.cs.egroup
+
+context.bgroup = ctx_bgroup
+context.egroup = ctx_egroup
+
+ctxcore.bgroup = ctx_bgroup
+ctxcore.egroup = ctx_egroup
+
+-- not yet used ... but will get variant at the tex end as well
+
+local function setboxregister(kind,n)
+ context(type(n) == "number" and [[\setbox%s\%s]] or [[\setbox\%s\%s]],n,kind)
+end
+
+function ctxcore.sethboxregister(n) setboxregister("hbox",n) end
+function ctxcore.setvboxregister(n) setboxregister("vbox",n) end
+function ctxcore.setvtopregister(n) setboxregister("vtop",n) end
+
+local function startboxregister(kind,n)
+ context(type(n) == "number" and [[\setbox%s\%s{]] or [[\setbox\%s\%s{]],n,kind)
+end
+
+function ctxcore.starthboxregister(n) startboxregister("hbox",n) end
+function ctxcore.startvboxregister(n) startboxregister("vbox",n) end
+function ctxcore.startvtopregister(n) startboxregister("vtop",n) end
+
+ctxcore.stophboxregister = ctx_egroup
+ctxcore.stopvboxregister = ctx_egroup
+ctxcore.stopvtopregister = ctx_egroup
+
+function ctxcore.flushboxregister(n)
+ context(type(n) == "number" and [[\box%s ]] or [[\box\%s]],n)
+end
+
+-- function ctxcore.beginhbox() context([[\hbox\bgroup]]) end
+-- function ctxcore.beginvbox() context([[\vbox\bgroup]]) end
+-- function ctxcore.beginvtop() context([[\vtop\bgroup]]) end
+
+local ctx_hbox = context.cs.hbox
+local ctx_vbox = context.cs.vbox
+local ctx_vtop = context.cs.vtop
+
+function ctxcore.beginhbox() ctx_hbox() ctx_bgroup() end
+function ctxcore.beginvbox() ctx_vbox() ctx_bgroup() end
+function ctxcore.beginvtop() ctx_vtop() ctx_bgroup() end
+
+ctxcore.endhbox = ctx_egroup -- \egroup
+ctxcore.endvbox = ctx_egroup -- \egroup
+ctxcore.endvtop = ctx_egroup -- \egroup
+
+local function allocate(name,what,cmd)
+ local a = format("c_syst_last_allocated_%s",what)
+ local n = texgetcount(a) + 1
+ if n <= texgetcount("c_syst_max_allocated_register") then
+ texsetcount(a,n)
+ end
+ context("\\global\\expandafter\\%sdef\\csname %s\\endcsname %s\\relax",cmd or what,name,n)
+ return n
+end
+
+context.registers = {
+ newdimen = function(name) expandmacro("syst_new_dimen", true,name) return texgetcount("c_syst_last_allocated_dimen") end,
+ newskip = function(name) expandmacro("syst_new_skip", true,name) return texgetcount("c_syst_last_allocated_skip" ) end,
+ newcount = function(name) expandmacro("syst_new_count", true,name) return texgetcount("c_syst_last_allocated_count") end,
+ newmuskip = function(name) expandmacro("syst_new_muskip",true,name) return texgetcount("c_syst_last_allocated_muskip") end,
+ newtoks = function(name) expandmacro("syst_new_toks", true,name) return texgetcount("c_syst_last_allocated_toks") end,
+ newbox = function(name) expandmacro("syst_new_box", true,name) return texgetcount("c_syst_last_allocated_box") end,
+ -- not really a register but kind of belongs here
+ newchar = texchardef,
+}
+
+function context.latelua(f)
+ -- table check moved elsewhere
+ local latelua = new_latelua(f)
+ setattrlist(latelua,true) -- will become an option
+ ctx_flushnode(latelua,true)
+end
+
+do
+
+ local NC = ctxcore.NC
+ local BC = ctxcore.BC
+ local NR = ctxcore.NR
+
+ context.nc = setmetatable({ }, {
+ __call =
+ function(t,...)
+ NC()
+ return context(...)
+ end,
+ __index =
+ function(t,k)
+ NC()
+ return context[k]
+ end,
+ }
+ )
+
+ function context.bc(...)
+ BC()
+ return context(...)
+ end
+
+ function context.nr(...)
+ NC()
+ NR()
+ end
+
+end
+
diff --git a/tex/context/base/mkxl/cldf-bas.mkxl b/tex/context/base/mkxl/cldf-bas.mkxl
index 962db5209..ab801e411 100644
--- a/tex/context/base/mkxl/cldf-bas.mkxl
+++ b/tex/context/base/mkxl/cldf-bas.mkxl
@@ -13,7 +13,19 @@
\writestatus{loading}{ConTeXt Lua Documents / Basics}
-\registerctxluafile{cldf-bas}{}
+\unprotect
+
+\permanent\protected\def\syst_new_dimen #1{\expandafter\newdimen \csname#1\endcsname}
+\permanent\protected\def\syst_new_skip #1{\expandafter\newskip \csname#1\endcsname}
+\permanent\protected\def\syst_new_count #1{\expandafter\newcount \csname#1\endcsname}
+\permanent\protected\def\syst_new_muskip#1{\expandafter\newmuskip\csname#1\endcsname}
+\permanent\protected\def\syst_new_toks #1{\expandafter\newtoks \csname#1\endcsname}
+\permanent\protected\def\syst_new_box #1{\expandafter\newbox \csname#1\endcsname}
+\permanent\protected\def\syst_new_char #1{\expandafter\chardef \csname#1\endcsname}
+
+\protect
+
+\registerctxluafile{cldf-bas}{autosuffix}
\registerctxluafile{cldf-prs}{}
\endinput
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 31dac9413..0444caf4f 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.05.27 14:12}
+\newcontextversion{2021.05.31 14:09}
%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 6a327faf1..67be93764 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.05.27 14:12}
+\immutable\edef\contextversion{2021.05.31 14:09}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -560,6 +560,8 @@
\loadmkxlfile{driv-shp}
+\loadmkxlfile{anch-loc} % for now here (after driver)
+
\loadmkxlfile{back-exp}
\loadmkxlfile{back-pdf}
\loadmkxlfile{back-mps}
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index 3b865492f..65221abf5 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -14,7 +14,6 @@ local formatters = string.formatters
local concat = table.concat
local keys = table.keys
local sortedhash = table.sortedhash
-local splitstring = string.split
local find = string.find
local stripstring = string.strip
local sequenced = table.sequenced
@@ -28,7 +27,6 @@ local getdirection = nuts.getdirection
local getlist = nuts.getlist
local getoffsets = nuts.getoffsets
local getorientation = nuts.getorientation
-local getfield = nuts.getfield
local getwhd = nuts.getwhd
local getkern = nuts.getkern
local getheight = nuts.getheight
@@ -40,28 +38,21 @@ local getid = nuts.getid
local getleader = nuts.getleader
----- getglue = nuts.getglue
local getshift = nuts.getshift
-local getdata = nuts.getdata
------ getexpansion = nuts.getexpansion
local getreplace = nuts.getreplace
local setreplace = nuts.setreplace
local getfont = nuts.getfont
local getkerndimension = nuts.getkerndimension
local setdirection = nuts.setdirection
-local setfield = nuts.setfield
local setlink = nuts.setlink
local isglyph = nuts.isglyph
-local nextdir = nuts.traversers.dir
+----- nextdir = nuts.traversers.dir
local nextnode = nuts.traversers.node
------ rangedimensions = nuts.rangedimensions
local effectiveglue = nuts.effectiveglue
------ startofpar = nuts.startofpar
local dirdimensions = nuts.dirdimensions
-local texget = tex.get
-
local fonthashes = fonts.hashes
local fontdata = fonthashes.identifiers
local characters = fonthashes.characters
@@ -70,7 +61,6 @@ local parameters = fonthashes.parameters
local nodecodes = nodes.nodecodes
local whatsitcodes = nodes.whatsitcodes
local gluecodes = nodes.gluecodes
-local dircodes = nodes.dircodes
local dirvalues = nodes.dirvalues
local subtypes = nodes.subtypes
@@ -87,8 +77,6 @@ local disc_code = nodecodes.disc
local math_code = nodecodes.math
local rule_code = nodecodes.rule
local whatsit_code = nodecodes.whatsit
------ penalty_code = nodecodes.penalty
------ boundary_code = nodecodes.boundary
local leaders_code = gluecodes.leaders
local cleaders_code = gluecodes.cleaders
@@ -99,10 +87,9 @@ local spaceskip_code = gluecodes.spaceskip
local getpagedimensions = layouts.getpagedimensions
-local drivers = drivers
-local instances = drivers.instances
+local drivers = drivers
-local report = logs.reporter("drivers")
+local report = logs.reporter("drivers")
---------------------------------------------------------------------------------------
@@ -110,7 +97,6 @@ local lastfont = nil
local fontcharacters = nil
local magicconstants = tex.magicconstants
-local trueinch = magicconstants.trueinch
local maxdimen = magicconstants.maxdimen
local running = magicconstants.running
@@ -119,15 +105,10 @@ local pos_v = 0
local pos_r = lefttoright_code
local shippingmode = "none"
-local abs_max_v = 0
-local abs_max_h = 0
-
local shipbox_h = 0
local shipbox_v = 0
local page_size_h = 0
local page_size_v = 0
------ page_h_origin = 0 -- trueinch
------ page_v_origin = 0 -- trueinch
local initialize
local finalize
@@ -571,8 +552,6 @@ local function reset_state()
shippingmode = "none"
page_size_h = 0
page_size_v = 0
- -- page_h_origin = 0 -- trueinch
- -- page_v_origin = 0 -- trueinch
end
-- local function dirstackentry(t,k)
@@ -642,6 +621,8 @@ local hlist_out, vlist_out do
return ot, x + xoffset, y - yoffset
end
+ drivers.applyanchor = applyanchor
+
-- to be checked: begin- or enddir kan nil zijn, weird
-- local function calculate_width_to_enddir(this_box,begindir) -- can be a helper
@@ -678,7 +659,7 @@ local hlist_out, vlist_out do
boxdepth = getwhd(this_box)
local cur_h = 0
- local cur_v = 0
+ -- local cur_v = 0
-- if not current then
-- current = getlist(this_box)
@@ -696,13 +677,14 @@ local hlist_out, vlist_out do
else
pos_h = ref_h + (cur_h + x_offset)
end
- pos_v = ref_v - (cur_v - y_offset)
+ -- pos_v = ref_v - (cur_v - y_offset)
+ pos_v = ref_v + y_offset
-- synced
end
pos_v = pos_v + raise
pos_h = pos_h - left
local wd = flush_character(current,font,char,false,true,pos_h,pos_v,pos_r)
- cur_h = cur_h + wd - right
+ cur_h = cur_h + wd - right -- hm, no left here?
elseif id == glue_code then
local gluewidth = effectiveglue(current,this_box)
if gluewidth ~= 0 then
@@ -862,7 +844,8 @@ local hlist_out, vlist_out do
else
pos_h = ref_h + (cur_h + basepoint_h)
end
- pos_v = ref_v - (cur_v + basepoint_v)
+ -- pos_v = ref_v - (cur_v + basepoint_v)
+ pos_v = ref_v - basepoint_v
-- synced
pushorientation(orientation,pos_h,pos_v,pos_r)
if id == vlist_code then
@@ -913,6 +896,7 @@ local hlist_out, vlist_out do
flushrule(current,pos_h + xoffset,pos_v + yoffset,pos_r,width,total,subtype)
end
end
+ -- move into above if
cur_h = cur_h + width
elseif id == math_code then
-- local kern = getkern(current)
@@ -932,7 +916,7 @@ local hlist_out, vlist_out do
ref_h = ds.ref_h
ref_v = ds.ref_v
cur_h = ds.cur_h
- cur_v = ds.cur_v
+ -- cur_v = ds.cur_v
else
-- pardir
end
@@ -946,7 +930,7 @@ local hlist_out, vlist_out do
if enddir ~= current then
dirstack[enddir] = {
cur_h = new_h,
- cur_v = cur_v,
+ -- cur_v = cur_v,
ref_h = ref_h,
ref_v = ref_v,
}
@@ -957,12 +941,13 @@ local hlist_out, vlist_out do
else
pos_h = ref_h + cur_h
end
- pos_v = ref_v - cur_v
+ -- pos_v = ref_v - cur_v
+ pos_v = ref_v
-- synced
ref_h = pos_h
ref_v = pos_v
cur_h = 0
- cur_v = 0
+ -- cur_v = 0
pos_r = dir
goto synced
end
@@ -993,7 +978,8 @@ local hlist_out, vlist_out do
else
pos_h = ref_h + cur_h
end
- pos_v = ref_v - cur_v
+ -- pos_v = ref_v - cur_v
+ pos_v = ref_v
::synced::
end
pos_h = ref_h
@@ -1011,15 +997,16 @@ local hlist_out, vlist_out do
boxheight,
boxdepth = getwhd(this_box)
- local cur_h = 0
+ local cur_h = 0 -- needs checking .. needed ?
local cur_v = - boxheight
local top_edge = cur_v
- if pos_r == righttoleft_code then
- pos_h = ref_h - cur_h
- else
- pos_h = ref_h + cur_h
- end
+ -- if pos_r == righttoleft_code then
+ -- pos_h = ref_h - cur_h
+ -- else
+ -- pos_h = ref_h + cur_h
+ -- end
+ pos_h = ref_h
pos_v = ref_v - cur_v
-- synced
@@ -1274,26 +1261,8 @@ function drivers.converters.lmtx(driver,box,smode,objnum,specification)
local total = height + depth
- ----- v_offset_par = 0
- ----- h_offset_par = 0
-
- local max_v = total -- + v_offset_par
- local max_h = width -- + h_offset_par
-
- if height > maxdimen or depth > maxdimen or width > maxdimen then
- goto DONE
- end
-
- if max_v > maxdimen then
- goto DONE
- elseif max_v > abs_max_v then
- abs_max_v = max_v
- end
-
- if max_h > maxdimen then
+ if height > maxdimen or depth > maxdimen or width > maxdimen or total > maxdimen then
goto DONE
- elseif max_h > abs_max_h then
- abs_max_h = max_h
end
if shippingmode == "page" then
@@ -1332,11 +1301,11 @@ function drivers.converters.lmtx(driver,box,smode,objnum,specification)
else
- page_size_h = width
- page_size_v = total
- pos_r = getdirection(box)
- pos_v = depth
- pos_h = pos_r == righttoleft_code and width or 0
+ page_size_h = width
+ page_size_v = total
+ pos_r = getdirection(box)
+ pos_v = depth
+ pos_h = pos_r == righttoleft_code and width or 0
end
diff --git a/tex/context/base/mkxl/driv-shp.mkxl b/tex/context/base/mkxl/driv-shp.mkxl
index 52da9d2b5..6364d6dc4 100644
--- a/tex/context/base/mkxl/driv-shp.mkxl
+++ b/tex/context/base/mkxl/driv-shp.mkxl
@@ -12,6 +12,7 @@
%C details.
\registerctxluafile{driv-shp}{autosuffix}
+\registerctxluafile{driv-usr}{autosuffix}
\unprotect
diff --git a/tex/context/base/mkxl/driv-usr.lmt b/tex/context/base/mkxl/driv-usr.lmt
new file mode 100644
index 000000000..e9d24b3c2
--- /dev/null
+++ b/tex/context/base/mkxl/driv-usr.lmt
@@ -0,0 +1,393 @@
+if not modules then modules = { } end modules ['driv-shp'] = {
+ version = 1.001,
+ optimize = true,
+ comment = "companion to driv-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local nuts = nodes.nuts
+local tonut = nodes.tonut
+
+local getdirection = nuts.getdirection
+local getlist = nuts.getlist
+local getoffsets = nuts.getoffsets
+local getorientation = nuts.getorientation
+local getwhd = nuts.getwhd
+local getkern = nuts.getkern
+local getwidth = nuts.getwidth
+local getheight = nuts.getheight
+local getdepth = nuts.getdepth
+local getnext = nuts.getnext
+local getid = nuts.getid
+local getshift = nuts.getshift
+local getprop = nuts.getprop
+local getreplace = nuts.getreplace
+local setreplace = nuts.setreplace
+----- getkerndimension = nuts.getkerndimension
+----- getglyphdimensions = nuts.getglyphdimensions
+
+local setdirection = nuts.setdirection
+local setlink = nuts.setlink
+
+local nextnode = nuts.traversers.node
+
+local effectiveglue = nuts.effectiveglue
+local dirdimensions = nuts.dirdimensions
+
+local nodecodes = nodes.nodecodes
+local whatsitcodes = nodes.whatsitcodes
+local dirvalues = nodes.dirvalues
+
+local lefttoright_code = dirvalues.lefttoright
+local righttoleft_code = dirvalues.righttoleft
+
+local glyph_code = nodecodes.glyph
+local kern_code = nodecodes.kern
+local glue_code = nodecodes.glue
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+local dir_code = nodecodes.dir
+local disc_code = nodecodes.disc
+local math_code = nodecodes.math
+local rule_code = nodecodes.rule
+local whatsit_code = nodecodes.whatsit
+
+local userdefined_code = nodes.whatsitcodes.userdefined
+
+local drivers = drivers
+
+local report = logs.reporter("drivers")
+
+local magicconstants = tex.magicconstants
+local maxdimen = magicconstants.maxdimen
+
+local pos_h = 0
+local pos_v = 0
+local pos_r = lefttoright_code
+
+local applyanchor = drivers.applyanchor
+
+local initialize
+local finalize
+local userdefined
+
+local function reset_state()
+ pos_h = 0
+ pos_v = 0
+ pos_r = lefttoright_code
+end
+
+local dirstack = { }
+
+local function reset_dir_stack()
+ dirstack = { }
+end
+
+local function handlewhatsit(current,pos_h,pos_v)
+ local action = userdefined[getprop(current,"id")]
+ if action then
+ action(current,pos_h,pos_v)
+ end
+end
+
+local hlist_out, vlist_out -- todo: some can be combined
+
+hlist_out = function(this_box,current)
+ local ref_h = pos_h
+ local ref_v = pos_v
+ local ref_r = pos_r
+ pos_r = getdirection(this_box)
+ local cur_h = 0
+
+ for current, id, subtype in nextnode, current do
+ if id == glyph_code then -- or id == kern_code
+ local width, factor = getwidth(current,true)
+ if width ~= 0 then
+ if factor ~= 0 then
+ cur_h = cur_h + (1.0 + factor/1000000.0) * width
+ else
+ cur_h = cur_h + width
+ end
+ end
+ elseif id == glue_code then
+ cur_h = cur_h + effectiveglue(current,this_box)
+ elseif id == hlist_code or id == vlist_code then
+ local width, height, depth = getwhd(current)
+ local list = getlist(current)
+ if list then
+ local boxdir = getdirection(current) or lefttoright_code
+ local shift, orientation = getshift(current)
+ if not orientation then
+ local basepoint_h = boxdir ~= pos_r and width or 0
+ if pos_r == righttoleft_code then
+ pos_h = ref_h - (cur_h + basepoint_h)
+ else
+ pos_h = ref_h + (cur_h + basepoint_h)
+ end
+ pos_v = ref_v - shift
+ elseif orientation == 0x1000 then
+ local orientation, xoffset, yoffset = getorientation(current)
+ local basepoint_h = boxdir ~= pos_r and width or 0
+ if pos_r == righttoleft_code then
+ pos_h = ref_h - (cur_h + basepoint_h + xoffset)
+ else
+ pos_h = ref_h + (cur_h + basepoint_h + xoffset)
+ end
+ pos_v = ref_v - (shift - yoffset)
+ else
+ local orientation, xoffset, yoffset, woffset, hoffset, doffset = getorientation(current)
+ local orientation, basepoint_h, basepoint_v = applyanchor(orientation,0,shift,width,height,depth,woffset,hoffset,doffset,xoffset,yoffset)
+ if orientation == 1 then
+ basepoint_h = basepoint_h + doffset
+ if boxdir == pos_r then
+ basepoint_v = basepoint_v - height
+ end
+ elseif orientation == 2 then
+ if boxdir == pos_r then
+ basepoint_h = basepoint_h + width
+ end
+ elseif orientation == 3 then
+ basepoint_h = basepoint_h + hoffset
+ if boxdir ~= pos_r then
+ basepoint_v = basepoint_v - height
+ end
+ end
+ if pos_r == righttoleft_code then
+ pos_h = ref_h - (cur_h + basepoint_h)
+ else
+ pos_h = ref_h + (cur_h + basepoint_h)
+ end
+ pos_v = ref_v - basepoint_v
+ end
+ if id == vlist_code then
+ vlist_out(current,list)
+ else
+ hlist_out(current,list)
+ end
+ end
+ cur_h = cur_h + width
+ elseif id == kern_code then
+ local kern, factor = getkern(current,true)
+ if kern ~= 0 then
+ if factor ~= 0 then
+ cur_h = cur_h + (1.0 + factor/1000000.0) * kern
+ else
+ cur_h = cur_h + kern
+ end
+ end
+ elseif id == rule_code then
+ cur_h = cur_h + getwidth(current)
+ elseif id == math_code then
+ cur_h = cur_h + effectiveglue(current,this_box)
+ elseif id == dir_code then
+ local dir, cancel = getdirection(current)
+ if cancel then
+ local ds = dirstack[current]
+ if ds then
+ ref_h = ds.ref_h
+ ref_v = ds.ref_v
+ cur_h = ds.cur_h
+ end
+ pos_r = dir
+ else
+ local width, enddir = dirdimensions(this_box,current)
+ local new_h = cur_h + width
+ if dir ~= pos_r then
+ cur_h = new_h
+ end
+ if enddir ~= current then
+ dirstack[enddir] = {
+ cur_h = new_h,
+ ref_h = ref_h,
+ ref_v = ref_v,
+ }
+ setdirection(enddir,pos_r)
+ end
+ if pos_r == righttoleft_code then
+ pos_h = ref_h - cur_h
+ else
+ pos_h = ref_h + cur_h
+ end
+ pos_v = ref_v
+ ref_h = pos_h
+ ref_v = pos_v
+ cur_h = 0
+ pos_r = dir
+ goto synced
+ end
+ elseif id == whatsit_code then
+ if subtype == userdefined_code then
+ local action = userdefined[getprop(current,"id")]
+ if action then
+ action(current,pos_h,pos_v)
+ end
+ end
+ elseif id == disc_code then
+ local replace, tail = getreplace(current)
+ if replace then
+ setlink(tail,getnext(current))
+ setlink(current,replace)
+ setreplace(current)
+ end
+ else
+ goto synced
+ end
+ if pos_r == righttoleft_code then
+ pos_h = ref_h - cur_h
+ else
+ pos_h = ref_h + cur_h
+ end
+ pos_v = ref_v
+ ::synced::
+ end
+ pos_h = ref_h
+ pos_v = ref_v
+ pos_r = ref_r
+end
+
+vlist_out = function(this_box,current)
+ local ref_h = pos_h
+ local ref_v = pos_v
+ local ref_r = pos_r
+ pos_r = getdirection(this_box)
+ local cur_v = - getheight(this_box)
+ local top_edge = cur_v
+ pos_h = ref_h
+ pos_v = ref_v - cur_v
+
+ for current, id, subtype in nextnode, current do
+ if id == glue_code then
+ cur_v = cur_v + effectiveglue(current,this_box)
+ elseif id == hlist_code or id == vlist_code then
+ local width, height, depth = getwhd(current)
+ local list = getlist(current)
+ if list then
+ local boxdir = getdirection(current) or lefttoright_code
+ local shift, orientation = getshift(current)
+ if not orientation then
+ if boxdir ~= pos_r then
+ shift = shift + width
+ end
+ if pos_r == righttoleft_code then
+ pos_h = ref_h - shift
+ else
+ pos_h = ref_h + shift
+ end
+ pos_v = ref_v - (cur_v + height)
+ elseif orientation == 0x1000 then
+ local orientation, xoffset, yoffset = getorientation(current)
+ if boxdir ~= pos_r then
+ shift = shift + width
+ end
+ if pos_r == righttoleft_code then
+ pos_h = ref_h - (shift + xoffset)
+ else
+ pos_h = ref_h + (shift + xoffset)
+ end
+ pos_v = ref_v - (cur_v + height - yoffset)
+ else
+ local orientation, xoffset, yoffset, woffset, hoffset, doffset = getorientation(current)
+ local orientation, basepoint_h, basepoint_v = applyanchor(orientation,shift,height,width,height,depth,woffset,hoffset,doffset,xoffset,yoffset)
+ if orientation == 1 then
+ basepoint_h = basepoint_h + width - height
+ basepoint_v = basepoint_v - height
+ elseif orientation == 2 then
+ basepoint_h = basepoint_h + width
+ basepoint_v = basepoint_v + depth - height
+ elseif orientation == 3 then -- weird
+ basepoint_h = basepoint_h + height
+ end
+ if pos_r == righttoleft_code then
+ pos_h = ref_h - basepoint_h
+ else
+ pos_h = ref_h + basepoint_h
+ end
+ pos_v = ref_v - (cur_v + basepoint_v)
+ end
+ if id == vlist_code then
+ vlist_out(current,list)
+ else
+ hlist_out(current,list)
+ end
+ end
+ cur_v = cur_v + height + depth
+ elseif id == kern_code then
+ cur_v = cur_v + getkern(current)
+ elseif id == rule_code then
+ local width, height, depth = getwhd(current)
+ cur_v = cur_v + height + depth
+ elseif id == whatsit_code then
+ if subtype == userdefined_code then
+ local action = userdefined[getprop(current,"id")]
+ if action then
+ action(current,pos_h,pos_v)
+ end
+ end
+ else
+ goto synced
+ end
+ pos_h = ref_h
+ ::synced::
+ end
+ pos_h = ref_h
+ pos_v = ref_v
+ pos_r = ref_r
+end
+
+function drivers.converters.analyze(driver,box)
+
+ if not driver then
+ report("error in converter, no driver")
+ return
+ elseif box then
+ box = tonut(box)
+ else
+ report("error in converter, no box")
+ return
+ end
+
+ local width, height, depth = getwhd(box)
+ local total = height + depth
+
+ if height > maxdimen or depth > maxdimen or width > maxdimen or total > maxdimen then
+ report("error in converter, overflow")
+ return
+ end
+
+ local actions = driver.actions
+ local flushers = driver.flushers
+
+ initialize = actions.initialize
+ finalize = actions.finalize
+
+ userdefined = flushers.userdefined
+
+ reset_dir_stack()
+ reset_state()
+
+ pos_r = getdirection(box)
+ pos_v = depth
+ pos_h = pos_r == righttoleft_code and width or 0
+
+ local details = {
+ boundingbox = { 0, 0, width, total },
+ }
+
+ if initialize then
+ initialize(driver,details)
+ end
+
+ if getid(box) == vlist_code then
+ vlist_out(box,getlist(box))
+ else
+ hlist_out(box,getlist(box))
+ end
+
+ if finalize then
+ finalize(driver,details)
+ end
+
+end
+
diff --git a/tex/context/base/mkxl/luat-log.lmt b/tex/context/base/mkxl/luat-log.lmt
index fe55368f3..ee8ad4fa3 100644
--- a/tex/context/base/mkxl/luat-log.lmt
+++ b/tex/context/base/mkxl/luat-log.lmt
@@ -25,6 +25,7 @@ local datetime = os.date
local openfile = io.open
local writenl = texio.writeselectornl
+local writelf = texio.writeselectorlf
local write = texio.writeselector
local setmetatableindex = table.setmetatableindex
@@ -178,7 +179,8 @@ do
newline = function()
if target then
- writenl(target)
+ writelf(target)
+ -- writenl(target,"")
end
end
diff --git a/tex/context/base/mkxl/pack-rul.lmt b/tex/context/base/mkxl/pack-rul.lmt
index bac21e91c..f81a672d2 100644
--- a/tex/context/base/mkxl/pack-rul.lmt
+++ b/tex/context/base/mkxl/pack-rul.lmt
@@ -73,8 +73,11 @@ directives.register("framed.checkmath",function(v) checkformath = v end) -- expe
-- beware: dir nodes and pseudostruts can end up on lines of their own
-local function doreshapeframedbox(n)
- local box = getbox(n)
+local function doreshapeframedbox(n,resync)
+ if resync then
+ resync = drivers.converters.resyncbox
+ end
+ local box = resync and resync(n) or getbox(n)
local noflines = 0
local nofnonzero = 0
local firstheight = nil
@@ -209,6 +212,7 @@ local function doanalyzeframedbox(n)
end
implement { name = "doreshapeframedbox", actions = doreshapeframedbox, arguments = "integer" }
+implement { name = "doresyncframedbox", actions = doreshapeframedbox, arguments = { "integer", true } }
implement { name = "doanalyzeframedbox", actions = doanalyzeframedbox, arguments = "integer" }
local function maxboxwidth(box)
diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl
index b6a22d894..52c2255fe 100644
--- a/tex/context/base/mkxl/pack-rul.mkxl
+++ b/tex/context/base/mkxl/pack-rul.mkxl
@@ -157,6 +157,7 @@
%\c!anchoring=,
\c!autowidth=\v!yes,
%\c!setups=,
+ \c!synchronize=,
\c!loffset=\zeropoint,
\c!roffset=\zeropoint,
\c!toffset=\zeropoint,
@@ -209,6 +210,7 @@
\let\p_framed_location \empty
\let\p_framed_orientation \empty
\let\p_framed_anchoring \empty
+\let\p_framed_synchronize \empty
\let\p_framed_autowidth \empty
\let\p_framed_franalyze \empty
\let\p_framed_backgroundcorner\empty
@@ -224,6 +226,7 @@
\let\p_framed_rulethickness \empty
\let\p_framed_foregroundcolor \empty
\let\p_framed_setups \empty
+\let\p_framed_synchronize \empty
%D We don't have to stick to a \TEX\ drawn rule, but also can use rounded
%D or even fancier shapes, as we will see later on.
@@ -555,7 +558,10 @@
{\anch_mark_tagged_box\b_framed_normal\m_overlay_region}
\def\pack_framed_add_background
- {\setbox\b_framed_normal\hpack % was vbox % see also *1*
+ {\ifconditional\c_pack_reanchor
+ \analyzelocalanchors\b_framed_normal
+ \fi
+ \setbox\b_framed_normal\hpack % was vbox % see also *1*
{%\pack_framed_forgetall % can be relaxed
\boxmaxdepth\maxdimen
\framedbackgroundoffset\d_framed_backgroundoffset
@@ -596,9 +602,9 @@
%D
%D We predefine two already familiar backgrounds:
-%letvalue{\??overlaybuiltin\v!screen }\pack_framed_background_box_gray
-\letvalue{\??overlaybuiltin\v!color }\pack_framed_background_box_color
-\letvalue{\??overlaybuiltin\v!foreground}\pack_framed_background_box_content % replaces: \defineoverlay[\v!foreground][\foregroundbox]
+%letcsname\??overlaybuiltin\v!screen \endcsname\pack_framed_background_box_gray
+\letcsname\??overlaybuiltin\v!color \endcsname\pack_framed_background_box_color
+\letcsname\??overlaybuiltin\v!foreground\endcsname\pack_framed_background_box_content % replaces: \defineoverlay[\v!foreground][\foregroundbox]
%D We can specify overlays as a comma separated list of overlays, a sometimes
%D handy feature.
@@ -676,21 +682,21 @@
\def\pack_framed_r_rule{\kern-\d_framed_linewidth\vrule\s!width\d_framed_linewidth}
\def\pack_framed_l_rule{\vrule\s!width\d_framed_linewidth\kern-\d_framed_linewidth}
-\letvalue{\??framedtop \v!on \v!on}\pack_framed_t_rule
-\letvalue{\??framedtop \v!off\v!on}\pack_framed_t_rule
-\letvalue{\??framedtop \v!on }\pack_framed_t_rule
+\letcsname\??framedtop \v!on \v!on\endcsname\pack_framed_t_rule
+\letcsname\??framedtop \v!off\v!on\endcsname\pack_framed_t_rule
+\letcsname\??framedtop \v!on \endcsname\pack_framed_t_rule
-\letvalue{\??framedbottom\v!on \v!on}\pack_framed_b_rule
-\letvalue{\??framedbottom\v!off\v!on}\pack_framed_b_rule
-\letvalue{\??framedbottom\v!on }\pack_framed_b_rule
+\letcsname\??framedbottom\v!on \v!on\endcsname\pack_framed_b_rule
+\letcsname\??framedbottom\v!off\v!on\endcsname\pack_framed_b_rule
+\letcsname\??framedbottom\v!on \endcsname\pack_framed_b_rule
-\letvalue{\??framedleft \v!on \v!on}\pack_framed_l_rule
-\letvalue{\??framedleft \v!off\v!on}\pack_framed_l_rule
-\letvalue{\??framedleft \v!on }\pack_framed_l_rule
+\letcsname\??framedleft \v!on \v!on\endcsname\pack_framed_l_rule
+\letcsname\??framedleft \v!off\v!on\endcsname\pack_framed_l_rule
+\letcsname\??framedleft \v!on \endcsname\pack_framed_l_rule
-\letvalue{\??framedright \v!on \v!on}\pack_framed_r_rule
-\letvalue{\??framedright \v!off\v!on}\pack_framed_r_rule
-\letvalue{\??framedright \v!on }\pack_framed_r_rule
+\letcsname\??framedright \v!on \v!on\endcsname\pack_framed_r_rule
+\letcsname\??framedright \v!off\v!on\endcsname\pack_framed_r_rule
+\letcsname\??framedright \v!on \endcsname\pack_framed_r_rule
% no overlapping rules
@@ -699,21 +705,21 @@
\def\pack_framed_r_rules{\kern-\d_framed_linewidth\vrule\s!height\dimexpr\d_framed_target_ht-\d_framed_linewidth\relax\s!depth-\d_framed_linewidth\s!width\d_framed_linewidth}
\def\pack_framed_l_rules{\vrule\s!height\dimexpr\d_framed_target_ht-\d_framed_linewidth\relax\s!depth-\d_framed_linewidth\s!width\d_framed_linewidth\kern-\d_framed_linewidth}
-\letvalue{\??framedtop \v!small\v!small}\pack_framed_t_rules
-\letvalue{\??framedtop \v!off \v!small}\pack_framed_t_rules
-\letvalue{\??framedtop \v!small }\pack_framed_t_rules
+\letcsname\??framedtop \v!small\v!small\endcsname\pack_framed_t_rules
+\letcsname\??framedtop \v!off \v!small\endcsname\pack_framed_t_rules
+\letcsname\??framedtop \v!small \endcsname\pack_framed_t_rules
-\letvalue{\??framedbottom\v!small\v!small}\pack_framed_b_rules
-\letvalue{\??framedbottom\v!off \v!small}\pack_framed_b_rules
-\letvalue{\??framedbottom\v!small }\pack_framed_b_rules
+\letcsname\??framedbottom\v!small\v!small\endcsname\pack_framed_b_rules
+\letcsname\??framedbottom\v!off \v!small\endcsname\pack_framed_b_rules
+\letcsname\??framedbottom\v!small \endcsname\pack_framed_b_rules
-\letvalue{\??framedleft \v!small\v!small}\pack_framed_l_rules
-\letvalue{\??framedleft \v!off \v!small}\pack_framed_l_rules
-\letvalue{\??framedleft \v!small }\pack_framed_l_rules
+\letcsname\??framedleft \v!small\v!small\endcsname\pack_framed_l_rules
+\letcsname\??framedleft \v!off \v!small\endcsname\pack_framed_l_rules
+\letcsname\??framedleft \v!small \endcsname\pack_framed_l_rules
-\letvalue{\??framedright \v!small\v!small}\pack_framed_r_rules
-\letvalue{\??framedright \v!off \v!small}\pack_framed_r_rules
-\letvalue{\??framedright \v!small }\pack_framed_r_rules
+\letcsname\??framedright \v!small\v!small\endcsname\pack_framed_r_rules
+\letcsname\??framedright \v!off \v!small\endcsname\pack_framed_r_rules
+\letcsname\??framedright \v!small \endcsname\pack_framed_r_rules
% \framed
% [width=4cm,height=3cm,rulethickness=3mm,
@@ -1007,6 +1013,33 @@
\aliased\let\localendstrut\relax
\aliased\let\localstrut \relax
+% better a constant:
+
+\newconditional\c_pack_resync
+\newconditional\c_pack_reanchor
+
+% \let\spac_framed_pop_local_anchors\relax
+
+\def\spac_framed_push_local_anchors
+ {\ifx\p_framed_synchronize\v!yes
+ \settrue\c_pack_resync
+ \settrue\c_pack_reanchor
+ \pushlocalanchors
+ % \aftergrouped{\aftergrouped{\poplocalanchors}}%
+ \aftergroup\poplocalanchors
+ \orelse\ifx\p_framed_synchronize\v!text
+ \settrue\c_pack_resync
+ \pushlocalanchors
+ \aftergroup\poplocalanchors
+ \orelse\ifx\p_framed_synchronize\v!background
+ \settrue\c_pack_reanchor
+ \pushlocalanchors
+ \aftergroup\poplocalanchors
+ \else
+ \setfalse\c_pack_resync
+ \setfalse\c_pack_reanchor
+ \fi}
+
\protected\def\pack_framed_process_indeed
{\d_framed_frameoffset\framedparameter\c!frameoffset
\edef\p_framed_backgroundoffset{\framedparameter\c!backgroundoffset}%
@@ -1037,10 +1070,19 @@
\edef\p_framed_location {\framedparameter\c!location}%
\edef\p_framed_orientation{\framedparameter\c!orientation}%
\edef\p_framed_anchoring {\framedparameter\c!anchoring}%
+ \edef\p_framed_synchronize{\framedparameter\c!synchronize}%
%
\edef\p_framed_autowidth {\framedparameter\c!autowidth}%
\edef\p_framed_franalyze {\framedparameter\c!fr!analyze}% experimental option
%
+ \ifempty\p_framed_synchronize
+ \setfalse\c_pack_resync
+ \setfalse\c_pack_reanchor
+% \let\spac_framed_pop_local_anchors\relax
+ \else
+ \spac_framed_push_local_anchors
+ \fi
+ %
\ifx\p_framed_frame\v!overlay % no frame, no offset, no framewidth
\setfalse\c_framed_has_frame
\let\localoffset\v!overlay
@@ -1203,7 +1245,7 @@
% widths
-\setvalue{\??framedwidthalternative\empty}%
+\defcsname\??framedwidthalternative\empty\endcsname
{\ifconditional\c_framed_has_format
\settrue\c_framed_has_width
\d_framed_width\hsize
@@ -1212,7 +1254,7 @@
\d_framed_width\zeropoint
\fi}
-\setvalue{\??framedwidthalternative\v!fit}%
+\defcsname\??framedwidthalternative\v!fit\endcsname
{\ifconditional\c_framed_has_format
\settrue\c_framed_has_width
\d_framed_width\hsize
@@ -1221,7 +1263,7 @@
\d_framed_width\zeropoint
\fi}
-\setvalue{\??framedwidthalternative\v!fixed}% equals \v!fit but no shapebox
+\defcsname\??framedwidthalternative\v!fixed\endcsname % equals \v!fit but no shapebox
{\ifconditional\c_framed_has_format
\settrue\c_framed_has_width
\d_framed_width\hsize
@@ -1230,20 +1272,20 @@
\d_framed_width\zeropoint
\fi}
-\setvalue{\??framedwidthalternative\v!broad}%
+\defcsname\??framedwidthalternative\v!broad\endcsname
{\settrue\c_framed_has_width
\d_framed_width\hsize}
-\setvalue{\??framedwidthalternative\v!max}% idem broad
+\defcsname\??framedwidthalternative\v!max\endcsname % idem broad
{\settrue\c_framed_has_width
\d_framed_width\hsize}
-\setvalue{\??framedwidthalternative\v!local}%
+\defcsname\??framedwidthalternative\v!local\endcsname
{\settrue\c_framed_has_width
%\setlocalhsize
\d_framed_width\localhsize}
-\setvalue{\??framedwidthalternative\s!unknown}%
+\defcsname\??framedwidthalternative\s!unknown\endcsname
{\settrue\c_framed_has_width
\d_framed_width\localwidth}
@@ -1253,23 +1295,23 @@
% heights
-\setvalue{\??framedheightalternative\empty}%
+\defcsname\??framedheightalternative\empty\endcsname
{\setfalse\c_framed_has_height
\d_framed_height\zeropoint}
-\setvalue{\??framedheightalternative\v!fit}%
+\defcsname\??framedheightalternative\v!fit\endcsname
{\setfalse\c_framed_has_height
\d_framed_height\zeropoint}
-\setvalue{\??framedheightalternative\v!broad}%
+\defcsname\??framedheightalternative\v!broad\endcsname
{\setfalse\c_framed_has_height
\d_framed_height\zeropoint}
-\setvalue{\??framedheightalternative\v!max}%
+\defcsname\??framedheightalternative\v!max\endcsname
{\settrue\c_framed_has_height
\d_framed_height\vsize}
-\setvalue{\??framedheightalternative\s!unknown}%
+\defcsname\??framedheightalternative\s!unknown\endcsname
{\settrue\c_framed_has_height
\d_framed_height\localheight}
@@ -1279,49 +1321,49 @@
% struts (use let instead?)
-\setvalue{\??framedstrutalternative\v!no}%
+\defcsname\??framedstrutalternative\v!no\endcsname
{\c_framed_has_strut\plusone}
-\setvalue{\??framedstrutalternative\v!global}%
+\defcsname\??framedstrutalternative\v!global\endcsname
{\setstrut}
-\setvalue{\??framedstrutalternative\v!local}%
+\defcsname\??framedstrutalternative\v!local\endcsname
{\setfontstrut}
-\setvalue{\??framedstrutalternative\v!yes}%
+\defcsname\??framedstrutalternative\v!yes\endcsname
{\setstrut}
-\setvalue{\??framedstrutalternative\s!unknown}%
+\defcsname\??framedstrutalternative\s!unknown\endcsname
{\setstrut}
\def\framed_strut_alternative_unknown
{\setstrut}
-\setvalue{\??framedstrutalternative\v!none}% not even pseudo struts
+\defcsname\??framedstrutalternative\v!none\endcsname % not even pseudo struts
{\c_framed_has_strut\zerocount}
% offsets
-\setvalue{\??framedoffsetalternative\v!none}%
+\defcsname\??framedoffsetalternative\v!none\endcsname
{\setfalse\c_framed_has_offset
\c_framed_has_strut\plusone
\setfalse\c_framed_is_overlaid
\d_framed_local_offset\d_framed_linewidth}
-\setvalue{\??framedoffsetalternative\v!overlay}%
+\defcsname\??framedoffsetalternative\v!overlay\endcsname
{% \ifx\p_framed_frame\v!no \setfalse\c_framed_has_frame \fi % test first
\setfalse\c_framed_has_offset
\c_framed_has_strut\plusone
\settrue\c_framed_is_overlaid
\d_framed_local_offset\zeropoint}
-% \setvalue{\??framedoffsetalternative\v!strut}%
+% \defcsname\??framedoffsetalternative\v!strut\endcsname
% {\setfalse\c_framed_has_offset
% \c_framed_has_strut\plustwo
% \settrue\c_framed_is_overlaid
% \d_framed_local_offset\zeropoint}
-\setvalue{\??framedoffsetalternative\v!default}% new per 2-6-2000
+\defcsname\??framedoffsetalternative\v!default\endcsname % new per 2-6-2000
{\settrue \c_framed_has_offset
\c_framed_has_strut\plustwo
\setfalse\c_framed_is_overlaid
@@ -1336,7 +1378,7 @@
\let\defaultframeoffset\localoffset
\d_framed_local_offset\dimexpr\localoffset+\d_framed_linewidth\relax}
-\letvalue{\??framedoffsetalternative\s!unknown}\framed_offset_alternative_unknown
+\letcsname\??framedoffsetalternative\s!unknown\endcsname\framed_offset_alternative_unknown
% so far for alternatives
@@ -1412,6 +1454,19 @@
% options (btw, beware of location settings of derived functionality that bleed
% into this
+\def\pack_framed_profile_box
+ {\profilegivenbox\p_profile\b_framed_normal
+ \setbox\b_framed_normal\vpack{\unvbox\b_framed_normal}}
+
+\def\pack_framed_reverse_box
+ {\ifvbox\b_framed_normal
+ \edef\p_linedirection{\framedparameter\c!linedirection}%
+ \ifx\p_linedirection\v!reverse
+ \reversevboxcontent\b_framed_normal
+ \setbox\b_framed_normal\vpack{\unvbox\b_framed_normal}%
+ \fi
+ \fi}
+
\def\pack_framed_finish_a
{\ifreshapeframebox
\pack_framed_reshape_process
@@ -1437,29 +1492,9 @@
\pack_framed_reshape_reset
\fi}
-\def\pack_framed_profile_box
- {\profilegivenbox\p_profile\b_framed_normal
- \setbox\b_framed_normal\vpack{\unvbox\b_framed_normal}}
-
-\def\pack_framed_reverse_box
- {\ifvbox\b_framed_normal
- \edef\p_linedirection{\framedparameter\c!linedirection}%
- \ifx\p_linedirection\v!reverse
- \reversevboxcontent\b_framed_normal
- \setbox\b_framed_normal\vpack{\unvbox\b_framed_normal}%
- \fi
- \fi}
-
\protected\def\pack_framed_finish
- {%\pack_framed_stop_orientation % hm, wrong place ! should rotate the result (after reshape) .. moved down
- \pack_framed_locator_before\p_framed_location
+ {\pack_framed_locator_before\p_framed_location
\ifconditional\c_framed_has_format
- %\ifconditional\c_framed_has_height \else
- % \edef\p_profile{\framedparameter\c!profile}%
- % \ifempty\p_profile\else
- % \pack_framed_profile_box
- % \fi
- %\fi
\ifempty\p_framed_anchoring\else
\pack_framed_reverse_box
\fi
@@ -1496,10 +1531,8 @@
\ht\b_framed_normal\d_framed_height
\else
\edef\p_framed_minheight{\framedparameter\c!minheight}%
- \ifempty\p_framed_minheight \else
- \ifdim\ht\b_framed_normal<\p_framed_minheight
- \ht\b_framed_normal\p_framed_minheight
- \fi
+ \ifempty\p_framed_minheight \orelse \ifdim\ht\b_framed_normal<\p_framed_minheight
+ \ht\b_framed_normal\p_framed_minheight
\fi
\fi
\edef\p_framed_empty{\framedparameter\c!empty}%
@@ -1527,11 +1560,9 @@
\fi
\ifconditional\c_framed_has_extra_offset
\pack_framed_apply_extra_offsets % includes \d_framed_applied_offset
+ \orelse\ifzeropt\d_framed_applied_offset
\else
- \ifzeropt\d_framed_applied_offset
- \else
- \pack_framed_widen_box
- \fi
+ \pack_framed_widen_box
\fi
%
\ifrelax\postprocessframebox \else
@@ -1551,11 +1582,10 @@
\pack_framed_add_background
\fi
\fi
+% \pack_framed_pop_local_anchors
\pack_framed_locator_after\p_framed_location
- \iftrialtypesetting \else
- \ifempty\m_overlay_region\else
- \pack_framed_add_region
- \fi
+ \iftrialtypesetting \orelse \ifempty\m_overlay_region \else
+ \pack_framed_add_region
\fi
\box\b_framed_normal
\global\frameddimensionstate % global so to be used directly afterwards !
@@ -2318,8 +2348,23 @@
\framedmaxwidth \zeropoint
\framedaveragewidth\zeropoint}
-\def\pack_framed_reshape_process{\ifvbox\b_framed_normal\clf_doreshapeframedbox\b_framed_normal\relax\fi}
-\def\pack_framed_reshape_analyze{\ifvbox\b_framed_normal\clf_doanalyzeframedbox\b_framed_normal\relax\fi}
+\def\pack_framed_reshape_process
+ {\ifvbox\b_framed_normal
+ \ifconditional\c_pack_resync
+ \clf_doresyncframedbox
+ \else
+ \clf_doreshapeframedbox
+ \fi\b_framed_normal\relax
+ \fi}
+
+\def\pack_framed_reshape_analyze
+ {\ifvbox\b_framed_normal
+ \ifconditional\c_pack_resync
+ \clf_doresyncframedbox
+ \else
+ \clf_doanalyzeframedbox
+ \fi\b_framed_normal\relax
+ \fi}
% torture test / strange case (much depth) / method 2 needed
%
@@ -2629,18 +2674,22 @@
\frozen\instance\protected\edefcsname \currentframedtext\endcsname{\pack_framed_text_direct[\currentframedtext]}%
\to \everydefineframedtext
-\setvalue{\??framedtextlocation\v!left }{\letframedtextparameter\c!left \relax
- \letframedtextparameter\c!right\hfill}
+\defcsname\??framedtextlocation\v!left\endcsname
+ {\letframedtextparameter\c!left \relax
+ \letframedtextparameter\c!right\hfill}
-\setvalue{\??framedtextlocation\v!right }{\letframedtextparameter\c!left \hfill
- \letframedtextparameter\c!right\relax}
+\defcsname\??framedtextlocation\v!right\endcsname
+ {\letframedtextparameter\c!left \hfill
+ \letframedtextparameter\c!right\relax}
-\setvalue{\??framedtextlocation\v!middle}{\letframedtextparameter\c!left \hfill
- \letframedtextparameter\c!right\hfill}
+\defcsname\??framedtextlocation\v!middle\endcsname
+ {\letframedtextparameter\c!left \hfill
+ \letframedtextparameter\c!right\hfill}
-\setvalue{\??framedtextlocation\v!none }{\letframedtextparameter\c!left \relax
- \letframedtextparameter\c!right\relax
- \settrue\c_framed_text_location_none}
+\defcsname\??framedtextlocation\v!none\endcsname
+ {\letframedtextparameter\c!left \relax
+ \letframedtextparameter\c!right\relax
+ \settrue\c_framed_text_location_none}
\tolerant\protected\def\pack_framed_text_start[#1]#*[#2]#*[#3]% or #1#*[#2]#*[#3]% and pass {#1}
{\bgroup
diff --git a/tex/context/base/mkxl/page-ini.mkxl b/tex/context/base/mkxl/page-ini.mkxl
index 8c04c6cfc..3fa94cd5b 100644
--- a/tex/context/base/mkxl/page-ini.mkxl
+++ b/tex/context/base/mkxl/page-ini.mkxl
@@ -317,21 +317,6 @@
\aliased\let\doiftopofpageelse\doifelsetopofpage
-% %D Idea:
-%
-% \newinsert\thispageinsert % <- installinsertion
-%
-% \def\flushatthispage
-% {\bgroup
-% \dowithnextbox{\page_inserts_inject\thispageinsert{\box\nextbox}\egroup}%
-% \hbox}
-%
-% \appendtoks
-% \ifvoid\thispageinsert\else\hbox{\smashedbox\thispageinsert}\fi
-% \to \everyshipout
-
-% not yet in i-* file
-
\installcorenamespace{markedpage}
% todo: just define at the lua end ... less hassle
diff --git a/tex/context/base/mkxl/page-ins.mkxl b/tex/context/base/mkxl/page-ins.mkxl
index 872af4807..978f62f7c 100644
--- a/tex/context/base/mkxl/page-ins.mkxl
+++ b/tex/context/base/mkxl/page-ins.mkxl
@@ -117,15 +117,9 @@
% pass pass them explicitly. Actually, when we see an insertion node at that end,
% we already know the number.
-% \insertmode\plustwo
+\insertmode\plustwo
-% once we made the switch we will use \ifinsert instead of the ht test
-
-\ifnum\insertmode=\plustwo
-
- \c_syst_min_allocated_insert = 1 % 128
- \c_syst_max_allocated_insert = 255 % 254
- \c_syst_last_allocated_insertion = 1 %
+% \ifnum\insertmode=\plustwo
\protected\def\page_inserts_inject {\insert}
@@ -146,35 +140,39 @@
\protected\def\page_inserts_get_depth {\insertdepth}
\protected\def\page_inserts_get_width {\insertwidth}
-\else
-
- \protected\def\page_inserts_inject {\insert}
-
- \protected\def\page_inserts_set_limit {\global\dimen}
- \protected\def\page_inserts_set_distance {\global\skip }
- \protected\def\page_inserts_set_multiplier{\global\count}
-
- \protected\def\page_inserts_get_limit {\dimen}
- \protected\def\page_inserts_get_distance {\skip }
- \protected\def\page_inserts_get_multiplier{\count}
-
- \protected\def\page_inserts_get_boxed {\box}
- \protected\def\page_inserts_get_copied {\copy}
- \protected\def\page_inserts_get_unboxed {\unvbox}
- \protected\def\page_inserts_get_uncopied {\unvcopy}
-
- \protected\def\page_inserts_get_height {\ht}
- \protected\def\page_inserts_get_depth {\dp}
- \protected\def\page_inserts_get_width {\wd}
+% \else
+%
+% \protected\def\page_inserts_inject {\insert}
+%
+% \protected\def\page_inserts_set_limit {\global\dimen}
+% \protected\def\page_inserts_set_distance {\global\skip }
+% \protected\def\page_inserts_set_multiplier{\global\count}
+%
+% \protected\def\page_inserts_get_limit {\dimen}
+% \protected\def\page_inserts_get_distance {\skip }
+% \protected\def\page_inserts_get_multiplier{\count}
+%
+% \protected\def\page_inserts_get_boxed {\box}
+% \protected\def\page_inserts_get_copied {\copy}
+% \protected\def\page_inserts_get_unboxed {\unvbox}
+% \protected\def\page_inserts_get_uncopied {\unvcopy}
+%
+% \protected\def\page_inserts_get_height {\ht}
+% \protected\def\page_inserts_get_depth {\dp}
+% \protected\def\page_inserts_get_width {\wd}
+%
+% \fi
-\fi
+\newcount\c_page_inserts_last_allocated
\appendtoks
\ifempty\currentinsertionparent
\ifcsname\??insertionnumber\currentinsertion\endcsname
% bad news
\else
- \expandafter\newinsert\csname\??insertionnumber\currentinsertion\endcsname
+ %expandafter\newinsert\csname\??insertionnumber\currentinsertion\endcsname
+ \global\advance\c_page_inserts_last_allocated\plusone
+ \global\expandafter\integerdef\csname\??insertionnumber\currentinsertion\endcsname\c_page_inserts_last_allocated
\page_inserts_synchronize_registers
\clf_defineinsertion
{\currentinsertion}%
diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl
index 7efae6a8b..e5eaab435 100644
--- a/tex/context/base/mkxl/strc-mat.mkxl
+++ b/tex/context/base/mkxl/strc-mat.mkxl
@@ -1129,7 +1129,9 @@
\scratchcounter\zerocount
#2% preroll
\hbox to \displaywidth \bgroup
- \divide\displaywidth\scratchcounter
+ \ifcase\scratchcounter\else
+ \divide\displaywidth\scratchcounter
+ \fi
\hss
\enforced\let\startformula\strc_formulas_nested_formula_start
\enforced\let\stopformula \strc_formulas_nested_formula_stop
diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl
index 8eaeea7db..462b8500a 100644
--- a/tex/context/base/mkxl/syst-ini.mkxl
+++ b/tex/context/base/mkxl/syst-ini.mkxl
@@ -199,48 +199,46 @@
%D non||\type {\global} assignments with respect to registers 0, 2, 4, \unknown\ 30.
%D This will prevent \quote {save stack buildup} that might otherwise occur.
%D
-%D We reserve some registers for special (management) purposes:
+%D We reserve some registers for special (management) purposes. In the mkiv file you
+%D can see how we also (even if we don't use it) deal with families and languages
+%D and distinguish read and write ranges. There we also use a more traditional
+%D insert allocator that operates in its own range. In \MKIV\ the ranges are:
% 0 - 20 : scratch
% 21 - 127 : internal
-% 128 - 254 : inserts
+% 128 - 254 : inserts (no longer)
% 255 : page
-% 256 - : user
+% 256 - : user defined
-% use \chardef instead for min and max
-%
-% will be blocked: \newfamily \newlanguage
-
-\permanent\countdef \c_syst_min_allocated_register = 52 \c_syst_min_allocated_register = 256 % can change
-\permanent\countdef \c_syst_max_allocated_register = 53 \c_syst_max_allocated_register = 65535
-\permanent\countdef \c_syst_min_allocated_read = 54 \c_syst_min_allocated_read = 0
-\permanent\countdef \c_syst_max_allocated_read = 55 \c_syst_max_allocated_read = 1023
-\permanent\countdef \c_syst_min_allocated_language = 56 \c_syst_min_allocated_language = 0
-\permanent\countdef \c_syst_max_allocated_language = 57 \c_syst_max_allocated_language = 8191
-\permanent\countdef \c_syst_min_allocated_insert = 58 \c_syst_min_allocated_insert = 128
-\permanent\countdef \c_syst_max_allocated_insert = 59 \c_syst_max_allocated_insert = 254
-\permanent\countdef \c_syst_min_allocated_family = 60 \c_syst_min_allocated_family = 128
-\permanent\countdef \c_syst_max_allocated_family = 61 \c_syst_max_allocated_family = 255
-\permanent\countdef \c_syst_min_allocated_attribute = 62 \c_syst_min_allocated_attribute = 1024 % 0-1023 : private
-\permanent\countdef \c_syst_min_allocated_write = 63 \c_syst_min_allocated_write = 0
-\permanent\countdef \c_syst_max_allocated_write = 64 \c_syst_max_allocated_write = 1023
-
-\permanent\countdef \c_syst_last_allocated_count = 32 \c_syst_last_allocated_count = \c_syst_min_allocated_register
-\permanent\countdef \c_syst_last_allocated_dimen = 33 \c_syst_last_allocated_dimen = \c_syst_min_allocated_register
-\permanent\countdef \c_syst_last_allocated_skip = 34 \c_syst_last_allocated_skip = \c_syst_min_allocated_register
-\permanent\countdef \c_syst_last_allocated_muskip = 35 \c_syst_last_allocated_muskip = \c_syst_min_allocated_register
-\permanent\countdef \c_syst_last_allocated_box = 36 \c_syst_last_allocated_box = \c_syst_min_allocated_register
-\permanent\countdef \c_syst_last_allocated_toks = 37 \c_syst_last_allocated_toks = \c_syst_min_allocated_register
-\permanent\countdef \c_syst_last_allocated_read = 38 \c_syst_last_allocated_read = \c_syst_min_allocated_read
-\permanent\countdef \c_syst_last_allocated_write = 39 \c_syst_last_allocated_write = \c_syst_min_allocated_write
-\permanent\countdef \c_syst_last_allocated_marks = 40 \c_syst_last_allocated_marks = \c_syst_min_allocated_register
-\permanent\countdef \c_syst_last_allocated_language = 41 \c_syst_last_allocated_language = \c_syst_min_allocated_language % not used in context
-\permanent\countdef \c_syst_last_allocated_insertion = 42 \c_syst_last_allocated_insertion = \c_syst_min_allocated_insert
-\permanent\countdef \c_syst_last_allocated_family = 43 \c_syst_last_allocated_family = \c_syst_min_allocated_family % not used in context
-\permanent\countdef \c_syst_last_allocated_attribute = 44 \c_syst_last_allocated_attribute = \c_syst_min_allocated_attribute % not used in context
-
-\permanent\countdef \c_syst_min_counter_value = 125 \c_syst_min_counter_value = -"7FFFFFFF % beware, we use index 125 at the lua end
-\permanent\countdef \c_syst_max_counter_value = 126 \c_syst_max_counter_value = "7FFFFFFF % beware, we use index 126 at the lua end
+%D However, in \LMTX\ we have:
+
+% 0 - 199 : scratch
+% 200 - 254 : internal
+% 255 : page
+% 256 - : user defined
+
+%D Later on, the \type {\c_syst_max_allocated_register} variable will be halfed so
+%D that while local allocators will use the 22* range. So we have plenty of room
+%D reserved for more private ones.
+
+\permanent\countdef\c_syst_min_allocated_register = 201 \c_syst_min_allocated_register = 256 % can change
+\permanent\countdef\c_syst_max_allocated_register = 202 \c_syst_max_allocated_register = 65535 % is adapted later on
+\permanent\countdef\c_syst_min_allocated_iohandle = 203 \c_syst_min_allocated_iohandle = 0
+\permanent\countdef\c_syst_max_allocated_iohandle = 204 \c_syst_max_allocated_iohandle = 1023
+\permanent\countdef\c_syst_min_allocated_attribute = 205 \c_syst_min_allocated_attribute = 1024 % 0-1023 : private
+
+\permanent\countdef\c_syst_last_allocated_count = 211 \c_syst_last_allocated_count = \c_syst_min_allocated_register
+\permanent\countdef\c_syst_last_allocated_dimen = 212 \c_syst_last_allocated_dimen = \c_syst_min_allocated_register
+\permanent\countdef\c_syst_last_allocated_skip = 213 \c_syst_last_allocated_skip = \c_syst_min_allocated_register
+\permanent\countdef\c_syst_last_allocated_muskip = 214 \c_syst_last_allocated_muskip = \c_syst_min_allocated_register
+\permanent\countdef\c_syst_last_allocated_box = 215 \c_syst_last_allocated_box = \c_syst_min_allocated_register
+\permanent\countdef\c_syst_last_allocated_toks = 216 \c_syst_last_allocated_toks = \c_syst_min_allocated_register
+\permanent\countdef\c_syst_last_allocated_read = 217 \c_syst_last_allocated_read = \c_syst_min_allocated_iohandle
+\permanent\countdef\c_syst_last_allocated_write = 218 \c_syst_last_allocated_write = \c_syst_min_allocated_iohandle
+\permanent\countdef\c_syst_last_allocated_marks = 219 \c_syst_last_allocated_marks = \c_syst_min_allocated_register
+
+\permanent\countdef\c_syst_min_counter_value = 253 \c_syst_min_counter_value = -"7FFFFFFF
+\permanent\countdef\c_syst_max_counter_value = 254 \c_syst_max_counter_value = "7FFFFFFF
\immutable\integerdef\zerocount 0
\immutable\integerdef\plusone 1
@@ -259,25 +257,20 @@
%D The allocators share a common helper macro.
-\permanent\protected\def\newcount {\syst_basics_allocate\c_syst_last_allocated_count \count \countdef \c_syst_max_allocated_register}
-\permanent\protected\def\newdimen {\syst_basics_allocate\c_syst_last_allocated_dimen \dimen \dimendef \c_syst_max_allocated_register}
-\permanent\protected\def\newskip {\syst_basics_allocate\c_syst_last_allocated_skip \skip \skipdef \c_syst_max_allocated_register}
-\permanent\protected\def\newmuskip {\syst_basics_allocate\c_syst_last_allocated_muskip \muskip \muskipdef \c_syst_max_allocated_register}
-\permanent\protected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \integerdef\c_syst_max_allocated_register}
-\permanent\protected\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register}
-\permanent\protected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \integerdef\c_syst_max_allocated_read}
-\permanent\protected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \integerdef\c_syst_max_allocated_write}
-\permanent\protected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \integerdef\c_syst_max_allocated_register}
-\permanent\protected\def\newinsert {\syst_basics_allocate\c_syst_last_allocated_insertion\insert \chardef \c_syst_max_allocated_insert}
-\permanent\protected\def\newlanguage{\syst_basics_allocate\c_syst_last_allocated_language \language\integerdef\c_syst_max_allocated_language} % not needed in context
-\permanent\protected\def\newfamily {\syst_basics_allocate\c_syst_last_allocated_family \fam \integerdef\c_syst_max_allocated_family} % not needed in context
-
-\aliased\let\newfam\newfamily
+\permanent\protected\def\newcount {\syst_basics_allocate\c_syst_last_allocated_count \count \countdef \c_syst_max_allocated_register}
+\permanent\protected\def\newdimen {\syst_basics_allocate\c_syst_last_allocated_dimen \dimen \dimendef \c_syst_max_allocated_register}
+\permanent\protected\def\newskip {\syst_basics_allocate\c_syst_last_allocated_skip \skip \skipdef \c_syst_max_allocated_register}
+\permanent\protected\def\newmuskip{\syst_basics_allocate\c_syst_last_allocated_muskip\muskip\muskipdef \c_syst_max_allocated_register}
+\permanent\protected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \integerdef\c_syst_max_allocated_register}
+\permanent\protected\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register}
+\permanent\protected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \integerdef\c_syst_max_allocated_iohandle}
+\permanent\protected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \integerdef\c_syst_max_allocated_iohandle}
+\permanent\protected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \integerdef\c_syst_max_allocated_register}
\firstvalidlanguage \plusone % so zero is ignored in hyphenation, this might become the default
-% Watch out, for the moment we disable the check for already being defined
-% later we will revert this but first all chardefs must be replaced.
+%D Watch out, for the moment we disable the check for already being defined later we
+%D will revert this but first all chardefs must be replaced.
\permanent\protected\def\setconstant {}
\permanent\protected\def\setconstantvalue#1#2{\csname#1\endcsname\numexpr#2\relax}
@@ -361,26 +354,26 @@
%D some available. The private ones are used in cases where we don't want to
%D intrude on normal scratch ones.
-\newcount \scratchcounter \newcount \globalscratchcounter \newcount \privatescratchcounter
-\newdimen \scratchdimen \newdimen \globalscratchdimen \newdimen \privatescratchdimen
-\newskip \scratchskip \newskip \globalscratchskip \newskip \privatescratchskip
-\newmuskip\scratchmuskip \newmuskip\globalscratchmuskip \newmuskip\privatescratchmuskip
-\newtoks \scratchtoks \newtoks \globalscratchtoks \newtoks \privatescratchtoks
-\newbox \scratchbox \newbox \globalscratchbox \newbox \privatescratchbox
-
-\newcount\scratchcounterone \newcount\scratchcountertwo \newcount\scratchcounterthree
-\newdimen \scratchdimenone \newdimen \scratchdimentwo \newdimen \scratchdimenthree
-\newskip \scratchskipone \newskip \scratchskiptwo \newskip \scratchskipthree
-\newmuskip\scratchmuskipone \newmuskip\scratchmuskiptwo \newmuskip\scratchmuskipthree
-\newtoks \scratchtoksone \newtoks \scratchtokstwo \newtoks \scratchtoksthree
-\newbox \scratchboxone \newbox \scratchboxtwo \newbox \scratchboxthree
-
-\newcount\scratchcounterfour \newcount\scratchcounterfive \newcount\scratchcountersix
-\newdimen \scratchdimenfour \newdimen \scratchdimenfive \newdimen \scratchdimensix
-\newskip \scratchskipfour \newskip \scratchskipfive \newskip \scratchskipsix
-\newmuskip\scratchmuskipfour \newmuskip\scratchmuskipfive \newmuskip\scratchmuskipsix
-\newtoks \scratchtoksfour \newtoks \scratchtoksfive \newtoks \scratchtokssix
-\newbox \scratchboxfour \newbox \scratchboxfive \newbox \scratchboxsix
+\newcount \scratchcounter \newcount \globalscratchcounter \newcount \privatescratchcounter
+\newdimen \scratchdimen \newdimen \globalscratchdimen \newdimen \privatescratchdimen
+\newskip \scratchskip \newskip \globalscratchskip \newskip \privatescratchskip
+\newmuskip\scratchmuskip \newmuskip\globalscratchmuskip \newmuskip\privatescratchmuskip
+\newtoks \scratchtoks \newtoks \globalscratchtoks \newtoks \privatescratchtoks
+\newbox \scratchbox \newbox \globalscratchbox \newbox \privatescratchbox
+
+\newcount \scratchcounterone \newcount \scratchcountertwo \newcount \scratchcounterthree
+\newdimen \scratchdimenone \newdimen \scratchdimentwo \newdimen \scratchdimenthree
+\newskip \scratchskipone \newskip \scratchskiptwo \newskip \scratchskipthree
+\newmuskip \scratchmuskipone \newmuskip \scratchmuskiptwo \newmuskip \scratchmuskipthree
+\newtoks \scratchtoksone \newtoks \scratchtokstwo \newtoks \scratchtoksthree
+\newbox \scratchboxone \newbox \scratchboxtwo \newbox \scratchboxthree
+
+\newcount \scratchcounterfour \newcount \scratchcounterfive \newcount \scratchcountersix
+\newdimen \scratchdimenfour \newdimen \scratchdimenfive \newdimen \scratchdimensix
+\newskip \scratchskipfour \newskip \scratchskipfive \newskip \scratchskipsix
+\newmuskip \scratchmuskipfour \newmuskip \scratchmuskipfive \newmuskip \scratchmuskipsix
+\newtoks \scratchtoksfour \newtoks \scratchtoksfive \newtoks \scratchtokssix
+\newbox \scratchboxfour \newbox \scratchboxfive \newbox \scratchboxsix
\newcount\globalscratchcounterone
\newcount\globalscratchcountertwo
@@ -1195,28 +1188,15 @@
%D \stoptyping
%D
%D There is a little extra overhead in the overload protection but not that much.
-%D Instead of:
-
-% \newcount\c_syst_local_count \c_syst_local_count \c_syst_max_allocated_register
-% \newcount\c_syst_local_dimen \c_syst_local_dimen \c_syst_local_count
-% \newcount\c_syst_local_skip \c_syst_local_skip \c_syst_local_count
-% \newcount\c_syst_local_muskip\c_syst_local_muskip\c_syst_local_count
-% \newcount\c_syst_local_box \c_syst_local_box \c_syst_local_count
-% \newcount\c_syst_local_toks \c_syst_local_toks \c_syst_local_count
-
-%D We do this:
-
-\permanent\countdef\c_syst_local_count = 72 \c_syst_local_count = \c_syst_max_allocated_register
-\permanent\countdef\c_syst_local_dimen = 73 \c_syst_local_dimen = \c_syst_local_count
-\permanent\countdef\c_syst_local_skip = 74 \c_syst_local_skip = \c_syst_local_count
-\permanent\countdef\c_syst_local_muskip = 75 \c_syst_local_muskip = \c_syst_local_count
-\permanent\countdef\c_syst_local_box = 76 \c_syst_local_box = \c_syst_local_count
-\permanent\countdef\c_syst_local_toks = 77 \c_syst_local_toks = \c_syst_local_count
-\permanent\countdef\c_syst_local_read = 78 \c_syst_local_read = \c_syst_local_count
-\permanent\countdef\c_syst_local_write = 79 \c_syst_local_write = \c_syst_local_count
-% We should have used \c_syst_local_dimen = \numexpr \c_syst_max_allocated_register +
-% 1\relax, but we do this instead (it's no problem loosing a few registers).
+\permanent\countdef\c_syst_local_count = 221 \c_syst_local_count = \c_syst_max_allocated_register
+\permanent\countdef\c_syst_local_dimen = 222 \c_syst_local_dimen = \c_syst_local_count
+\permanent\countdef\c_syst_local_skip = 223 \c_syst_local_skip = \c_syst_local_count
+\permanent\countdef\c_syst_local_muskip = 224 \c_syst_local_muskip = \c_syst_local_count
+\permanent\countdef\c_syst_local_box = 225 \c_syst_local_box = \c_syst_local_count
+\permanent\countdef\c_syst_local_toks = 226 \c_syst_local_toks = \c_syst_local_count
+\permanent\countdef\c_syst_local_read = 227 \c_syst_local_read = \c_syst_local_count
+\permanent\countdef\c_syst_local_write = 228 \c_syst_local_write = \c_syst_local_count
\c_syst_max_allocated_register \numexpr\c_syst_max_allocated_register:2\relax % floor
@@ -1302,7 +1282,7 @@
\permanent\protected\def\syst_local_overflow_read {\syst_local_overflow {read}}
\permanent\protected\def\syst_local_overflow_write {\syst_local_overflow {write}}
-%D We sacrifice a little performance but save some tokens by not defineing these
+%D We sacrifice a little performance but save some tokens by not defining these
%D completely:
\permanent\protected\def\newlocalcount #1{\setnewlocalcount #1\zerocount }
diff --git a/tex/context/base/mkxl/toks-scn.lmt b/tex/context/base/mkxl/toks-scn.lmt
index 73eedbba7..ca95985b0 100644
--- a/tex/context/base/mkxl/toks-scn.lmt
+++ b/tex/context/base/mkxl/toks-scn.lmt
@@ -60,7 +60,7 @@ local close = tokenbits.close
local function scanopen()
while true do
local c = scancode(open)
- if c == 123 then
+ if c == 123 then -- {
return true
-- elseif c ~= 32 then
elseif not c then
@@ -72,7 +72,7 @@ end
local function scanclose()
while true do
local c = scancode(close)
- if c == 125 then
+ if c == 125 then -- }
return true
-- elseif c ~= 32 then
elseif not c then
diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml
index 00ae8cff7..691b93919 100644
--- a/tex/context/interface/mkii/keys-pe.xml
+++ b/tex/context/interface/mkii/keys-pe.xml
@@ -144,6 +144,7 @@
<cd:variable name='chemistry' value='chemistry'/>
<cd:variable name='cite' value='cite'/>
<cd:variable name='closed' value='closed'/>
+ <cd:variable name='collapsed' value='collapsed'/>
<cd:variable name='color' value='رنگ'/>
<cd:variable name='column' value='ستون'/>
<cd:variable name='columns' value='ستونها'/>
@@ -395,6 +396,7 @@
<cd:variable name='nostopper' value='nostopper'/>
<cd:variable name='not' value='بدون'/>
<cd:variable name='notation' value='notation'/>
+ <cd:variable name='notcollapsed' value='notcollapsed'/>
<cd:variable name='note' value='note'/>
<cd:variable name='nothanging' value='بدون‌آویزان‌کردن'/>
<cd:variable name='nothyphenated' value='بدون‌شکست'/>
@@ -1269,6 +1271,7 @@
<cd:constant name='symbolset' value='مجموعه‌نماد'/>
<cd:constant name='symcolor' value='رنگ‌نماد'/>
<cd:constant name='symstyle' value='سبک‌نماد'/>
+ <cd:constant name='synchronize' value='synchronize'/>
<cd:constant name='synonym' value='مترادف'/>
<cd:constant name='synonymcolor' value='رنگ‌مترادف'/>
<cd:constant name='synonymcommand' value='synonymcommand'/>
diff --git a/tex/context/modules/mkiv/x-mathml.mkiv b/tex/context/modules/mkiv/x-mathml.mkiv
index 58669eb2a..183125bec 100644
--- a/tex/context/modules/mkiv/x-mathml.mkiv
+++ b/tex/context/modules/mkiv/x-mathml.mkiv
@@ -472,41 +472,41 @@
\startxmlsetups mmc:fn
\begingroup
- \edef\mmlnoffn{\xmlcount{#1}{/*}}
- \ifnum\mmlnoffn>\plustwo
- \def\MMCfnleft {\left(}
- \def\MMCfnright{\right)}
- \else
- \let\MMCfnleft \relax
- \let\MMCfnright\relax
- \fi
- \xmldoifelse {#1} {/mml:ci} { % first
- \edef\mmlfnci{\xmltext{#1}{/mml:ci}}% was xmlcontent
- \doifelsesetups{mmc:fn:\mmlfnci} { % was mmc:fn:...
- \xmlsetup{#1}{mmc:fn:\mmlfnci} % \MMLdoL/MMLdoR to be handled in plugin
- } {
- \MMLcreset
- \mmlfirst{#1}
- }
- } {
- \xmldoifelse {#1} {/mml:apply} { % first
- \xmldoifelse {#1} {/(mml:plus\string|mml:minus)} {
- \left(\mmlfirst{#1}\right)
+ \edef\mmlnoffn{\xmlcount{#1}{/*}}
+ \ifnum\mmlnoffn>\plustwo
+ \def\MMCfnleft {\left(}
+ \def\MMCfnright{\right)}
+ \else
+ \let\MMCfnleft \relax
+ \let\MMCfnright\relax
+ \fi
+ \xmldoifelse {#1} {/mml:ci} { % first
+ \edef\mmlfnci{\xmltext{#1}{/mml:ci}}% was xmlcontent
+ \doifelsesetups{mmc:fn:\mmlfnci} { % was mmc:fn:...
+ \xmlsetup{#1}{mmc:fn:\mmlfnci} % \MMLdoL/MMLdoR to be handled in plugin
} {
+ \MMLcreset
\mmlfirst{#1}
}
- \ifnum\mmlnoffn>\plusone
- \left(\xmlall{#1}{/!mml:apply}\right)
- \fi
} {
- \MMLcreset
- \negthinspace
- \MMCfnleft
- \ifnum\mmlnoffn=\plustwo,\fi
- \xmlconcat{#1}{/*}{2}{}{\MMLseparator,}
- \MMCfnright
+ \xmldoifelse {#1} {/mml:apply} { % first
+ \xmldoifelse {#1} {/(mml:plus\string|mml:minus)} {
+ \left(\mmlfirst{#1}\right)
+ } {
+ \mmlfirst{#1}
+ }
+ \ifnum\mmlnoffn>\plusone
+ \left(\xmlall{#1}{/!mml:apply}\right)
+ \fi
+ } {
+ \MMLcreset
+ \negthinspace
+ \MMCfnleft
+ \ifnum\mmlnoffn=\plustwo,\fi
+ \xmlconcat{#1}{/*}{2}{}{\MMLseparator,}
+ \MMCfnright
+ }
}
- }
\endgroup
\stopxmlsetups
@@ -1879,6 +1879,14 @@
\fi
\stoptexdefinition
+\starttexdefinition setmmlmathcolor #1
+ \edef\mmlmathcolor{\xmlatt{#1}{mathcolor}}
+ \ifx \mmlmathcolor \empty
+ \else
+ \directcolor[\mmlmathcolor]
+ \fi
+\stoptexdefinition
+
% todo: textbackgrounds
\starttexdefinition applymmlmathbackground #1#2
@@ -1922,16 +1930,20 @@
\startxmlsetups mml:mi % todo: mathsize (unlikely) mathcolor (easy) mathbackground (easy)
\begingroup
- \pushmathstyle
+ \pushmathstyle % still needed ?
+ \setmmlmathcolor{#1}
\setmmlmathstyle{#1}
\setmmlscriptlevel{#1}
\ctxmodulemathml{mi("#1")}
- \popmathstyle
+ \popmathstyle % still needed ?
\endgroup
\stopxmlsetups
\startxmlsetups mml:mn
- \ctxmodulemathml{mn("#1")}% no \hbox, would be ok for . , but spoils rest
+ \begingroup
+ \setmmlmathcolor{#1}
+ \ctxmodulemathml{mn("#1")}% no \hbox, would be ok for . , but spoils rest
+ \endgroup
\stopxmlsetups
% <m:mo>-</m:mo><m:mn>2</m:mn> and <m:mn>1</m:mn><m:mo>-</m:mo><m:mn>2</m:mn>
@@ -1939,25 +1951,28 @@
% spacing between - and 2 is taken care of by tex itself
\startxmlsetups mml:mo
- \edef\mmlattvalue{\xmlatt{#1}{maxsize}}
- \ifx\mmlattvalue\mmlconstantone
- \settrue\mmlignoredelimiter
- \else
- \edef\mmlattvalue{\xmlatt{#1}{stretchy}}
- \ifx\mmlattvalue\mmlconstantfalse
+ \begingroup
+ \setmmlmathcolor{#1}
+ \edef\mmlattvalue{\xmlatt{#1}{maxsize}}
+ \ifx\mmlattvalue\mmlconstantone
\settrue\mmlignoredelimiter
+ \else
+ \edef\mmlattvalue{\xmlatt{#1}{stretchy}}
+ \ifx\mmlattvalue\mmlconstantfalse
+ \settrue\mmlignoredelimiter
+ \fi
\fi
- \fi
- \edef\mmlattvalue{\xmlatt{#1}{lspace}}
- \ifx\mmlattvalue\empty\else
- \hskip\mmlattvalue\relax % todo: check for dimension
- \fi
- \ctxmodulemathml{mo("#1")}
- \edef\mmlattvalue{\xmlatt{#1}{rspace}}
- \ifx\mmlattvalue\empty\else
- \hskip\mmlattvalue\relax % todo: check for dimension
- \fi
- \setfalse\mmlignoredelimiter
+ \edef\mmlattvalue{\xmlatt{#1}{lspace}}
+ \ifx\mmlattvalue\empty\else
+ \hskip\mmlattvalue\relax % todo: check for dimension
+ \fi
+ \ctxmodulemathml{mo("#1")}
+ \edef\mmlattvalue{\xmlatt{#1}{rspace}}
+ \ifx\mmlattvalue\empty\else
+ \hskip\mmlattvalue\relax % todo: check for dimension
+ \fi
+ % \setfalse\mmlignoredelimiter
+ \endgroup
\stopxmlsetups
@@ -2486,34 +2501,65 @@
\setupMMLappearance[mspace][\c!option=] % \v!test
+% \startxmlsetups mml:mspace
+% \begingroup
+% \edef\mmlspacetext{\xmlatt{#1}{spacing}}
+% \ifx\mmlspacetext\empty
+% \scratchwidth \xmlattdef{#1}{width} \!!zeropoint % must be string
+% \scratchheight\xmlattdef{#1}{height}\!!zeropoint
+% \scratchdepth \xmlattdef{#1}{depth} \!!zeropoint
+% \ifdim\scratchheight=\zeropoint
+% \ifdim\scratchdepth=\zeropoint\else
+% \hbox{\vrule\s!depth\scratchdepth\s!height\zeropoint\s!width\zeropoint}%
+% \fi
+% \else
+% \hbox{\vrule\s!depth\zeropoint\s!height\scratchheight\s!width\zeropoint}%
+% \fi
+% \ifdim\scratchwidth=\zeropoint\else
+% \ifx\MMLmspaceoption\v!test
+% \hbox to \scratchwidth{\showstruts\strut\hss\lower2\exheight\hbox{\infofont\xmlattdef{#1}{width}}\hss\strut}
+% \else
+% \hskip\scratchwidth
+% \fi
+% \fi
+% \else
+% \ifx\MMLmspaceoption\v!test
+% \hbox{\showstruts\strut\phantom{\triggermathstyle\normalmathstyle\mmlspacetext}\strut}
+% \else
+% \phantom{\triggermathstyle\normalmathstyle\mmlspacetext}
+% \fi
+% \fi
+% \endgroup
+% \stopxmlsetups
+
\startxmlsetups mml:mspace
\begingroup
- \edef\mmlspacetext{\xmlatt{#1}{spacing}}
- \ifx\mmlspacetext\empty
- \scratchwidth \xmlattdef{#1}{width} \!!zeropoint % must be string
- \scratchheight\xmlattdef{#1}{height}\!!zeropoint
- \scratchdepth \xmlattdef{#1}{depth} \!!zeropoint
- \ifdim\scratchheight=\zeropoint
- \ifdim\scratchdepth=\zeropoint\else
- \hbox{\vrule\s!depth\scratchdepth\s!height\zeropoint\s!width\zeropoint}%
+ \edef\mmlspacetext{\xmlatt{#1}{spacing}}
+ \ifx\mmlspacetext\empty
+ \scratchwidth \xmlattdef{#1}{width} \!!zeropoint % must be string
+ \scratchheight\xmlattdef{#1}{height}\!!zeropoint
+ \scratchdepth \xmlattdef{#1}{depth} \!!zeropoint
+ \ifdim\scratchheight=\zeropoint
+ \ifdim\scratchdepth=\zeropoint\else
+ \novrule\s!depth\scratchdepth\s!height\zeropoint\s!width\zeropoint
+ \fi
+ \else
+ \novrule\s!depth\zeropoint\s!height\scratchheight\s!width\zeropoint
+ \fi
+ \ifdim\scratchwidth=\zeropoint\else
+ \ifx\MMLmspaceoption\v!test
+ \hbox to \scratchwidth{\showstruts\strut\hss\lower2\exheight\hbox{\infofont\xmlattdef{#1}{width}}\hss\strut}
+ \else
+ \hskip\scratchwidth
+ \fi
\fi
\else
- \hbox{\vrule\s!depth\zeropoint\s!height\scratchheight\s!width\zeropoint}%
- \fi
- \ifdim\scratchwidth=\zeropoint\else
\ifx\MMLmspaceoption\v!test
- \hbox to \scratchwidth{\showstruts\strut\hss\lower2\exheight\hbox{\infofont\xmlattdef{#1}{width}}\hss\strut}
+ \hbox{\showstruts\strut\phantom{\triggermathstyle\normalmathstyle\mmlspacetext}\strut}
\else
- \hskip\scratchwidth
+ \phantom{\triggermathstyle\normalmathstyle\mmlspacetext}
\fi
\fi
- \else
- \ifx\MMLmspaceoption\v!test
- \hbox{\showstruts\strut\phantom{\triggermathstyle\normalmathstyle\mmlspacetext}\strut}
- \else
- \phantom{\triggermathstyle\normalmathstyle\mmlspacetext}
- \fi
- \fi
\endgroup
\stopxmlsetups
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index ac8132e27..1f823df95 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-05-27 14:12
+-- merge date : 2021-05-31 14:09
do -- begin closure to overcome local limits and interference