summaryrefslogtreecommitdiff
path: root/tex/context
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-10-10 13:36:53 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-10-10 13:36:53 +0200
commitd47ee9fc195ba82eef5e4be132b1d88b7f009a9c (patch)
tree45964c47b2242f6ff9bf6a881639146be1edd201 /tex/context
parentedaa6851d5c096acba2ad5817f70d3eb7cec46e6 (diff)
downloadcontext-d47ee9fc195ba82eef5e4be132b1d88b7f009a9c.tar.gz
2017-10-10 12:06:00
Diffstat (limited to 'tex/context')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/anch-pgr.lua2
-rw-r--r--tex/context/base/mkiv/anch-pos.lua2
-rw-r--r--tex/context/base/mkiv/back-exp.lua24
-rw-r--r--tex/context/base/mkiv/back-pdf.mkiv9
-rw-r--r--tex/context/base/mkiv/buff-ini.lua30
-rw-r--r--tex/context/base/mkiv/char-ini.lua4
-rw-r--r--tex/context/base/mkiv/char-utf.lua15
-rw-r--r--tex/context/base/mkiv/cldf-ini.lua2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/cont-run.lua10
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/core-uti.lua16
-rw-r--r--tex/context/base/mkiv/file-mod.mkvi14
-rw-r--r--tex/context/base/mkiv/font-agl.lua17
-rw-r--r--tex/context/base/mkiv/font-enc.lua7
-rw-r--r--tex/context/base/mkiv/font-map.lua4
-rw-r--r--tex/context/base/mkiv/font-ota.lua6
-rw-r--r--tex/context/base/mkiv/font-syn.lua63
-rw-r--r--tex/context/base/mkiv/l-lpeg.lua56
-rw-r--r--tex/context/base/mkiv/lpdf-ano.lua4
-rw-r--r--tex/context/base/mkiv/lpdf-epa.lua179
-rw-r--r--tex/context/base/mkiv/lpdf-ini.lua11
-rw-r--r--tex/context/base/mkiv/lpdf-res.lua4
-rw-r--r--tex/context/base/mkiv/math-ini.mkiv14
-rw-r--r--tex/context/base/mkiv/meta-imp-nodes.mkiv5
-rw-r--r--tex/context/base/mkiv/mlib-lua.lua27
-rw-r--r--tex/context/base/mkiv/mult-low.lua2
-rw-r--r--tex/context/base/mkiv/mult-prm.lua360
-rw-r--r--tex/context/base/mkiv/mult-prm.mkiv8
-rw-r--r--tex/context/base/mkiv/pack-obj.lua50
-rw-r--r--tex/context/base/mkiv/pack-obj.mkiv75
-rw-r--r--tex/context/base/mkiv/scrn-ref.mkvi2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25732 -> 25730 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin426110 -> 245447 bytes
-rw-r--r--tex/context/base/mkiv/strc-not.mkvi6
-rw-r--r--tex/context/base/mkiv/strc-ref.lua68
-rw-r--r--tex/context/base/mkiv/syst-ini.mkiv1
-rw-r--r--tex/context/base/mkiv/tabl-ntb.mkiv24
-rw-r--r--tex/context/fonts/mkiv/stix-two-math.lfg28
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin818489 -> 818494 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60765 -> 60767 bytes
-rw-r--r--tex/context/modules/mkiv/x-asciimath.lua8
-rw-r--r--tex/context/modules/mkiv/x-mathml.mkiv28
45 files changed, 529 insertions, 664 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 379974c0d..1fc148a68 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{2017.10.06 23:21}
+\newcontextversion{2017.10.10 12:00}
%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 6edac4011..8467e6ef8 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{2017.10.06 23:21}
+\edef\contextversion{2017.10.10 12:00}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/anch-pgr.lua b/tex/context/base/mkiv/anch-pgr.lua
index a30dc4497..ba767ccab 100644
--- a/tex/context/base/mkiv/anch-pgr.lua
+++ b/tex/context/base/mkiv/anch-pgr.lua
@@ -972,8 +972,8 @@ local function freemultipar(pagedata,frees) -- ,k
if trace_free then
report_free("case 4, inside, right")
end
- n = n + 1 temp[n] = { xmin, lly }
n = n + 1 temp[n] = { xmin, uly }
+ n = n + 1 temp[n] = { xmin, lly }
done = true
else
-- case 0
diff --git a/tex/context/base/mkiv/anch-pos.lua b/tex/context/base/mkiv/anch-pos.lua
index 16ecf7990..d082d8e92 100644
--- a/tex/context/base/mkiv/anch-pos.lua
+++ b/tex/context/base/mkiv/anch-pos.lua
@@ -26,7 +26,7 @@ local format, gmatch, match, find = string.format, string.gmatch, string.match,
local rawget = rawget
local lpegmatch = lpeg.match
local insert, remove = table.insert, table.remove
-local allocate, mark = utilities.storage.allocate, utilities.storage.mark
+local allocate = utilities.storage.allocate
local report = logs.reporter("positions")
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua
index 5e78c38b7..84be8cff9 100644
--- a/tex/context/base/mkiv/back-exp.lua
+++ b/tex/context/base/mkiv/back-exp.lua
@@ -818,16 +818,20 @@ do
function structurestags.setfigure(name,used,page,width,height,label)
local fulltag = locatedtag("image")
local spec = specifications[fulltag]
- local page = tonumber(page)
- image[fulltag] = {
- id = f_id(spec.tagname,spec.tagindex),
- name = name,
- used = used,
- page = page and page > 1 and page or nil,
- width = todimen(width, "cm","%0.3F%s"),
- height = todimen(height,"cm","%0.3F%s"),
- label = label,
- }
+ if spec then
+ local page = tonumber(page)
+ image[fulltag] = {
+ id = f_id(spec.tagname,spec.tagindex),
+ name = name,
+ used = used,
+ page = page and page > 1 and page or nil,
+ width = todimen(width, "cm","%0.3F%s"),
+ height = todimen(height,"cm","%0.3F%s"),
+ label = label,
+ }
+ else
+ -- we ignore images in layers in the background / pagebody
+ end
end
function extras.image(di,element,n,fulltag)
diff --git a/tex/context/base/mkiv/back-pdf.mkiv b/tex/context/base/mkiv/back-pdf.mkiv
index 70ffae197..221d0d109 100644
--- a/tex/context/base/mkiv/back-pdf.mkiv
+++ b/tex/context/base/mkiv/back-pdf.mkiv
@@ -108,7 +108,7 @@
\let\pdfcreationdate \relax \newtoks \pdfcreationdate
\let\pdfdecimaldigits \relax \newcount\pdfdecimaldigits
-\let\pdfdestmargin \relax \newcount\pdfdestmargin
+\let\pdfdestmargin \relax \newdimen\pdfdestmargin
\let\pdffontname \relax \newcount\pdffontname
\let\pdffontobjnum \relax \newcount\pdffontobjnum
\let\pdffontsize \relax \newcount\pdffontsize
@@ -127,7 +127,8 @@
\let\pdfinfoomitdate \relax \newcount\pdfinfoomitdate
\let\pdflastannot \relax \newcount\pdflastannot
\let\pdflastlink \relax \newcount\pdflastlink
-\let\pdflinkmargin \relax \newcount\pdflinkmargin
+\let\pdflinkmargin \relax \newdimen\pdflinkmargin
+\let\pdfmajorversion \relax \newcount\pdfmajorversion
\let\pdfminorversion \relax \newcount\pdfminorversion
\let\pdfpagebox \relax \newcount\pdfpagebox
\let\pdfpageref \relax \newcount\pdfpageref
@@ -139,11 +140,11 @@
\let\pdfsuppressptexinfo \relax \newcount\pdfsuppressptexinfo
\let\pdftexrevision \relax \newcount\pdftexrevision
\let\pdftexversion \relax \newcount\pdftexversion
-\let\pdfthreadmargin \relax \newcount\pdfthreadmargin
+\let\pdfthreadmargin \relax \newdimen\pdfthreadmargin
\let\pdftrailerid \relax \newtoks \pdftrailerid
\let\pdfuniqueresname \relax \newcount\pdfuniqueresname
\let\pdfvorigin \relax \newcount\pdfvorigin
-\let\pdfxformmargin \relax \newcount\pdfxformmargin
+\let\pdfxformmargin \relax \newdimen\pdfxformmargin
\let\pdfxformname \relax \newcount\pdfxformname
%D These are still accepted but are normally not needed.
diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua
index 600f9c959..2bbec2e4a 100644
--- a/tex/context/base/mkiv/buff-ini.lua
+++ b/tex/context/base/mkiv/buff-ini.lua
@@ -216,21 +216,21 @@ implement {
arguments = "string"
}
-local anything = patterns.anything
-local alwaysmatched = patterns.alwaysmatched
-local utf8character = patterns.utf8character
-
-local function countnesting(b,e)
- local n
- local g = P(b) / function() n = n + 1 end
- + P(e) / function() n = n - 1 end
- -- + anything
- + utf8character
- local p = alwaysmatched / function() n = 0 end
- * g^0
- * alwaysmatched / function() return n end
- return p
-end
+-- local anything = patterns.anything
+-- local alwaysmatched = patterns.alwaysmatched
+-- local utf8character = patterns.utf8character
+--
+-- local function countnesting(b,e)
+-- local n
+-- local g = P(b) / function() n = n + 1 end
+-- + P(e) / function() n = n - 1 end
+-- -- + anything
+-- + utf8character
+-- local p = alwaysmatched / function() n = 0 end
+-- * g^0
+-- * alwaysmatched / function() return n end
+-- return p
+-- end
local counters = { }
local nesting = 0
diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua
index 1dcb62fb3..c17eb2726 100644
--- a/tex/context/base/mkiv/char-ini.lua
+++ b/tex/context/base/mkiv/char-ini.lua
@@ -725,7 +725,7 @@ setmetatableindex(characters.is_punctuation,mti)
--
-- comments taken from standard:
-characters.linebreaks = {
+characters.linebreaks = allocate {
-- non-tailorable line breaking classes
@@ -820,7 +820,7 @@ table we derive a few more.</p>
if not characters.fallbacks then
- characters.fallbacks = {
+ characters.fallbacks = allocate {
[0x0308] = 0x00A8, [0x00A8] = 0x0308, -- dieresiscmb dieresis
[0x0304] = 0x00AF, [0x00AF] = 0x0304, -- macroncmb macron
[0x0301] = 0x00B4, [0x00B4] = 0x0301, -- acutecomb acute
diff --git a/tex/context/base/mkiv/char-utf.lua b/tex/context/base/mkiv/char-utf.lua
index 2d557d4af..0aeadcc85 100644
--- a/tex/context/base/mkiv/char-utf.lua
+++ b/tex/context/base/mkiv/char-utf.lua
@@ -39,6 +39,7 @@ local utfchartabletopattern = lpeg.utfchartabletopattern
local formatters = string.formatters
local allocate = utilities.storage.allocate or function() return { } end
+local mark = utilities.storage.mark or allocate
local charfromnumber = characters.fromnumber
@@ -86,7 +87,13 @@ local graphemes = characters.graphemes
local collapsed = characters.collapsed
local mathlists = characters.mathlists
-if not graphemes then
+if graphemes then
+
+ mark(graphemes)
+ mark(collapsed)
+ mark(mathlists)
+
+else
graphemes = allocate()
collapsed = allocate()
@@ -167,9 +174,9 @@ if not graphemes then
mlists = nil
if storage then
- storage.register("characters/graphemes", characters.graphemes, "characters.graphemes")
- storage.register("characters/collapsed", characters.collapsed, "characters.collapsed")
- storage.register("characters/mathlists", characters.mathlists, "characters.mathlists")
+ storage.register("characters/graphemes", graphemes, "characters.graphemes")
+ storage.register("characters/collapsed", collapsed, "characters.collapsed")
+ storage.register("characters/mathlists", mathlists, "characters.mathlists")
end
end
diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua
index 3c91f5fba..391160ebe 100644
--- a/tex/context/base/mkiv/cldf-ini.lua
+++ b/tex/context/base/mkiv/cldf-ini.lua
@@ -319,7 +319,7 @@ local interfacescanners = setmetatablenewindex(function(t,k,v)
rawset(t,k,v)
end)
-interfaces.scanners = interfacescanners
+interfaces.scanners = storage.mark(interfacescanners)
context.functions = {
register = registerfunction,
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index b6e4ff5fe..f61d816f5 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.10.06 23:21}
+\newcontextversion{2017.10.10 12:00}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/cont-run.lua b/tex/context/base/mkiv/cont-run.lua
index 6c2880438..657973f59 100644
--- a/tex/context/base/mkiv/cont-run.lua
+++ b/tex/context/base/mkiv/cont-run.lua
@@ -247,6 +247,16 @@ local function processjob()
-- context.input(filename)
-- context.stoptext()
+ elseif suffix == "mps" or arguments.forcemps then
+
+ report("processing metapost output: %s",filename)
+
+ context.starttext()
+ context.startTEXpage()
+ context.externalfigure { filename }
+ context.stopTEXpage()
+ context.stoptext()
+
else
-- \writestatus{system}{processing as tex}
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 0b49db31a..8eb7bd70f 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.10.06 23:21}
+\edef\contextversion{2017.10.10 12:00}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/core-uti.lua b/tex/context/base/mkiv/core-uti.lua
index 14a30aaf2..c9f003061 100644
--- a/tex/context/base/mkiv/core-uti.lua
+++ b/tex/context/base/mkiv/core-uti.lua
@@ -297,14 +297,16 @@ function job.load(filename)
local target = list[1]
local initializer = list[3]
local result = accesstable(target,utilitydata)
- local done = packers.unpack(result,jobpacker,true)
- if done then
- migratetable(target,mark(result))
- if type(initializer) == "function" then
- handlers[#handlers+1] = { initializer, result }
+ if result then
+ local done = packers.unpack(result,jobpacker,true)
+ if done then
+ migratetable(target,mark(result))
+ if type(initializer) == "function" then
+ handlers[#handlers+1] = { initializer, result }
+ end
+ else
+ report_passes("pack version mismatch")
end
- else
- report_passes("pack version mismatch")
end
end
-- so we have all tables available (unpacked)
diff --git a/tex/context/base/mkiv/file-mod.mkvi b/tex/context/base/mkiv/file-mod.mkvi
index 06c02f0e1..b769b52c5 100644
--- a/tex/context/base/mkiv/file-mod.mkvi
+++ b/tex/context/base/mkiv/file-mod.mkvi
@@ -73,13 +73,16 @@
\let\currentmoduleparameters\empty
\let\currentmodule \s!unknown
+\newcount \c_syst_modules_nesting
+
\newtoks\everysetupmodule
\unexpanded\def\startmodule
{\doifelsenextoptionalcs\syst_modules_start_yes\syst_modules_start_nop}
\def\syst_modules_start_yes[#name]%
- {\pushmacro\currentmodule
+ {\global\advance\c_syst_modules_nesting\plusone
+ \pushmacro\currentmodule
\pushmacro\currentmoduleparameters
\def\currentmodule{#name}}
@@ -87,8 +90,13 @@
{\syst_modules_start_yes[#name]}
\unexpanded\def\stopmodule
- {\popmacro\currentmoduleparameters
- \popmacro\currentmodule}
+ {\ifcase\c_syst_modules_nesting
+ \writestatus\m!system{module wrapping error in '\currentmodule'}%
+ \else
+ \popmacro\currentmoduleparameters
+ \popmacro\currentmodule
+ \global\advance\c_syst_modules_nesting\minusone
+ \fi}
\unexpanded\def\setupmodule
{\dodoubleempty\syst_modules_setup}
diff --git a/tex/context/base/mkiv/font-agl.lua b/tex/context/base/mkiv/font-agl.lua
index ec6c519ee..aec6415f7 100644
--- a/tex/context/base/mkiv/font-agl.lua
+++ b/tex/context/base/mkiv/font-agl.lua
@@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['font-agl'] = {
}
local allocate = utilities.storage.allocate
+local mark = utilities.storage.mark
fonts = fonts or { }
local encodings = fonts.encodings or { }
@@ -16,7 +17,7 @@ fonts.encodings.agl = agl
table.setmetatableindex(agl,nil) -- prevent recursive lookups otherwise when autoloaded
-local synonyms = {
+local synonyms = allocate {
Acyrillic = 0x0410,
Becyrillic = 0x0411,
Cdot = 0x010A,
@@ -644,7 +645,13 @@ local names = agl.names
local unicodes = agl.unicodes
local ctxcodes = agl.ctxcodes
-if not names then
+if names then
+
+ mark(names)
+ mark(unicodes)
+ mark(ctxcodes)
+
+else
names = allocate { } -- filled from char-def.lua
unicodes = allocate { }
@@ -678,9 +685,9 @@ if not names then
end
if storage then
- storage.register("encodings/names", names, "fonts.encodings.names")
- storage.register("encodings/unicodes", unicodes, "fonts.encodings.unicodes")
- storage.register("encodings/ctxcodes", ctxcodes, "fonts.encodings.ctxcodes")
+ storage.register("encodings/names", names, "fonts.encodings.agl.names")
+ storage.register("encodings/unicodes", unicodes, "fonts.encodings.agl.unicodes")
+ storage.register("encodings/ctxcodes", ctxcodes, "fonts.encodings.agl.ctxcodes")
end
end
diff --git a/tex/context/base/mkiv/font-enc.lua b/tex/context/base/mkiv/font-enc.lua
index 1470f3b8d..f448685a6 100644
--- a/tex/context/base/mkiv/font-enc.lua
+++ b/tex/context/base/mkiv/font-enc.lua
@@ -13,6 +13,9 @@ local match, gmatch, gsub = string.match, string.gmatch, string.gsub
local setmetatableindex = table.setmetatableindex
+local allocate = utilities.storage.allocate
+local mark = utilities.storage.mark
+
--[[ldx--
<p>Because encodings are going to disappear, we don't bother defining
them in tables. But we may do so some day, for consistency.</p>
@@ -25,7 +28,7 @@ fonts.encodings = encodings
encodings.version = 1.03
encodings.cache = containers.define("fonts", "enc", fonts.encodings.version, true)
-encodings.known = utilities.storage.allocate { -- sort of obsolete
+encodings.known = allocate { -- sort of obsolete
texnansi = true,
ec = true,
qx = true,
@@ -152,7 +155,7 @@ if not encodings.agl then
-- font is loaded for caching. Once we're further along the route we can also
-- delay it in the generic version (which doesn't use this file).
- encodings.agl = { }
+ encodings.agl = allocate { }
setmetatableindex(encodings.agl, function(t,k)
report_encoding("loading (extended) adobe glyph list")
diff --git a/tex/context/base/mkiv/font-map.lua b/tex/context/base/mkiv/font-map.lua
index 706c5b709..0fc525805 100644
--- a/tex/context/base/mkiv/font-map.lua
+++ b/tex/context/base/mkiv/font-map.lua
@@ -269,7 +269,7 @@ local namesplitter = Ct(C((1 - ligseparator - varseparator)^1) * (ligseparator *
do
- local overloads = allocate {
+ local overloads = {
IJ = { name = "I_J", unicode = { 0x49, 0x4A }, mess = 0x0132 },
ij = { name = "i_j", unicode = { 0x69, 0x6A }, mess = 0x0133 },
ff = { name = "f_f", unicode = { 0x66, 0x66 }, mess = 0xFB00 },
@@ -284,7 +284,7 @@ do
-- emdash = { name = "emdash", unicode = 0x2014, mess = 0x2014 },
}
- local o = { }
+ local o = allocate { }
for k, v in next, overloads do
local name = v.name
diff --git a/tex/context/base/mkiv/font-ota.lua b/tex/context/base/mkiv/font-ota.lua
index 743951d50..9c6ee7403 100644
--- a/tex/context/base/mkiv/font-ota.lua
+++ b/tex/context/base/mkiv/font-ota.lua
@@ -71,7 +71,7 @@ local s_isol = 4 local s_blwf = 10
local s_mark = 5 local s_pstf = 11
local s_rest = 6
-local states = {
+local states = allocate {
init = s_init,
medi = s_medi,
med2 = s_medi,
@@ -88,7 +88,7 @@ local states = {
pstf = s_pstf,
}
-local features = {
+local features = allocate {
init = s_init,
medi = s_medi,
med2 = s_medi,
@@ -247,7 +247,7 @@ local function warning(current,what)
end
end
-local mappers = {
+local mappers = allocate {
l = s_init, -- left
d = s_medi, -- double
c = s_medi, -- joiner
diff --git a/tex/context/base/mkiv/font-syn.lua b/tex/context/base/mkiv/font-syn.lua
index c4dcf0bcd..52ddf621f 100644
--- a/tex/context/base/mkiv/font-syn.lua
+++ b/tex/context/base/mkiv/font-syn.lua
@@ -423,8 +423,9 @@ filters.list = {
-- to be considered: loop over paths per list entry (so first all otf ttf etc)
-names.fontconfigfile = "fonts.conf" -- a bit weird format, bonus feature
-names.osfontdirvariable = "OSFONTDIR" -- the official way, in minimals etc
+names.fontconfigfile = "fonts.conf" -- a bit weird format, bonus feature
+names.osfontdirvariable = "OSFONTDIR" -- the official way, in minimals etc
+names.extrafontsvariable = "EXTRAFONTS" -- the official way, in minimals etc
filters.paths = { }
filters.names = { }
@@ -436,7 +437,7 @@ function names.getpaths(trace)
local v = cleanpath(t[i])
v = gsub(v,"/+$","") -- not needed any more
local key = lower(v)
- report_names("%a specifies path %a",where,v)
+ report_names("variable %a specifies path %a",where,v)
if not hash[key] then
r = r + 1
result[r] = v
@@ -448,6 +449,10 @@ function names.getpaths(trace)
if path ~= "" then
collect(resolvers.expandedpathlist(path),path)
end
+ local path = names.extrafontsvariable or ""
+ if path ~= "" then
+ collect(resolvers.expandedpathlist(path),path)
+ end
if xml then
local confname = resolvers.expansion("FONTCONFIG_FILE") or ""
if confname == "" then
@@ -539,23 +544,6 @@ names.cleanfilename = cleanfilename
-- return result
-- end
-local function walk_tree(pathlist,suffix,identify)
- if pathlist then
- for i=1,#pathlist do
- local path = pathlist[i]
- path = cleanpath(path .. "/")
- path = gsub(path,"/+","/")
- local pattern = path .. "**." .. suffix -- ** forces recurse
- report_names("globbing path %a",pattern)
- local t = dir.glob(pattern)
- sort(t,sorter)
- for j=1,#t do
- local completename = t[j]
- identify(completename,basename(completename),suffix,completename)
- end
- end
- end
-end
local function check_name(data,result,filename,modification,suffix,subfont)
-- shortcuts
@@ -1002,9 +990,11 @@ local function unpackreferences()
end
local function analyzefiles(olddata)
+
if not trace_warnings then
report_names("warnings are disabled (tracker 'fonts.warnings')")
end
+
local data = names.data
local done = { }
local totalnofread = 0
@@ -1020,6 +1010,26 @@ local function analyzefiles(olddata)
local oldspecifications = olddata and olddata.specifications or { }
local oldrejected = olddata and olddata.rejected or { }
local treatmentdata = treatments.data or { } -- when used outside context
+ ----- walked = setmetatableindex("number")
+
+ local function walk_tree(pathlist,suffix,identify)
+ if pathlist then
+ for i=1,#pathlist do
+ local path = pathlist[i]
+ path = cleanpath(path .. "/")
+ path = gsub(path,"/+","/")
+ local pattern = path .. "**." .. suffix -- ** forces recurse
+ report_names("globbing path %a",pattern)
+ local t = dir.glob(pattern)
+ sort(t,sorter)
+ for j=1,#t do
+ local completename = t[j]
+ identify(completename,basename(completename),suffix,completename)
+ end
+ -- walked[path] = walked[path] + #t
+ end
+ end
+ end
local function identify(completename,name,suffix,storedname)
local pathpart, basepart = splitbase(completename)
@@ -1123,6 +1133,7 @@ local function analyzefiles(olddata)
end
logs.flush() -- a bit overkill for each font, maybe not needed here
end
+
local function traverse(what, method)
local list = filters.list
for n=1,#list do
@@ -1141,7 +1152,9 @@ local function analyzefiles(olddata)
end
logs.flush()
end
+
-- problem .. this will not take care of duplicates
+
local function withtree(suffix)
resolvers.dowithfilesintree(".*%." .. suffix .. "$", function(method,root,path,name)
if method == "file" or method == "tree" then
@@ -1158,16 +1171,20 @@ local function analyzefiles(olddata)
report_names("%s entries found, %s %s files checked, %s okay",total,checked,suffix,done)
end)
end
+
local function withlsr(suffix) -- all trees
-- we do this only for a stupid names run, not used for context itself,
-- using the vars is too clumsy so we just stick to a full scan instead
local pathlist = resolvers.splitpath(resolvers.showpath("ls-R") or "")
walk_tree(pathlist,suffix,identify)
end
+
local function withsystem(suffix) -- OSFONTDIR cum suis
walk_tree(names.getpaths(trace),suffix,identify)
end
+
traverse("tree",withtree) -- TEXTREE only
+
if not usesystemfonts then
report_names("ignoring system fonts")
elseif texconfig.kpse_init then
@@ -1175,9 +1192,15 @@ local function analyzefiles(olddata)
else
traverse("system", withsystem)
end
+
data.statistics.readfiles = totalnofread
data.statistics.skippedfiles = totalnofskipped
data.statistics.duplicatefiles = totalnofduplicates
+
+ -- for k, v in sortedhash(walked) do
+ -- report_names("%s : %i",k,v)
+ -- end
+
end
local function addfilenames()
diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua
index 81d13433d..fc1357afc 100644
--- a/tex/context/base/mkiv/l-lpeg.lua
+++ b/tex/context/base/mkiv/l-lpeg.lua
@@ -105,11 +105,14 @@ patterns.alwaysmatched = alwaysmatched
local sign = S('+-')
local zero = P('0')
local digit = R('09')
+local digits = digit^1
local octdigit = R("07")
+local octdigits = octdigit^1
local lowercase = R("az")
local uppercase = R("AZ")
local underscore = P("_")
local hexdigit = digit + lowercase + uppercase
+local hexdigits = hexdigit^1
local cr, lf, crlf = P("\r"), P("\n"), P("\r\n")
----- newline = crlf + S("\r\n") -- cr + lf
local newline = P("\r") * (P("\n") + P(true)) + P("\n") -- P("\r")^-1 * P("\n")^-1
@@ -242,33 +245,36 @@ patterns.doublequoted = dquote * patterns.nodquote * dquote
patterns.quoted = patterns.doublequoted + patterns.singlequoted
patterns.digit = digit
+patterns.digits = digits
patterns.octdigit = octdigit
+patterns.octdigits = octdigits
patterns.hexdigit = hexdigit
+patterns.hexdigits = hexdigits
patterns.sign = sign
-patterns.cardinal = digit^1
-patterns.integer = sign^-1 * digit^1
-patterns.unsigned = digit^0 * period * digit^1
+patterns.cardinal = digits
+patterns.integer = sign^-1 * digits
+patterns.unsigned = digit^0 * period * digits
patterns.float = sign^-1 * patterns.unsigned
-patterns.cunsigned = digit^0 * comma * digit^1
-patterns.cpunsigned = digit^0 * (period + comma) * digit^1
+patterns.cunsigned = digit^0 * comma * digits
+patterns.cpunsigned = digit^0 * (period + comma) * digits
patterns.cfloat = sign^-1 * patterns.cunsigned
patterns.cpfloat = sign^-1 * patterns.cpunsigned
patterns.number = patterns.float + patterns.integer
patterns.cnumber = patterns.cfloat + patterns.integer
patterns.cpnumber = patterns.cpfloat + patterns.integer
-patterns.oct = zero * octdigit^1
+patterns.oct = zero * octdigits
patterns.octal = patterns.oct
patterns.HEX = zero * P("X") * (digit+uppercase)^1
patterns.hex = zero * P("x") * (digit+lowercase)^1
-patterns.hexadecimal = zero * S("xX") * hexdigit^1
+patterns.hexadecimal = zero * S("xX") * hexdigits
patterns.hexafloat = sign^-1
* zero * S("xX")
- * (hexdigit^0 * period * hexdigit^1 + hexdigit^1 * period * hexdigit^0 + hexdigit^1)
- * (S("pP") * sign^-1 * hexdigit^1)^-1
+ * (hexdigit^0 * period * hexdigits + hexdigits * period * hexdigit^0 + hexdigits)
+ * (S("pP") * sign^-1 * hexdigits)^-1
patterns.decafloat = sign^-1
- * (digit^0 * period * digit^1 + digit^1 * period * digit^0 + digit^1)
- * S("eE") * sign^-1 * digit^1
+ * (digit^0 * period * digits + digits * period * digit^0 + digits)
+ * S("eE") * sign^-1 * digits
patterns.propername = (uppercase + lowercase + underscore) * (uppercase + lowercase + underscore + digit)^0 * endofstring
@@ -599,19 +605,27 @@ end
-- print(7,lpegmatch(lpeg.secondofsplit(":"),"bc"))
-- print(9,lpegmatch(lpeg.secondofsplit(":","123"),"bc"))
--- -- slower:
+-- this was slower but lpeg has been sped up in the meantime, so we no longer
+-- use this (still seems somewhat faster on long strings)
+--
+-- local nany = utf8char/""
--
-- function lpeg.counter(pattern)
--- local n, pattern = 0, (lpeg.P(pattern)/function() n = n + 1 end + lpeg.anything)^0
--- return function(str) n = 0 ; lpegmatch(pattern,str) ; return n end
+-- pattern = Cs((P(pattern)/" " + nany)^0)
+-- return function(str)
+-- return #lpegmatch(pattern,str)
+-- end
-- end
-local nany = utf8char/""
-
-function lpeg.counter(pattern)
- pattern = Cs((P(pattern)/" " + nany)^0)
- return function(str)
- return #lpegmatch(pattern,str)
+function lpeg.counter(pattern,action)
+ local n = 0
+ local pattern = (P(pattern) / function() n = n + 1 end + anything)^0
+ ----- pattern = (P(pattern) * (P(true) / function() n = n + 1 end) + anything)^0
+ ----- pattern = (P(pattern) * P(function() n = n + 1 end) + anything)^0
+ if action then
+ return function(str) n = 0 ; lpegmatch(pattern,str) ; action(n) end
+ else
+ return function(str) n = 0 ; lpegmatch(pattern,str) ; return n end
end
end
@@ -1103,7 +1117,7 @@ end
local trailingzeros = zero^0 * -digit -- suggested by Roberto R
local case_1 = period * trailingzeros / ""
local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "")
-local number = digit^1 * (case_1 + case_2)
+local number = digits * (case_1 + case_2)
local stripper = Cs((number + 1)^0)
lpeg.patterns.stripzeros = stripper
diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua
index ba8610933..5f378066d 100644
--- a/tex/context/base/mkiv/lpdf-ano.lua
+++ b/tex/context/base/mkiv/lpdf-ano.lua
@@ -558,13 +558,13 @@ local function pdffilelink(filename,destination,page,actions)
return false
end
filename = file.addsuffix(filename,"pdf")
- if not destination or destination == "" then
+ if (not destination or destination == "") or (references.outermethod == v_page) then
destination = pdfarray { (page or 0) - 1, pdf_fit }
end
return pdfdictionary {
S = pdf_gotor, -- can also be pdf_launch
F = filename,
- D = destination or defaultdestination, -- D is mandate
+ D = destination or defaultdestination,
NewWindow = actions.newwindow and true or nil,
}
end
diff --git a/tex/context/base/mkiv/lpdf-epa.lua b/tex/context/base/mkiv/lpdf-epa.lua
index c72e2a424..1912a7ff3 100644
--- a/tex/context/base/mkiv/lpdf-epa.lua
+++ b/tex/context/base/mkiv/lpdf-epa.lua
@@ -13,6 +13,8 @@ local type, tonumber = type, tonumber
local format, gsub, lower = string.format, string.gsub, string.lower
local formatters = string.formatters
local abs = math.abs
+local expandname = file.expandname
+local allocate = utilities.storage.allocate
----- lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
@@ -45,6 +47,23 @@ local layerspec = { -- predefining saves time
"epdflinks"
}
+local collected = allocate()
+local tobesaved = allocate()
+
+local jobembedded = {
+ collected = collected,
+ tobesaved = tobesaved,
+}
+
+job.embedded = jobembedded
+
+local function initializer()
+ tobesaved = jobembedded.tobesaved
+ collected = jobembedded.collected
+end
+
+job.register('job.embedded.collected',tobesaved,initializer)
+
local f_namespace = formatters["lpdf-epa-%s-"]
local function makenamespace(filename)
@@ -114,6 +133,16 @@ end
-- (see section 3.10 in the 1.7 reference) so we need to test for string as well
-- as a table. TH/20140916
+-- When embedded is set then files need to have page references which is seldom the
+-- case but you can generate them with context:
+--
+-- \setupinteraction[state=start,page={page,page}]
+--
+-- see tests/mkiv/interaction/cross[1|2|3].tex for an example
+
+local embedded = false directives.register("figures.embedded", function(v) embedded = v end)
+local reported = { }
+
local function link_file(x,y,w,h,document,annotation)
local a = annotation.A
if a then
@@ -129,9 +158,20 @@ local function link_file(x,y,w,h,document,annotation)
elseif type(destination) == "string" then
add_link(x,y,w,h,formatters["%s::%s"](filename,destination),"file (named)")
else
- destination = destination[1] -- array
- if tonumber(destination) then
- add_link(x,y,w,h,formatters["%s::page(%s)"](filename,destination),"file (page)")
+ -- hm, zero offset so maybe: destination + 1
+ destination = tonumber(destination[1]) -- array
+ if destination then
+ destination = destination + 1
+ local loaded = collected[lower(expandname(filename))]
+ if embedded and loaded then
+ add_link(x,y,w,h,makenamespace(filename) .. destination,what)
+ else
+ if loaded and not reported[filename] then
+ report_link("reference to an also loaded file %a, consider using directive: figures.embedded",filename)
+ reported[filename] = true
+ end
+ add_link(x,y,w,h,formatters["%s::page(%s)"](filename,destination),"file (page)")
+ end
else
add_link(x,y,w,h,formatters["file(%s)"](filename),"file")
end
@@ -145,77 +185,82 @@ function codeinjections.mergereferences(specification)
specification = figures and figures.current()
specification = specification and specification.status
end
- if specification then
- local fullname = specification.fullname
- local document = loadpdffile(fullname) -- costs time
- if document then
- local pagenumber = specification.page or 1
- local xscale = specification.yscale or 1
- local yscale = specification.yscale or 1
- local size = specification.size or "crop" -- todo
- local pagedata = document.pages[pagenumber]
- local annotations = pagedata and pagedata.Annots
- local namespace = makenamespace(fullname)
- local reference = namespace .. pagenumber
- if annotations and annotations.n > 0 then
- local mediabox = pagedata.MediaBox
- local llx = mediabox[1]
- local lly = mediabox[2]
- local urx = mediabox[3]
- local ury = mediabox[4]
- local width = xscale * (urx - llx) -- \\overlaywidth, \\overlayheight
- local height = yscale * (ury - lly) -- \\overlaywidth, \\overlayheight
- context.definelayer( { "epdflinks" }, { height = height.."bp" , width = width.."bp" })
- for i=1,annotations.n do
- local annotation = annotations[i]
- if annotation then
- local subtype = annotation.Subtype
- local rectangle = annotation.Rect
- local a_llx = rectangle[1]
- local a_lly = rectangle[2]
- local a_urx = rectangle[3]
- local a_ury = rectangle[4]
- local x = xscale * (a_llx - llx)
- local y = yscale * (a_lly - lly)
- local w = xscale * (a_urx - a_llx)
- local h = yscale * (a_ury - a_lly)
- if subtype == "Link" then
- local a = annotation.A
- if not a then
- report_link("missing link annotation")
- elseif w > width or h > height or w < 0 or h < 0 or abs(x) > (maxdimen/2) or abs(y) > (maxdimen/2) then
- report_link("broken link rectangle [%f %f %f %f] (max: %f)",a_llx,a_lly,a_urx,a_ury,maxdimen/2)
- else
- local linktype = a.S
- if linktype == "GoTo" then
- link_goto(x,y,w,h,document,annotation,pagedata,namespace)
- elseif linktype == "GoToR" then
- link_file(x,y,w,h,document,annotation)
- elseif linktype == "URI" then
- link_uri(x,y,w,h,document,annotation)
- elseif trace_links then
- report_link("unsupported link annotation %a",linktype)
- end
- end
+ if not specification then
+ return ""
+ end
+ local fullname = specification.fullname
+ local expanded = lower(expandname(fullname))
+ -- we could add a check for duplicate page insertion
+ tobesaved[expanded] = true
+ --- but that is messy anyway so we forget about it
+ local document = loadpdffile(fullname) -- costs time
+ if not document then
+ return ""
+ end
+ local pagenumber = specification.page or 1
+ local xscale = specification.yscale or 1
+ local yscale = specification.yscale or 1
+ local size = specification.size or "crop" -- todo
+ local pagedata = document.pages[pagenumber]
+ local annotations = pagedata and pagedata.Annots
+ local namespace = makenamespace(fullname)
+ local reference = namespace .. pagenumber
+ if annotations and annotations.n > 0 then
+ local mediabox = pagedata.MediaBox
+ local llx = mediabox[1]
+ local lly = mediabox[2]
+ local urx = mediabox[3]
+ local ury = mediabox[4]
+ local width = xscale * (urx - llx) -- \\overlaywidth, \\overlayheight
+ local height = yscale * (ury - lly) -- \\overlaywidth, \\overlayheight
+ context.definelayer( { "epdflinks" }, { height = height.."bp" , width = width.."bp" })
+ for i=1,annotations.n do
+ local annotation = annotations[i]
+ if annotation then
+ local subtype = annotation.Subtype
+ local rectangle = annotation.Rect
+ local a_llx = rectangle[1]
+ local a_lly = rectangle[2]
+ local a_urx = rectangle[3]
+ local a_ury = rectangle[4]
+ local x = xscale * (a_llx - llx)
+ local y = yscale * (a_lly - lly)
+ local w = xscale * (a_urx - a_llx)
+ local h = yscale * (a_ury - a_lly)
+ if subtype == "Link" then
+ local a = annotation.A
+ if not a then
+ report_link("missing link annotation")
+ elseif w > width or h > height or w < 0 or h < 0 or abs(x) > (maxdimen/2) or abs(y) > (maxdimen/2) then
+ report_link("broken link rectangle [%f %f %f %f] (max: %f)",a_llx,a_lly,a_urx,a_ury,maxdimen/2)
+ else
+ local linktype = a.S
+ if linktype == "GoTo" then
+ link_goto(x,y,w,h,document,annotation,pagedata,namespace)
+ elseif linktype == "GoToR" then
+ link_file(x,y,w,h,document,annotation)
+ elseif linktype == "URI" then
+ link_uri(x,y,w,h,document,annotation)
elseif trace_links then
- report_link("unsupported annotation %a",subtype)
+ report_link("unsupported link annotation %a",linktype)
end
- elseif trace_links then
- report_link("broken annotation, index %a",i)
end
+ elseif trace_links then
+ report_link("unsupported annotation %a",subtype)
end
- context.flushlayer { "epdflinks" }
- end
- -- moved outside previous test
- context.setgvalue("figurereference",reference) -- global
- if trace_links then
- report_link("setting figure reference to %a",reference)
+ elseif trace_links then
+ report_link("broken annotation, index %a",i)
end
- specification.reference = reference
- return namespace
end
+ context.flushlayer { "epdflinks" }
+ end
+ -- moved outside previous test
+ context.setgvalue("figurereference",reference) -- global
+ if trace_links then
+ report_link("setting figure reference to %a",reference)
end
- return ""-- no namespace, empty, not nil
+ specification.reference = reference
+ return namespace
end
function codeinjections.mergeviewerlayers(specification)
diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua
index cdac18a25..520eb7783 100644
--- a/tex/context/base/mkiv/lpdf-ini.lua
+++ b/tex/context/base/mkiv/lpdf-ini.lua
@@ -68,15 +68,12 @@ local context = context
local pdf = pdf
local factor = number.dimenfactors.bp
-do
-
- local texget = tex.get
- local texset = tex.set
+if not pdf.setmajorversion then do
- function pdf.setmajorversion (n) texset("global","pdfmajorversion", n) end
- function pdf.getmajorversion ( ) return texget("pdfmajorversion") end
+ function pdf.setmajorversion () end
+ function pdf.getmajorversion () end
-end
+end end
local pdfsetinfo = pdf.setinfo
local pdfsetcatalog = pdf.setcatalog
diff --git a/tex/context/base/mkiv/lpdf-res.lua b/tex/context/base/mkiv/lpdf-res.lua
index 8a8f2b17b..8b00835ef 100644
--- a/tex/context/base/mkiv/lpdf-res.lua
+++ b/tex/context/base/mkiv/lpdf-res.lua
@@ -21,8 +21,8 @@ local saveboxresource = tex.saveboxresource
local useboxresource = tex.useboxresource
local getboxresource = tex.getboxresourcedimensions
-function codeinjections.registerboxresource(n)
- local r = saveboxresource(n,nil,lpdf.collectedresources(),true) -- direct, todo: accept functions as attr/resources
+function codeinjections.registerboxresource(n,offset)
+ local r = saveboxresource(n,nil,lpdf.collectedresources(),true,0,offset or 0) -- direct, todo: accept functions as attr/resources
return r
end
diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv
index 83d190e61..03197162d 100644
--- a/tex/context/base/mkiv/math-ini.mkiv
+++ b/tex/context/base/mkiv/math-ini.mkiv
@@ -784,29 +784,21 @@
\c!functionstyle=, % rm ss etc i.e. known alternatives, otherwise math
\c!functioncolor=]
-% \unexpanded\def\math_mfunction_styled
-% {\edef\m_math_text_choice_face{\textstyleface\normalmathstyle}%
-% \dowithnextbox
-% {\mathop{\box\nextbox}}%
-% \hbox\bgroup
-% \usemathematicsstyleandcolor\c!functionstyle\c!functioncolor
-% \m_math_text_choice_face
-% \let\next}
-
\unexpanded\def\math_mfunction_styled
{\begingroup
\usemathematicscolorparameter\c!functioncolor
\edef\p_functionstyle{\mathematicsparameter\c!functionstyle}%
\ifx\p_functionstyle\empty
\expandafter\math_mfunction_styled_none
- \else\ifcsname\??alternativestyles\p_functionstyle\endcsname
+ \else\ifcsname\??alternativestyle\p_functionstyle\endcsname
\doubleexpandafter\math_mfunction_styled_text
\else
\doubleexpandafter\math_mfunction_styled_math
\fi\fi}
\unexpanded\def\math_mfunction_styled_text#1%
- {\mathoptext{\csname\??alternativestyles\p_functionstyle\endcsname#1}%
+ %{\mathoptext{\csname\??alternativestyle\p_functionstyle\endcsname#1}%
+ {\expandafter\mathoptext\expandafter{\lastnamedcs#1}%
\endgroup}
\unexpanded\def\math_mfunction_styled_math#1%
diff --git a/tex/context/base/mkiv/meta-imp-nodes.mkiv b/tex/context/base/mkiv/meta-imp-nodes.mkiv
index 2555fcaa2..557eac2cc 100644
--- a/tex/context/base/mkiv/meta-imp-nodes.mkiv
+++ b/tex/context/base/mkiv/meta-imp-nodes.mkiv
@@ -27,6 +27,11 @@
[node]
[\c!frame=\v!off]
+\defineframed
+ [smallnode]
+ [node]
+ [\c!foregroundstyle=\small]
+
\startMPdefinitions{nodes}
loadmodule "node" ;
\stopMPdefinitions
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua
index 9831efc20..3406d05db 100644
--- a/tex/context/base/mkiv/mlib-lua.lua
+++ b/tex/context/base/mkiv/mlib-lua.lua
@@ -13,9 +13,10 @@ if not modules then modules = { } end modules ['mlib-lua'] = {
local type, tostring, select, loadstring = type, tostring, select, loadstring
local find, match, gsub, gmatch = string.find, string.match, string.gsub, string.gmatch
-local formatters = string.formatters
-local concat = table.concat
-local lpegmatch = lpeg.match
+local formatters = string.formatters
+local concat = table.concat
+local lpegmatch = lpeg.match
+local lpegpatterns = lpeg.patterns
local P, S, Ct = lpeg.P, lpeg.S, lpeg.Ct
@@ -230,8 +231,8 @@ function mp.n(t)
return type(t) == "table" and #t or 0
end
-local whitespace = lpeg.patterns.whitespace
-local newline = lpeg.patterns.newline
+local whitespace = lpegpatterns.whitespace
+local newline = lpegpatterns.newline
local setsep = newline^2
local comment = (S("#%") + P("--")) * (1-newline)^0 * (whitespace - setsep)^0
local value = (1-whitespace)^1 / tonumber
@@ -479,13 +480,15 @@ function mp.prefix(str)
mpquoted(match(str,"^(.-)[%d%[]") or str)
end
-function mp.dimensions(str)
- local n = 0
- for s in gmatch(str,"%[?%-?%d+%]?") do --todo: lpeg
- n = n + 1
- end
- mpprint(n)
-end
+-- function mp.dimension(str)
+-- local n = 0
+-- for s in gmatch(str,"%[?%-?%d+%]?") do --todo: lpeg
+-- n = n + 1
+-- end
+-- mpprint(n)
+-- end
+
+mp.dimension = lpeg.counter(P("[") * lpegpatterns.integer * P("]") + lpegpatterns.integer,mpprint)
-- faster and okay as we don't have many variables but probably only
-- basename makes sense and even then it's not called that often
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index 6fe57b2ce..6b7bf47b3 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -313,7 +313,7 @@ return {
"gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments",
"gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals",
--
- "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "dowith",
+ "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "fastloopindex", "fastloopfinal", "dowith",
--
"newconstant", "setnewconstant", "setconstant", "setconstantvalue",
"newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue",
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index e28150052..cf12388a0 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -282,11 +282,11 @@ return {
"luatexbanner",
"luatexrevision",
"luatexversion",
+ "mathdelimitersmode",
"mathdir",
"mathdisplayskipmode",
"matheqnogapstep",
"mathitalicsmode",
- "mathdelimitersmode",
"mathnolimitsmode",
"mathoption",
"mathpenaltiesmode",
@@ -315,13 +315,13 @@ return {
"pdfextension",
"pdffeedback",
"pdfvariable",
- "postdisplaypenalty",
"postexhyphenchar",
"posthyphenchar",
+ "prebinoppenalty",
"predisplaygapfactor",
- "predisplaypenalty",
"preexhyphenchar",
"prehyphenchar",
+ "prerelpenalty",
"primitive",
"protrudechars",
"pxdimen",
@@ -357,13 +357,6 @@ return {
"Omegaminorversion",
"Omegarevision",
"Omegaversion",
- "odelcode",
- "odelimiter",
- "omathaccent",
- "omathchar",
- "omathchardef",
- "omathcode",
- "oradical",
},
["pdftex"]={
"ifpdfabsdim",
@@ -479,217 +472,46 @@ return {
" ",
"-",
"/",
- "Uchar",
- "Udelcode",
- "Udelcodenum",
- "Udelimiter",
- "Udelimiterover",
- "Udelimiterunder",
- "Uhextensible",
"Uleft",
- "Umathaccent",
- "Umathaxis",
- "Umathbinbinspacing",
- "Umathbinclosespacing",
- "Umathbininnerspacing",
- "Umathbinopenspacing",
- "Umathbinopspacing",
- "Umathbinordspacing",
- "Umathbinpunctspacing",
- "Umathbinrelspacing",
- "Umathchar",
- "Umathcharclass",
- "Umathchardef",
- "Umathcharfam",
- "Umathcharnum",
- "Umathcharnumdef",
- "Umathcharslot",
- "Umathclosebinspacing",
- "Umathcloseclosespacing",
- "Umathcloseinnerspacing",
- "Umathcloseopenspacing",
- "Umathcloseopspacing",
- "Umathcloseordspacing",
- "Umathclosepunctspacing",
- "Umathcloserelspacing",
- "Umathcode",
- "Umathcodenum",
- "Umathconnectoroverlapmin",
- "Umathfractiondelsize",
- "Umathfractiondenomdown",
- "Umathfractiondenomvgap",
- "Umathfractionnumup",
- "Umathfractionnumvgap",
- "Umathfractionrule",
- "Umathinnerbinspacing",
- "Umathinnerclosespacing",
- "Umathinnerinnerspacing",
- "Umathinneropenspacing",
- "Umathinneropspacing",
- "Umathinnerordspacing",
- "Umathinnerpunctspacing",
- "Umathinnerrelspacing",
- "Umathlimitabovebgap",
- "Umathlimitabovekern",
- "Umathlimitabovevgap",
- "Umathlimitbelowbgap",
- "Umathlimitbelowkern",
- "Umathlimitbelowvgap",
- "Umathnolimitsubfactor",
- "Umathnolimitsupfactor",
- "Umathopbinspacing",
- "Umathopclosespacing",
- "Umathopenbinspacing",
- "Umathopenclosespacing",
- "Umathopeninnerspacing",
- "Umathopenopenspacing",
- "Umathopenopspacing",
- "Umathopenordspacing",
- "Umathopenpunctspacing",
- "Umathopenrelspacing",
- "Umathoperatorsize",
- "Umathopinnerspacing",
- "Umathopopenspacing",
- "Umathopopspacing",
- "Umathopordspacing",
- "Umathoppunctspacing",
- "Umathoprelspacing",
- "Umathordbinspacing",
- "Umathordclosespacing",
- "Umathordinnerspacing",
- "Umathordopenspacing",
- "Umathordopspacing",
- "Umathordordspacing",
- "Umathordpunctspacing",
- "Umathordrelspacing",
- "Umathoverbarkern",
- "Umathoverbarrule",
- "Umathoverbarvgap",
- "Umathoverdelimiterbgap",
- "Umathoverdelimitervgap",
- "Umathpunctbinspacing",
- "Umathpunctclosespacing",
- "Umathpunctinnerspacing",
- "Umathpunctopenspacing",
- "Umathpunctopspacing",
- "Umathpunctordspacing",
- "Umathpunctpunctspacing",
- "Umathpunctrelspacing",
- "Umathquad",
- "Umathradicaldegreeafter",
- "Umathradicaldegreebefore",
- "Umathradicaldegreeraise",
- "Umathradicalkern",
- "Umathradicalrule",
- "Umathradicalvgap",
- "Umathrelbinspacing",
- "Umathrelclosespacing",
- "Umathrelinnerspacing",
- "Umathrelopenspacing",
- "Umathrelopspacing",
- "Umathrelordspacing",
- "Umathrelpunctspacing",
- "Umathrelrelspacing",
- "Umathskewedfractionhgap",
- "Umathskewedfractionvgap",
- "Umathspaceafterscript",
- "Umathstackdenomdown",
- "Umathstacknumup",
- "Umathstackvgap",
- "Umathsubshiftdown",
- "Umathsubshiftdrop",
- "Umathsubsupshiftdown",
- "Umathsubsupvgap",
- "Umathsubtopmax",
- "Umathsupbottommin",
- "Umathsupshiftdrop",
- "Umathsupshiftup",
- "Umathsupsubbottommax",
- "Umathunderbarkern",
- "Umathunderbarrule",
- "Umathunderbarvgap",
- "Umathunderdelimiterbgap",
- "Umathunderdelimitervgap",
"Umiddle",
- "Unosubscript",
- "Unosuperscript",
- "Uoverdelimiter",
- "Uradical",
"Uright",
- "Uroot",
- "Uskewed",
- "Uskewedwithdelims",
- "Ustack",
- "Ustartdisplaymath",
- "Ustartmath",
- "Ustopdisplaymath",
- "Ustopmath",
- "Usubscript",
- "Usuperscript",
- "Uunderdelimiter",
- "Uvextensible",
"above",
"abovedisplayshortskip",
"abovedisplayskip",
"abovewithdelims",
"accent",
"adjdemerits",
- "adjustspacing",
"advance",
"afterassignment",
"aftergroup",
- "alignmark",
- "aligntab",
"atop",
"atopwithdelims",
- "attribute",
- "attributedef",
- "automaticdiscretionary",
- "automatichyphenmode",
- "automatichyphenpenalty",
"badness",
"baselineskip",
"batchmode",
- "begincsname",
"begingroup",
"belowdisplayshortskip",
"belowdisplayskip",
"binoppenalty",
- "bodydir",
"botmark",
- "botmarks",
"boundary",
"box",
- "boxdir",
"boxmaxdepth",
"brokenpenalty",
"catcode",
- "catcodetable",
"char",
"chardef",
"cleaders",
- "clearmarks",
"closein",
"closeout",
- "clubpenalties",
"clubpenalty",
"copy",
- "copyfont",
"count",
"countdef",
"cr",
- "crampeddisplaystyle",
- "crampedscriptscriptstyle",
- "crampedscriptstyle",
- "crampedtextstyle",
"crcr",
"csname",
"csstring",
- "currentgrouplevel",
- "currentgrouptype",
- "currentifbranch",
- "currentiflevel",
- "currentiftype",
"day",
"deadcycles",
"def",
@@ -699,32 +521,20 @@ return {
"delimiter",
"delimiterfactor",
"delimitershortfall",
- "detokenize",
"dimen",
"dimendef",
- "dimexpr",
"directlua",
"discretionary",
"displayindent",
"displaylimits",
"displaystyle",
- "displaywidowpenalties",
"displaywidowpenalty",
"displaywidth",
"divide",
"doublehyphendemerits",
"dp",
- "draftmode",
"dump",
- "dviextension",
- "dvifeedback",
- "dvivariable",
- "eTeXVersion",
- "eTeXminorversion",
- "eTeXrevision",
- "eTeXversion",
"edef",
- "efcode",
"else",
"emergencystretch",
"end",
@@ -738,11 +548,8 @@ return {
"errorcontextlines",
"errorstopmode",
"escapechar",
- "etoksapp",
- "etokspre",
"everycr",
"everydisplay",
- "everyeof",
"everyhbox",
"everyjob",
"everymath",
@@ -751,37 +558,19 @@ return {
"exhyphenchar",
"exhyphenpenalty",
"expandafter",
- "expanded",
- "expandglyphsinfont",
- "explicitdiscretionary",
- "explicithyphenpenalty",
"fam",
"fi",
"finalhyphendemerits",
"firstmark",
- "firstmarks",
"firstvalidlanguage",
"floatingpenalty",
"font",
- "fontchardp",
- "fontcharht",
- "fontcharic",
- "fontcharwd",
"fontdimen",
- "fontid",
"fontname",
- "formatname",
"futurelet",
"gdef",
- "gleaders",
"global",
"globaldefs",
- "glueexpr",
- "glueshrink",
- "glueshrinkorder",
- "gluestretch",
- "gluestretchorder",
- "gluetomu",
"halign",
"hangafter",
"hangindent",
@@ -791,7 +580,6 @@ return {
"hfill",
"hfilneg",
"hfuzz",
- "hjcode",
"hoffset",
"holdinginserts",
"hpack",
@@ -801,97 +589,57 @@ return {
"hss",
"ht",
"hyphenation",
- "hyphenationbounds",
- "hyphenationmin",
"hyphenchar",
"hyphenpenalty",
- "hyphenpenaltymode",
"if",
- "ifabsdim",
- "ifabsnum",
"ifcase",
"ifcat",
- "ifcsname",
- "ifdefined",
"ifdim",
"ifeof",
"iffalse",
- "iffontchar",
"ifhbox",
"ifhmode",
- "ifincsname",
"ifinner",
"ifmmode",
"ifnum",
"ifodd",
- "ifprimitive",
"iftrue",
"ifvbox",
"ifvmode",
"ifvoid",
"ifx",
- "ignoreligaturesinfont",
"ignorespaces",
"immediate",
"indent",
- "initcatcodetable",
"input",
"inputlineno",
"insert",
- "insertht",
"insertpenalties",
- "interactionmode",
- "interlinepenalties",
"interlinepenalty",
"jobname",
"kern",
"language",
"lastbox",
"lastkern",
- "lastlinefit",
- "lastnamedcs",
- "lastnodetype",
"lastpenalty",
- "lastsavedboxresourceindex",
- "lastsavedimageresourceindex",
- "lastsavedimageresourcepages",
"lastskip",
- "lastxpos",
- "lastypos",
- "latelua",
"lccode",
"leaders",
"left",
- "leftghost",
"lefthyphenmin",
- "leftmarginkern",
"leftskip",
"leqno",
"let",
- "letcharcode",
- "letterspacefont",
"limits",
- "linedir",
"linepenalty",
"lineskip",
"lineskiplimit",
- "localbrokenpenalty",
- "localinterlinepenalty",
- "localleftbox",
- "localrightbox",
"long",
"looseness",
"lower",
"lowercase",
- "lpcode",
- "luaescapestring",
- "luafunction",
- "luatexbanner",
- "luatexrevision",
- "luatexversion",
"mag",
"mark",
- "marks",
"mathaccent",
"mathbin",
"mathchar",
@@ -899,27 +647,13 @@ return {
"mathchoice",
"mathclose",
"mathcode",
- "mathdir",
- "mathdisplayskipmode",
- "matheqnogapstep",
"mathinner",
- "mathitalicsmode",
- "mathdelimitersmode",
- "mathnolimitsmode",
"mathop",
"mathopen",
- "mathoption",
"mathord",
- "mathpenaltiesmode",
"mathpunct",
"mathrel",
- "mathrulesfam",
- "mathrulesmode",
- "mathscriptsmode",
- "mathstyle",
"mathsurround",
- "mathsurroundmode",
- "mathsurroundskip",
"maxdeadcycles",
"maxdepth",
"meaning",
@@ -931,117 +665,63 @@ return {
"moveleft",
"moveright",
"mskip",
- "muexpr",
"multiply",
"muskip",
"muskipdef",
- "mutoglue",
"newlinechar",
"noalign",
"noboundary",
"noexpand",
- "nohrule",
"noindent",
- "nokerns",
- "noligs",
"nolimits",
- "nolocaldirs",
- "nolocalwhatsits",
"nonscript",
"nonstopmode",
- "normaldeviate",
- "nospaces",
- "novrule",
"nulldelimiterspace",
"nullfont",
"number",
- "numexpr",
"omit",
"openin",
"openout",
"or",
"outer",
"output",
- "outputbox",
- "outputmode",
"outputpenalty",
"over",
"overfullrule",
"overline",
"overwithdelims",
- "pagebottomoffset",
"pagedepth",
- "pagedir",
- "pagediscards",
"pagefilllstretch",
"pagefillstretch",
"pagefilstretch",
"pagegoal",
- "pageheight",
- "pageleftoffset",
- "pagerightoffset",
"pageshrink",
"pagestretch",
- "pagetopoffset",
"pagetotal",
- "pagewidth",
"par",
- "pardir",
"parfillskip",
"parindent",
"parshape",
- "parshapedimen",
- "parshapeindent",
- "parshapelength",
"parskip",
"patterns",
"pausing",
- "pdfextension",
- "pdffeedback",
- "pdfvariable",
"penalty",
"postdisplaypenalty",
- "postexhyphenchar",
- "posthyphenchar",
- "prebinoppenalty",
- "predisplaydirection",
- "predisplaygapfactor",
"predisplaypenalty",
"predisplaysize",
- "preexhyphenchar",
- "prehyphenchar",
- "prerelpenalty",
"pretolerance",
"prevdepth",
"prevgraf",
- "primitive",
- "protected",
- "protrudechars",
"protrusionboundary",
- "pxdimen",
- "quitvmode",
"radical",
"raise",
- "randomseed",
"read",
- "readline",
"relax",
"relpenalty",
"right",
- "rightghost",
"righthyphenmin",
- "rightmarginkern",
"rightskip",
"romannumeral",
- "rpcode",
- "saveboxresource",
- "savecatcodetable",
- "saveimageresource",
- "savepos",
- "savinghyphcodes",
- "savingvdiscards",
- "scantextokens",
- "scantokens",
"scriptfont",
"scriptscriptfont",
"scriptscriptstyle",
@@ -1049,21 +729,15 @@ return {
"scriptstyle",
"scrollmode",
"setbox",
- "setfontid",
"setlanguage",
- "setrandomseed",
"sfcode",
- "shapemode",
"shipout",
"show",
"showbox",
"showboxbreadth",
"showboxdepth",
- "showgroups",
- "showifs",
"showlists",
"showthe",
- "showtokens",
"skewchar",
"skip",
"skipdef",
@@ -1072,22 +746,11 @@ return {
"span",
"special",
"splitbotmark",
- "splitbotmarks",
- "splitdiscards",
"splitfirstmark",
- "splitfirstmarks",
"splitmaxdepth",
"splittopskip",
"string",
- "suppressfontnotfounderror",
- "suppressifcsnameerror",
- "suppresslongerror",
- "suppressmathparerror",
- "suppressoutererror",
- "synctex",
"tabskip",
- "tagcode",
- "textdir",
"textfont",
"textstyle",
"the",
@@ -1095,45 +758,31 @@ return {
"thinmuskip",
"time",
"toks",
- "toksapp",
"toksdef",
- "tokspre",
"tolerance",
"topmark",
- "topmarks",
"topskip",
"tpack",
- "tracingassigns",
"tracingcommands",
- "tracingfonts",
- "tracinggroups",
- "tracingifs",
"tracinglostchars",
"tracingmacros",
- "tracingnesting",
"tracingonline",
"tracingoutput",
"tracingpages",
"tracingparagraphs",
"tracingrestores",
- "tracingscantokens",
"tracingstats",
"uccode",
"uchyph",
"underline",
- "unexpanded",
"unhbox",
"unhcopy",
- "uniformdeviate",
"unkern",
- "unless",
"unpenalty",
"unskip",
"unvbox",
"unvcopy",
"uppercase",
- "useboxresource",
- "useimageresource",
"vadjust",
"valign",
"vbadness",
@@ -1152,7 +801,6 @@ return {
"vss",
"vtop",
"wd",
- "widowpenalties",
"widowpenalty",
"wordboundary",
"write",
@@ -1164,4 +812,4 @@ return {
["xetex"]={
"XeTeXversion",
},
-}
+} \ No newline at end of file
diff --git a/tex/context/base/mkiv/mult-prm.mkiv b/tex/context/base/mkiv/mult-prm.mkiv
index 308606d7e..60ec26fe7 100644
--- a/tex/context/base/mkiv/mult-prm.mkiv
+++ b/tex/context/base/mkiv/mult-prm.mkiv
@@ -84,7 +84,6 @@
},
omega = {
"Omegaminorversion", "Omegarevision", "Omegaversion",
- "odelcode", "odelimiter", "omathaccent", "omathchar", "omathchardef", "omathcode", "oradical",
},
xetex = {
"XeTeXversion", -- probably some more
@@ -106,10 +105,11 @@
}
local primitives = {
- tex = table.sorted( table.merged( missing.tex , tex.primitives() ) ),
- etex = table.sorted( table.merged( missing.etex , tex.extraprimitives('etex') ) ),
+ -- tex = table.sorted( table.merged( missing.tex , tex.primitives() ) ),
+ tex = table.sorted( table.merged( missing.tex , tex.extraprimitives("core","tex") ) ),
+ etex = table.sorted( table.merged( missing.etex , tex.extraprimitives("etex") ) ),
pdftex = table.sorted( table.merged( missing.pdftex, { } ) ),
- luatex = table.sorted( table.merged( missing.luatex, tex.extraprimitives('luatex') ) ),
+ luatex = table.sorted( table.merged( missing.luatex, tex.extraprimitives("luatex") ) ),
aleph = table.sorted( table.merged( missing.aleph , { } ) ),
omega = table.sorted( table.merged( missing.omega , { } ) ),
xetex = table.sorted( table.merged( missing.xetex , { } ) ),
diff --git a/tex/context/base/mkiv/pack-obj.lua b/tex/context/base/mkiv/pack-obj.lua
index 8bbdbdefa..f68c1ba0c 100644
--- a/tex/context/base/mkiv/pack-obj.lua
+++ b/tex/context/base/mkiv/pack-obj.lua
@@ -27,6 +27,7 @@ local new_latelua = nuts.pool.latelua
local settexdimen = tokens.setters.dimen
local gettexbox = tokens.getters.box
+local settexbox = tokens.setters.box
local gettexdimen = tokens.getters.dimen
local gettexcount = tokens.getters.count
@@ -124,22 +125,37 @@ objects = {
n = 0,
}
-function objects.register(ns,id,b,referenced)
+local objects = objects
+
+function objects.register(ns,id,b,referenced,offset,mode)
objects.n = objects.n + 1
nodes.handlers.finalize(gettexbox(b),"object")
- data[ns][id] = {
- codeinjections.registerboxresource(b), -- a box number
- gettexdimen("objectoff"),
- referenced
- }
+ if mode == 0 then
+ -- tex
+ data[ns][id] = {
+ codeinjections.registerboxresource(b), -- a box number
+ offset,
+ referenced or false,
+ mode,
+ }
+ else
+ -- box (backend)
+ data[ns][id] = {
+ codeinjections.registerboxresource(b,offset), -- a box number
+ false,
+ referenced,
+ mode,
+ }
+ end
end
-function objects.restore(ns,id)
+function objects.restore(ns,id) -- why not just pass a box number here too (ok, we also set offset)
local d = data[ns][id]
if d then
local index = d[1]
local offset = d[2]
local status = d[3]
+ local mode = d[4]
local hbox = codeinjections.restoreboxresource(index) -- a nut !
if status then
local list = getlist(hbox)
@@ -149,10 +165,10 @@ function objects.restore(ns,id)
setlink(list,page)
end
setbox("objectbox",hbox)
- settexdimen("objectoff",offset)
+ settexdimen("objectoff",offset or 0)
else
setbox("objectbox",nil)
- settexdimen("objectoff",0)
+ settexdimen("objectoff",0) -- for good old times
end
end
@@ -161,7 +177,7 @@ function objects.dimensions(index)
if d then
return codeinjections.boxresourcedimensions(d[1])
else
- return 0, 0, 0
+ return 0, 0, 0, 0
end
end
@@ -184,13 +200,13 @@ end
implement {
name = "registerreferencedobject",
- arguments = { "string", "string", "integer", true },
+ arguments = { "string", "string", "integer", true, "dimension", "integer" },
actions = objects.register,
}
implement {
name = "registerobject",
- arguments = { "string", "string", "integer" },
+ arguments = { "string", "string", "integer", false, "dimension", "integer" },
actions = objects.register,
}
@@ -238,15 +254,15 @@ implement {
name = "getobjectdimensions",
arguments = { "string", "string" },
actions = function(ns,id)
- local o = data[ns][id]
- local w, h, d = 0, 0, 0
- if d then
- w, h, d = codeinjections.boxresourcedimensions(o[1])
+ local object = data[ns][id]
+ local w, h, d, o = 0, 0, 0, 0
+ if object then
+ w, h, d, o = codeinjections.boxresourcedimensions(object[1])
end
settexdimen("objectwd",w or 0)
settexdimen("objectht",h or 0)
settexdimen("objectdp",d or 0)
- settexdimen("objectoff",o[2])
+ settexdimen("objectoff",o or #objects > 2 and object[2] or 0)
end
}
diff --git a/tex/context/base/mkiv/pack-obj.mkiv b/tex/context/base/mkiv/pack-obj.mkiv
index a025abfba..b0b1607be 100644
--- a/tex/context/base/mkiv/pack-obj.mkiv
+++ b/tex/context/base/mkiv/pack-obj.mkiv
@@ -51,9 +51,7 @@
\newdimen\objectht \def\objectheight{\the\objectht}
\newdimen\objectdp \def\objectdepth {\the\objectdp}
-% If I have time I will use the unreferenced variant for e.g. mp reuse.
-
-% todo formmargin per obj
+%D If I have time I will use the unreferenced variant for e.g. mp reuse.
\unexpanded\def\setreferencedobject #1#2{\begingroup\synctexpause\objectoff\objectoffset\inobjecttrue\dowithnextbox{\pack_objects_set_yes{#1}{#2}}}
\unexpanded\def\settightreferencedobject #1#2{\begingroup\synctexpause\objectoff\zeropoint \inobjecttrue\dowithnextbox{\pack_objects_set_yes{#1}{#2}}}
@@ -63,44 +61,55 @@
\let\setobject \setreferencedobject
\let\settightobject\settightreferencedobject
+%D We can get subtle differences in boundingboxes but both methods work ok.
+
+\newconstant\c_pack_objects_offset_mode % 0=tex 1=box
+
+\unexpanded\def\pack_objects_temp_check % this will go away
+ {\ifnum\texenginefunctionality<6401\relax
+ \c_pack_objects_offset_mode\zerocount
+ \fi}
+
\unexpanded\def\pack_objects_set_yes#1#2%
- {\ifdim\objectoff>\zeropoint\relax
- \pack_objects_package
+ {\pack_objects_temp_check % this will go away
+ \ifcase\c_pack_objects_offset_mode
+ \ifzeropt\objectoff
+ \pack_objects_package_nop\nextbox
+ \else
+ \pack_objects_package_yes\nextbox
+ \fi
\else
- \setbox\objectbox\box\nextbox
+ \pack_objects_package_nop\nextbox
\fi
- \clf_registerreferencedobject{#1}{#2}\objectbox
+ \clf_registerreferencedobject{#1}{#2}\objectbox\objectoff\c_pack_objects_offset_mode
\synctexresume
\endgroup}
\unexpanded\def\pack_objects_set_nop#1#2%
- {\ifdim\objectoff>\zeropoint\relax
- \pack_objects_package
+ {\pack_objects_temp_check % this will go away
+ \ifcase\c_pack_objects_offset_mode
+ \ifzeropt\objectoff
+ \pack_objects_package_nop\nextbox
+ \else
+ \pack_objects_package_yes\nextbox
+ \fi
\else
- \setbox\objectbox\box\nextbox
+ \pack_objects_package_nop\nextbox
\fi
- \clf_registerobject{#1}{#2}\objectbox
+ \clf_registerobject{#1}{#2}\objectbox\objectoff\c_pack_objects_offset_mode
\synctexresume
\endgroup}
-\def\pack_objects_package
- {\objectwd\dimexpr\wd\nextbox+2\objectoff\relax
- \objectht\dimexpr\ht\nextbox+ \objectoff\relax
- \objectdp\dimexpr\dp\nextbox+ \objectoff\relax
- \setbox\objectbox\hpack
- {\hskip\objectoff
- \box\nextbox}%
- \wd\objectbox\objectwd
- \ht\objectbox\objectht
- \dp\objectbox\objectdp}
+\def\pack_objects_package_nop#1% we pack because otherwise \ruledhbox is still tight
+ {\setbox\objectbox\hpack{\box#1}}
-\def\pack_objects_repackage
- {\objectwd\dimexpr\wd\objectbox-2\objectoff\relax
- \objectht\dimexpr\ht\objectbox- \objectoff\relax
- \objectdp\dimexpr\dp\objectbox- \objectoff\relax
+\def\pack_objects_package_yes#1%
+ {\objectwd\dimexpr\wd#1+2\objectoff\relax
+ \objectht\dimexpr\ht#1+ \objectoff\relax
+ \objectdp\dimexpr\dp#1+ \objectoff\relax
\setbox\objectbox\hpack
- {\hskip-\objectoff
- \box\objectbox}%
+ {\hskip\objectoff
+ \box#1}%
\wd\objectbox\objectwd
\ht\objectbox\objectht
\dp\objectbox\objectdp}
@@ -109,8 +118,9 @@
{\begingroup
\synctexpause
\clf_restoreobject{#1}{#2}%
- \ifdim\objectoff>\zeropoint
- \pack_objects_repackage
+ \ifzeropt\objectoff\else
+ \objectoff-\objectoff
+ \pack_objects_package_yes\objectbox
\fi
\box\objectbox
\synctexresume
@@ -122,8 +132,8 @@
%D \getobjectdimensions{class}{name}
%D \stoptyping
%D
-%D The results are reported in \type {\objectwidth}, \type
-%D {\objectheight} and \type {\objectdepth}.
+%D The results are reported in \type {\objectwidth}, \type {\objectheight} and \type
+%D {\objectdepth} as well as \type {\objectoffset}.
\unexpanded\def\getobjectdimensions#1#2%
{\clf_getobjectdimensions{#1}{#2}}
@@ -131,8 +141,7 @@
%D \macros
%D {doifobjectfoundelse,doifobjectreferencefoundelse}
%D
-%D To prevent redundant definition of objects, one can use
-%D the next tests:
+%D To prevent redundant definition of objects, one can use the next tests:
%D
%D \starttyping
%D \doifobjectfoundelse{class}{object}{do then}{do else}
diff --git a/tex/context/base/mkiv/scrn-ref.mkvi b/tex/context/base/mkiv/scrn-ref.mkvi
index c165e9131..a01e3ac3e 100644
--- a/tex/context/base/mkiv/scrn-ref.mkvi
+++ b/tex/context/base/mkiv/scrn-ref.mkvi
@@ -29,7 +29,7 @@
\to \everysetupinteraction
\def\scrn_reference_enable_page_destinations % no reset
- {\clf_setinnerreferencemethod{\interactionparameter\c!page}}
+ {\clf_setreferencelinkmethod{\interactionparameter\c!page}}
\setupinteraction % start fit page and reset form
[\c!page=\v!no,
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 670af30fc..a1089d96d 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 0c918349d..f34a394fe 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-not.mkvi b/tex/context/base/mkiv/strc-not.mkvi
index db27cb5af..2428f15e4 100644
--- a/tex/context/base/mkiv/strc-not.mkvi
+++ b/tex/context/base/mkiv/strc-not.mkvi
@@ -1555,6 +1555,12 @@
\begingroup
\let\flushnotes \relax
\let\postponenotes\relax
+ \ifconditional\postponednote
+ \ifhmode
+ % needed for tagging ... otherwise we get some weird node free error
+ \signalcharacter
+ \fi
+ \fi
\clf_flushpostponednotes% this also resets the states !
\global\setfalse\postponednote
\global\setfalse\postponingnotes
diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua
index 6b2d3f240..75b66fd7b 100644
--- a/tex/context/base/mkiv/strc-ref.lua
+++ b/tex/context/base/mkiv/strc-ref.lua
@@ -59,7 +59,7 @@ local texconditionals = tex.conditionals
local productcomponent = resolvers.jobs.productcomponent
local justacomponent = resolvers.jobs.justacomponent
------ settings_to_array = utilities.parsers.settings_to_array
+local settings_to_array = utilities.parsers.settings_to_array
local settings_to_table = utilities.parsers.settings_to_array_obey_fences
local process_settings = utilities.parsers.process_stripped_settings
local unsetvalue = attributes.unsetvalue
@@ -1515,7 +1515,7 @@ local function identify_outer(set,var,i)
local inner = var.inner
local external = externals[outer]
if external then
- local v = identify_inner(set,var,nil,external)
+ local v = identify_inner(set,var,"",external)
if v then
v.kind = "outer with inner"
set.external = true
@@ -1524,19 +1524,24 @@ local function identify_outer(set,var,i)
end
return v
end
- local v = identify_inner(set,var,var.outer,external)
- if v then
- v.kind = "outer with inner"
- set.external = true
- if trace_identifying then
- report_identify_outer(set,v,i,"2b")
+ -- somewhat rubish: we use outer as first step in the externals table so it makes no
+ -- sense to have it as prefix so the next could be an option
+ local external = external[""]
+ if external then
+ local v = identify_inner(set,var,var.outer,external)
+ if v then
+ v.kind = "outer with inner"
+ set.external = true
+ if trace_identifying then
+ report_identify_outer(set,v,i,"2b")
+ end
+ return v
end
- return v
end
end
local external = productdata.componentreferences[outer]
if external then
- local v = identify_inner(set,var,nil,external)
+ local v = identify_inner(set,var,"",external)
if v then
v.kind = "outer with inner"
set.external = true
@@ -1575,7 +1580,12 @@ local function identify_outer(set,var,i)
end
var.i = inner
var.f = outer
- var.r = (inner.references and inner.references.realpage) or (inner.pagedata and inner.pagedata.realpage) or 1
+ if type(inner) == "table" then
+ -- can this really happen?
+ var.r = (inner.references and inner.references.realpage) or (inner.pagedata and inner.pagedata.realpage) or 1
+ else
+ var.r = 1
+ end
if trace_identifying then
report_identify_outer(set,var,i,"2e")
end
@@ -1893,26 +1903,42 @@ end)
-- the housekeeping happens the backend side.
local innermethod = v_auto -- only page|auto now
+local outermethod = v_auto -- only page|auto now
local defaultinnermethod = defaultinnermethod
+local defaultoutermethod = defaultoutermethod
references.innermethod = innermethod -- don't mess with this one directly
+references.outermethod = outermethod -- don't mess with this one directly
-function references.setinnermethod(m)
- if toboolean(m) or m == v_page or m == v_yes then
+function references.setlinkmethod(inner,outer)
+ if not outer and type(inner) == "string" then
+ local m = settings_to_array(inner)
+ inner = m[1]
+ outer = m[2] or v_auto
+ end
+ if toboolean(inner) or inner == v_page or inner == v_yes then
innermethod = v_page
- elseif m == v_name then
+ elseif inner == v_name then
innermethod = v_name
else
innermethod = v_auto
end
+ if toboolean(outer) or outer == v_page or outer == v_yes then
+ outermethod = v_page
+ elseif inner == v_name then
+ outermethod = v_name
+ else
+ outermethod = v_auto
+ end
references.innermethod = innermethod
- function references.setinnermethod()
- report_references("inner method is already set and frozen to %a",innermethod)
+ references.outermethod = outermethod
+ function references.setlinkmethod()
+ report_references("link method is already set and frozen: inner %a, outer %a",innermethod,outermethod)
end
end
implement {
- name = "setinnerreferencemethod",
- actions = references.setinnermethod,
+ name = "setreferencelinkmethod",
+ actions = references.setlinkmethod,
arguments = "string",
-- onlyonce = true
}
@@ -1921,8 +1947,12 @@ function references.getinnermethod()
return innermethod or defaultinnermethod
end
+function references.getoutermethod()
+ return outermethod or defaultoutermethod
+end
+
directives.register("references.linkmethod", function(v) -- page auto
- references.setinnermethod(v)
+ references.setlinkmethod(v)
end)
-- we can call setinternalreference with an already known internal or with
diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv
index 36a68277b..03b6d0759 100644
--- a/tex/context/base/mkiv/syst-ini.mkiv
+++ b/tex/context/base/mkiv/syst-ini.mkiv
@@ -1050,6 +1050,7 @@
\edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel} \pdfinclusionerrorlevel \zerocount
\edef\pdfgentounicode {\pdfvariable gentounicode} \pdfgentounicode \plusone
\edef\pdfpagebox {\pdfvariable pagebox} \pdfpagebox \zerocount
+\edef\pdfmajorversion {\pdfvariable majorversion} % \pdfmajorversion \plusone
\edef\pdfminorversion {\pdfvariable minorversion} \pdfminorversion \plusseven
\edef\pdfuniqueresname {\pdfvariable uniqueresname} \pdfuniqueresname \zerocount
\edef\pdfhorigin {\pdfvariable horigin} \pdfhorigin 1in
diff --git a/tex/context/base/mkiv/tabl-ntb.mkiv b/tex/context/base/mkiv/tabl-ntb.mkiv
index 7fdd1e5c9..62bdec0e8 100644
--- a/tex/context/base/mkiv/tabl-ntb.mkiv
+++ b/tex/context/base/mkiv/tabl-ntb.mkiv
@@ -1485,18 +1485,20 @@
\let\tabl_ntb_preroll\relax
-\def\tabl_ntb_table_get_max_width#1#2%
- {#1\wd#2\relax}
+\def\tabl_ntb_table_get_max_width
+ {\scratchdimen\wd\scratchbox\relax}
-% first needs testing (in projects):
+% first needs testing (in projects), see cont-loc for final version:
%
-% \def\tabl_ntb_table_get_max_width#1#2%
-% {#1\zeropoint
-% \dorecurse\c_tabl_ntb_maximum_col
-% {\advance#1\tabl_ntb_get_wid\recurselevel
-% \advance#1\tabl_ntb_get_dis\recurselevel}%
-% \ifdim#1<\wd#2\relax
-% #1\wd#2\relax
+% \def\tabl_ntb_table_get_max_width_step
+% {\advance\scratchdimen\tabl_ntb_get_wid\fastloopindex
+% \advance\scratchdimen\tabl_ntb_get_dis\fastloopindex}
+%
+% \def\tabl_ntb_table_get_max_width
+% {\scratchdimen\zeropoint
+% \dofastloopcs\c_tabl_ntb_maximum_col\tabl_ntb_table_get_max_width_step
+% \ifdim\scratchdimen<\wd\scratchbox\relax
+% \scratchdimen\wd\scratchbox\relax
% \fi}
\def\tabl_ntb_table_stop
@@ -1534,7 +1536,7 @@
\fi
\tabl_ntb_let_dis\c_tabl_ntb_maximum_col\zeropoint
%
- \tabl_ntb_table_get_max_width\scratchdimen\scratchbox
+ \tabl_ntb_table_get_max_width % \scratchdimen\scratchbox
%
\ifautoTBLspread
% experimental, stretch non fixed cells to \hsize
diff --git a/tex/context/fonts/mkiv/stix-two-math.lfg b/tex/context/fonts/mkiv/stix-two-math.lfg
index 7652796a9..dfbe7487e 100644
--- a/tex/context/fonts/mkiv/stix-two-math.lfg
+++ b/tex/context/fonts/mkiv/stix-two-math.lfg
@@ -9,17 +9,20 @@
local function fix_italic(target,original,name,value,factor)
local m = target.parameters.mathsize
- local u = original.resources.unicodes[name]
- if m and u then
- local c = target.characters[u]
- if c then
- local i = c.italic
- if i then
- local d = original.descriptions[u]
- if d and d.math.italic == value then
- if m then
- logs.report("patching font","fixing italic correction of %U at math size %i by %0.3f",u,m,factor)
- c.italic = factor * i
+ if m then
+ local u = type(name) == "number" and name or original.resources.unicodes[name]
+ if u then
+ local c = target.characters[u]
+ if c then
+ local i = c.italic
+ if i then
+ local d = original.descriptions[u]
+ inspect(d)
+ if d and d.math.italic == value then
+ if m then
+ logs.report("patching font","fixing italic correction of %U at math size %i by %0.3f",u,m,factor)
+ c.italic = factor * i
+ end
end
end
end
@@ -53,7 +56,8 @@ return {
tweaks = {
aftercopying = {
function(target,original)
- fix_italic(target,original,"uni222B.updsp",80,3)
+ fix_italic(target,original,"uni222B.updsp",80,3.5)
+ fix_italic(target,original,"uni222B.up", 80,2.5)
end,
},
},
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 0a02a2fc2..4eb8278e1 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index ebd2ae3c8..c3912d980 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/mkiv/x-asciimath.lua b/tex/context/modules/mkiv/x-asciimath.lua
index 1c74294f1..5a884cead 100644
--- a/tex/context/modules/mkiv/x-asciimath.lua
+++ b/tex/context/modules/mkiv/x-asciimath.lua
@@ -1796,6 +1796,14 @@ local p = (
+ p_utf_base
)^0
+-- faster:
+--
+-- local p = (
+-- (S("{[(") + P("\\left" )) * Cc(function() n = n + 1 end)
+-- + (S("}])") + P("\\right")) * Cc(function() n = n - 1 end)
+-- + p_utf_base
+-- )^0
+
local function invalidtex(str)
n = 0
lpegmatch(p,str)
diff --git a/tex/context/modules/mkiv/x-mathml.mkiv b/tex/context/modules/mkiv/x-mathml.mkiv
index 31ccbc153..db9cdc958 100644
--- a/tex/context/modules/mkiv/x-mathml.mkiv
+++ b/tex/context/modules/mkiv/x-mathml.mkiv
@@ -66,6 +66,9 @@
\xmlmapvalue {mml:math:dir} {ltr} {\setfalse\c_math_right_to_left\math_basics_synchronize_direction}
\xmlmapvalue {mml:math:dir} {rtl} {\settrue \c_math_right_to_left\math_basics_synchronize_direction}
+\edef\mmlconstantone {1}
+\edef\mmlconstantfalse{false}
+
\startxmlsetups mml:math
\begingroup
\enableautofences
@@ -110,8 +113,9 @@
%D First we define some general formula elements.
\startxmlsetups mml:formula
- \edef\mmlformulalabel {\xmlatt{#1}{label}\xmlatt{#1}{id}}
- \edef\mmlformulasublabel{\xmlatt{#1}{sublabel}\xmlatt{#1}{id}}
+ \edef\mmlformulaid {\xmlatt{#1}{id}}
+ \edef\mmlformulalabel {\xmlatt{#1}{label}\mmlformulaid}
+ \edef\mmlformulasublabel{\xmlatt{#1}{sublabel}\mmlformulaid}
\doifsomething\mmlformulalabel{\placeformula[\mmlformulalabel]{\mmlformulasublabel}}
\startformula
%\MMLhack
@@ -1937,12 +1941,28 @@
% spacing between - and 2 is taken care of by tex itself
\startxmlsetups mml:mo
- \doif {\xmlatt{#1}{maxsize}} {1} {\settrue\mmlignoredelimiter}
- \doif {\xmlatt{#1}{stretchy}} {false} {\settrue\mmlignoredelimiter}
+ \edef\mmlattvalue{\xmlatt{#1}{maxsize}}
+ \ifx\mmlattvalue\mmlconstantone
+ \settrue\mmlignoredelimiter
+ \else
+ \edef\mmlattvalue{\xmlatt{#1}{stretchy}}
+ \ifx\mmlattvalue\mmlconstantfalse
+ \settrue\mmlignoredelimiter
+ \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
\stopxmlsetups
+
% \startxmlsetups mml:mfenced % {} around separator is needed for spacing
% \def\MMLleft {\left }% weird
% \def\MMLright {\right}