summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
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/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/luat-mac.lua22
-rw-r--r--tex/context/base/mkiv/mult-fun.lua5
-rw-r--r--tex/context/base/mkiv/mult-mps.lua2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25397 -> 25400 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin257164 -> 257322 bytes
-rw-r--r--tex/context/base/mkiv/task-ini.lua7
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/cont-run.lmt10
-rw-r--r--tex/context/base/mkxl/context.mkxl3
-rw-r--r--tex/context/base/mkxl/font-otj.lmt87
-rw-r--r--tex/context/base/mkxl/font-pre.mkxl6
-rw-r--r--tex/context/base/mkxl/grph-inc.mkxl10
-rw-r--r--tex/context/base/mkxl/math-frc.mkxl16
-rw-r--r--tex/context/base/mkxl/meta-tex.mkxl167
-rw-r--r--tex/context/base/mkxl/mlib-pdf.lmt125
-rw-r--r--tex/context/base/mkxl/mlib-pps.lmt11
-rw-r--r--tex/context/base/mkxl/mlib-run.lmt14
-rw-r--r--tex/context/base/mkxl/mlib-svg.lmt588
-rw-r--r--tex/context/base/mkxl/node-ini.lmt11
-rw-r--r--tex/context/base/mkxl/pack-mrl.mkxl16
-rw-r--r--tex/context/base/mkxl/page-app.mkxl2
-rw-r--r--tex/context/base/mkxl/strc-not.mklx120
-rw-r--r--tex/context/base/mkxl/supp-box.mkxl3
-rw-r--r--tex/context/base/mkxl/typo-hid.lmt74
-rw-r--r--tex/context/base/mkxl/typo-hid.mkxl38
-rw-r--r--tex/context/fonts/mkiv/type-imp-texgyre.mkiv4
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
31 files changed, 845 insertions, 508 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 1b3a16837..fd0516977 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.03.13 11:18}
+\newcontextversion{2021.03.17 17:43}
%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 a35156dc5..e04f656a7 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.03.13 11:18}
+\edef\contextversion{2021.03.17 17:43}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 000c25c18..095b149a2 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.03.13 11:18}
+\newcontextversion{2021.03.17 17:43}
%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 294a062f6..633060dd1 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.03.13 11:18}
+\edef\contextversion{2021.03.17 17:43}
%D Kind of special:
diff --git a/tex/context/base/mkiv/luat-mac.lua b/tex/context/base/mkiv/luat-mac.lua
index 3c50a41f8..01857511c 100644
--- a/tex/context/base/mkiv/luat-mac.lua
+++ b/tex/context/base/mkiv/luat-mac.lua
@@ -185,16 +185,20 @@ local name = (R("AZ","az") + utf8character)^1
local csname = (R("AZ","az") + S("@?!_:-*") + utf8character)^1
local longname = (longleft/"") * (nolong^1) * (longright/"")
local variable = P("#") * Cs(name + longname)
+local bcsname = P("csname")
+local ecsname = escape * P("endcsname")
local escapedname = escape * csname
-local definer = escape * (P("def") + S("egx") * P("def")) -- tex
+local definer = escape * (P("u")^-1 * S("egx")^-1 * P("def")) -- tex
local setter = escape * P("set") * (P("u")^-1 * S("egx")^-1) * P("value") -- context specific
--- + escape * P("install") * (1-P("handler"))^1 * P("handler") -- context specific
+local defcsname = escape * S("egx")^-1 * P("defcsname")
+ * (1 - ecsname)^1
+ * ecsname
local startcode = P("\\starttexdefinition") -- context specific
local stopcode = P("\\stoptexdefinition") -- context specific
local anything = patterns.anything
local always = patterns.alwaysmatched
-local definer = escape * (P("u")^-1 * S("egx")^-1 * P("def")) -- tex
-- The comment nilling can become an option but it nicely compensates the Lua
-- parsing here with less parsing at the TeX end. We keep lines so the errors
@@ -206,7 +210,6 @@ local definer = escape * (P("u")^-1 * S("egx")^-1 * P("def"))
local commenttoken = P("%")
local crorlf = S("\n\r")
------ commentline = commenttoken * ((Carg(1) * C((1-crorlf)^0))/function(strip,s) return strip and "" or s end)
local commentline = commenttoken * ((1-crorlf)^0)
local leadingcomment = (commentline * crorlf^1)^1
local furthercomment = (crorlf^1 * commentline)^1
@@ -229,7 +232,6 @@ local grammar = { "converter",
* startcode
* spaces
* (csname * spaces)^1 -- new: multiple, new:csname instead of name
- -- * (declaration + furthercomment + (1 - newline - space))^0
* ((declaration * (space^0/""))^1 + furthercomment + (1 - newline - space))^0 -- accepts #a #b #c
* V("texbody")
* stopcode
@@ -242,10 +244,12 @@ local grammar = { "converter",
+ (1 - stopcode)
)^0,
definition = pushlocal
- * definer
- * spaces^0
- * escapedname
--- * (declaration + furthercomment + commentline + (1-leftbrace))^0
+ * (definer * spaces^0 * escapedname)
+ * (declaration + furthercomment + commentline + csname_endcsname + (1-leftbrace))^0
+ * V("braced")
+ * poplocal,
+ csnamedef = pushlocal
+ * defcsname
* (declaration + furthercomment + commentline + csname_endcsname + (1-leftbrace))^0
* V("braced")
* poplocal,
@@ -265,11 +269,11 @@ local grammar = { "converter",
+ leadingcomment -- new per 2012-05-15 (message on mailing list)
+ nobrace
)^0
- -- * rightbrace^-1, -- the -1 catches errors
* (rightbrace + Cmt(always,matcherror)),
pattern = leadingcomment
+ V("definition")
+ + V("csnamedef")
+ V("setcode")
+ V("texcode")
+ furthercomment
diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua
index 4ecbb1abd..ce94fb3a0 100644
--- a/tex/context/base/mkiv/mult-fun.lua
+++ b/tex/context/base/mkiv/mult-fun.lua
@@ -202,7 +202,10 @@ return {
--
"newcolor", "newrgbcolor", "newcmykcolor",
"newnumeric", "newboolean", "newtransform", "newpath", "newpicture", "newstring", "newpair",
-
+ --
"mpvar",
+ --
+ "withtolerance",
+ --
},
}
diff --git a/tex/context/base/mkiv/mult-mps.lua b/tex/context/base/mkiv/mult-mps.lua
index a2a74b3b3..49c4f12ae 100644
--- a/tex/context/base/mkiv/mult-mps.lua
+++ b/tex/context/base/mkiv/mult-mps.lua
@@ -119,7 +119,7 @@ return {
--
"mm", "pt", "dd", "bp", "cm", "pc", "cc", "in",
--
- "triplet", "quadruplet", "totransform", "bymatrix",
+ "triplet", "quadruplet", "totransform", "bymatrix", "closedcurve", "closedlines",
--
"primitive", "permanent", "immutable", "mutable", "frozen",
--
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 012ebe91f..150b4e1bd 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 b0387df70..68a481428 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/task-ini.lua b/tex/context/base/mkiv/task-ini.lua
index 3e78fb2f9..8270b9112 100644
--- a/tex/context/base/mkiv/task-ini.lua
+++ b/tex/context/base/mkiv/task-ini.lua
@@ -137,9 +137,16 @@ appendaction("finalizers", "fonts", "builders.paragraphs.solutions.split
appendaction("finalizers", "lists", "builders.paragraphs.tag", nil, "nut", "disabled" )
appendaction("finalizers", "lists", "nodes.linefillers.handler", nil, "nut", "disabled" )
+
appendaction("contributers", "normalizers", "nodes.handlers.flattenline", nil, "nut", "disabled" )
appendaction("contributers", "normalizers", "nodes.handlers.textbackgrounds", nil, "nut", "disabled" )
+if CONTEXTLMTXMODE > 0 then
+
+appendaction("contributers", "normalizers", "nodes.handlers.wipe", nil, "nut", "disabled" )
+
+end
+
appendaction("vboxbuilders", "normalizers", "nodes.handlers.backgroundsvbox", nil, "nut", "disabled" )
------------("vboxbuilders", "normalizers", "typesetters.margins.localhandler", nil, "nut", "disabled" )
appendaction("vboxbuilders", "normalizers", "builders.vspacing.vboxhandler", nil, "nut", "enabled" )
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 61707dd62..4597309ef 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.03.13 11:18}
+\newcontextversion{2021.03.17 17:43}
%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/cont-run.lmt b/tex/context/base/mkxl/cont-run.lmt
index 76fd6ba24..4fbf25ebc 100644
--- a/tex/context/base/mkxl/cont-run.lmt
+++ b/tex/context/base/mkxl/cont-run.lmt
@@ -229,6 +229,16 @@ local function processjob()
if not filename or filename == "" then
-- skip
+ elseif suffix == "svg" or arguments.forcesvg then
+
+ report_system("processing svg output: %s",filename)
+
+ context.starttext()
+ context.startTEXpage()
+ context.externalfigure ( { filename }, { conversion = "mp" } )
+ context.stopTEXpage()
+ context.stoptext()
+
elseif suffix == "xml" or arguments.forcexml then
-- Maybe we should move the preamble parsing here as it
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 78ddcbd97..80430f67d 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.03.13 11:18}
+\immutable\edef\contextversion{2021.03.17 17:43}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -416,6 +416,7 @@
\loadmkxlfile{typo-wrp}
\loadmkxlfile{typo-spa}
\loadmkxlfile{typo-krn}
+\loadmkxlfile{typo-hid}
\loadmklxfile{typo-itc}
\loadmkxlfile{typo-dir}
\loadmkxlfile{typo-brk}
diff --git a/tex/context/base/mkxl/font-otj.lmt b/tex/context/base/mkxl/font-otj.lmt
index e9e9d524e..301b0672f 100644
--- a/tex/context/base/mkxl/font-otj.lmt
+++ b/tex/context/base/mkxl/font-otj.lmt
@@ -111,6 +111,7 @@ local setwidth = nuts.setwidth
local getwidth = nuts.getwidth
local addxymargins = nuts.addxymargins -- we delegate scaling
local copynode = nuts.copy
+local setattrlist = nuts.setattrlist
local nextchar = nuts.traversers.char
local nextglue = nuts.traversers.glue
@@ -123,6 +124,12 @@ local properties = nodes.properties.data
local fontkern = nuts.pool and nuts.pool.fontkern
local italickern = nuts.pool and nuts.pool.italickern
+local function somekern(makekern,amount,current)
+ local kern = makekern(leftkern,amount)
+ setattrlist(kern,current)
+ return kern
+end
+
local useitalickerns = false
local useadvance = false
local usezwjkerns = true -- when useadvance
@@ -847,7 +854,7 @@ local function inject_kerns_only_kerns(head,where)
setwidth(prev,getwidth(prev) + leftkern)
end
else
- head = insert_node_before(head,current,fontkern(leftkern))
+ head = insert_node_before(head,current,somekern(fontkern,leftkern,current))
end
end
end
@@ -858,7 +865,7 @@ local function inject_kerns_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- setlink(posttail,fontkern(xscaled(current,leftkern)))
+ setlink(posttail,somekern(fontkern,xscaled(current,leftkern),current))
done = true
end
end
@@ -868,7 +875,7 @@ local function inject_kerns_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- setlink(replacetail,fontkern(xscaled(current,leftkern)))
+ setlink(replacetail,somekern(fontkern,xscaled(current,leftkern),current))
done = true
end
end
@@ -878,7 +885,7 @@ local function inject_kerns_only_kerns(head,where)
-- glyph|disc|glyph (special case)
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = fontkern(xscaled(current,leftkern))
+ replace = somekern(fontkern,xscaled(current,leftkern),current)
done = true
end
end
@@ -906,7 +913,7 @@ local function inject_kerns_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- pre = insert_node_before(pre,n,fontkern(xscaled(n,leftkern)))
+ pre = insert_node_before(pre,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
end
@@ -922,7 +929,7 @@ local function inject_kerns_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- post = insert_node_before(post,n,fontkern(xscaled(n,leftkern)))
+ post = insert_node_before(post,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
end
@@ -938,7 +945,7 @@ local function inject_kerns_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = insert_node_before(replace,n,fontkern(xscaled(n,leftkern)))
+ replace = insert_node_before(replace,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
end
@@ -1014,7 +1021,7 @@ local function inject_kerns_only_margins(head,where)
setchar(replace,0x200D) -- zwj
addxymargins(replace,-leftkern)
else
- replace = fontkern(xscaled(current,leftkern))
+ replace = somekern(fontkern,xscaled(current,leftkern),current)
end
setdisc(prevdisc,pre,post,replace) -- setreplace
end
@@ -1459,7 +1466,7 @@ local function inject_positions_only_kerns(head,where)
setwidth(prev,getwidth(prev)+leftkern)
end
else
- head = insert_node_before(head,current,fontkern(leftkern))
+ head = insert_node_before(head,current,somekern(fontkern,leftkern,current))
end
end
if rightkern ~= 0 then
@@ -1470,7 +1477,7 @@ local function inject_positions_only_kerns(head,where)
setwidth(next, getwidth(next)+rightkern)
end
else
- insert_node_after(head,current,fontkern(rightkern))
+ insert_node_after(head,current,somekern(fontkern,rightkern,current))
end
end
else
@@ -1483,7 +1490,7 @@ local function inject_positions_only_kerns(head,where)
if replace then
-- error, we expect an empty one
else
- replace = fontkern(xscaled(current,rightkern)) -- maybe also leftkern
+ replace = somekern(fontkern,xscaled(current,rightkern),current) -- maybe also leftkern
done = true --KE
end
end
@@ -1497,7 +1504,7 @@ local function inject_positions_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- setlink(posttail,fontkern(xscaled(current,leftkern)))
+ setlink(posttail,somekern(fontkern,xscaled(current,leftkern),current))
done = true
end
end
@@ -1507,7 +1514,7 @@ local function inject_positions_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- setlink(replacetail,fontkern(xscaled(current,leftkern)))
+ setlink(replacetail,somekern(fontkern,xscaled(current,leftkern),current))
done = true
end
end
@@ -1517,7 +1524,7 @@ local function inject_positions_only_kerns(head,where)
-- new .. okay?
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = fontkern(xscaled(current,leftkern))
+ replace = somekern(fontkern,xscaled(current,leftkern),current)
done = true
end
end
@@ -1549,11 +1556,11 @@ local function inject_positions_only_kerns(head,where)
addyoffset(n,yscaled(n,yoffset))
end
if leftkern and leftkern ~= 0 then
- pre = insert_node_before(pre,n,fontkern(xscaled(n,leftkern)))
+ pre = insert_node_before(pre,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
if rightkern and rightkern ~= 0 then
- insert_node_after(pre,n,fontkern(xscaled(n,rightkern)))
+ insert_node_after(pre,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
end
@@ -1574,11 +1581,11 @@ local function inject_positions_only_kerns(head,where)
addyoffset(n,yscaled(n,yoffset))
end
if leftkern and leftkern ~= 0 then
- post = insert_node_before(post,n,fontkern(xscaled(n,leftkern)))
+ post = insert_node_before(post,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
if rightkern and rightkern ~= 0 then
- insert_node_after(post,n,fontkern(xscaled(n,rightkern)))
+ insert_node_after(post,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
end
@@ -1599,11 +1606,11 @@ local function inject_positions_only_kerns(head,where)
addyoffset(n,yscaled(n,yoffset))
end
if leftkern and leftkern ~= 0 then
- replace = insert_node_before(replace,n,fontkern(xscaled(n,leftkern)))
+ replace = insert_node_before(replace,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
if rightkern and rightkern ~= 0 then
- insert_node_after(replace,n,fontkern(xscaled(n,rightkern)))
+ insert_node_after(replace,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
end
@@ -1620,7 +1627,7 @@ local function inject_positions_only_kerns(head,where)
-- glyph|pre glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- pre = insert_node_before(pre,pre,fontkern(xscaled(prevglyph,rightkern)))
+ pre = insert_node_before(pre,pre,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
done = true
end
end
@@ -1634,7 +1641,7 @@ local function inject_positions_only_kerns(head,where)
-- glyph|replace glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- replace = insert_node_before(replace,replace,fontkern(xscaled(prevglyph,rightkern)))
+ replace = insert_node_before(replace,replace,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
done = true
end
end
@@ -1709,7 +1716,7 @@ local function inject_positions_only_margins(head,where)
setchar(replace,0x200D) -- zwj
addxymargins(replace,false,-rightkern)
else
- replace = fontkern(xscaled(current,rightkern)) -- maybe also leftkern
+ replace = somekern(fontkern,xscaled(current,rightkern),current) -- maybe also leftkern
end
done = true --KE
end
@@ -1746,7 +1753,7 @@ local function inject_positions_only_margins(head,where)
setchar(replace,0x200D) -- zwj
addxymargins(replace,-leftkern)
else
- replace = fontkern(xscaled(current,leftkern))
+ replace = somekern(fontkern,xscaled(current,leftkern),current)
end
setdisc(prevdisc,pre,post,replace)
end
@@ -1934,8 +1941,8 @@ local function processmark(p,n,pn) -- p = basenode
--
-- todo: head and check for prev / next kern
--
- insert_node_before(n,n,fontkern(-wn))
- insert_node_after(n,n,fontkern(-wn))
+ insert_node_before(n,n,somekern(fontkern,-wn,n))
+ insert_node_after(n,n,somekern(fontkern,-wn,n))
end
end
end
@@ -2062,7 +2069,7 @@ local function inject_everything(head,where)
setwidth(prev, getwidth(prev) + leftkern)
end
else
- head = insert_node_before(head,current,fontkern(leftkern))
+ head = insert_node_before(head,current,somekern(fontkern,leftkern,current))
end
end
if rightkern and rightkern ~= 0 then
@@ -2074,7 +2081,7 @@ local function inject_everything(head,where)
setwidth(next, getwidth(next) + rightkern)
end
else
- insert_node_after(head,current,fontkern(rightkern))
+ insert_node_after(head,current,somekern(fontkern,rightkern,current))
end
end
end
@@ -2088,7 +2095,7 @@ local function inject_everything(head,where)
if replace then
-- error, we expect an empty one
else
- replace = fontkern(xscaled(current,rightkern))
+ replace = somekern(fontkern,xscaled(current,rightkern),current)
done = true
end
end
@@ -2103,7 +2110,7 @@ local function inject_everything(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- setlink(posttail,fontkern(xscaled(current,leftkern)))
+ setlink(posttail,somekern(fontkern,xscaled(current,leftkern),current))
done = true
end
end
@@ -2113,7 +2120,7 @@ local function inject_everything(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- setlink(replacetail,fontkern(xscaled(current,leftkern)))
+ setlink(replacetail,somekern(fontkern,xscaled(current,leftkern),current))
done = true
end
end
@@ -2122,7 +2129,7 @@ local function inject_everything(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = fontkern(xscaled(current,leftkern))
+ replace = somekern(fontkern,xscaled(current,leftkern),current)
done = true
end
end
@@ -2168,12 +2175,12 @@ local function inject_everything(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- pre = insert_node_before(pre,n,fontkern(xscaled(n,leftkern)))
+ pre = insert_node_before(pre,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(pre,n,fontkern(xscaled(n,rightkern)))
+ insert_node_after(pre,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
if hasmarks then
@@ -2199,13 +2206,13 @@ local function inject_everything(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- post = insert_node_before(post,n,fontkern(xscaled(n,leftkern)))
+ post = insert_node_before(post,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
done = true
- insert_node_after(post,n,fontkern(xscaled(n,rightkern)))
+ insert_node_after(post,n,somekern(fontkern,xscaled(n,rightkern),n))
end
if hasmarks then
local pm = i.markbasenode
@@ -2230,12 +2237,12 @@ local function inject_everything(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = insert_node_before(replace,n,fontkern(xscaled(n,leftkern)))
+ replace = insert_node_before(replace,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(replace,n,fontkern(xscaled(n,rightkern)))
+ insert_node_after(replace,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
if hasmarks then
@@ -2257,7 +2264,7 @@ local function inject_everything(head,where)
-- glyph|pre glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- pre = insert_node_before(pre,pre,fontkern(xscaled(prevglyph,rightkern)))
+ pre = insert_node_before(pre,pre,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
done = true
end
end
@@ -2271,7 +2278,7 @@ local function inject_everything(head,where)
-- glyph|replace glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- replace = insert_node_before(replace,replace,fontkern(xscaled(prevglyph,rightkern)))
+ replace = insert_node_before(replace,replace,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
done = true
end
end
diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl
index e6e6930e1..7f1aa5f7f 100644
--- a/tex/context/base/mkxl/font-pre.mkxl
+++ b/tex/context/base/mkxl/font-pre.mkxl
@@ -427,6 +427,12 @@
% \adaptfontfeature[*math*][mathnolimitsmode=1000] % only subscript
\definefontfeature
+ [collapseitalics]
+ [collapseitalics=yes]
+
+% \definefontfeature[mathextra][collapseitalics]
+
+\definefontfeature
[mathematics-l2r]
[mathematics]
[]
diff --git a/tex/context/base/mkxl/grph-inc.mkxl b/tex/context/base/mkxl/grph-inc.mkxl
index 3c2e8e5c1..5bd829e00 100644
--- a/tex/context/base/mkxl/grph-inc.mkxl
+++ b/tex/context/base/mkxl/grph-inc.mkxl
@@ -601,11 +601,17 @@
%D Internal graphics are handled at the \TEX\ end:
+% strut=none also avoids the \noindent! otherwise we're in hmode when
+% blank happens and we get a lineskip
+
\def\grph_include_process_tex#1%
{\framed
- [\c!strut=\v!no,\c!align=\v!normal,\c!frame=\v!off,
+ [\c!strut=\v!none,\c!align=\v!normal,\c!frame=\v!off,
\c!offset=\v!overlay,\c!width=\v!fit,\c!height=\v!fit]
- {\blank[\v!disable]#1\endgraf\removelastskip}} % disable should stay here!
+ {\blank[\v!disable]%
+ #1\endgraf
+ \removelastskip}} % disable should stay here!
+
% used al lua end:
diff --git a/tex/context/base/mkxl/math-frc.mkxl b/tex/context/base/mkxl/math-frc.mkxl
index 8295195b5..dfdb7144f 100644
--- a/tex/context/base/mkxl/math-frc.mkxl
+++ b/tex/context/base/mkxl/math-frc.mkxl
@@ -173,17 +173,17 @@
{\enforced\let\m_fractions_strut_top\relax
\enforced\let\m_fractions_strut_bot\relax}
-\setvalue{\??mathfractionstrut\v!yes}%
+\defcsname\??mathfractionstrut\v!yes\endcsname
{\enforced\let\m_fractions_strut_top\mathstrut
\enforced\let\m_fractions_strut_bot\mathstrut}
-\setvalue{\??mathfractionstrut\v!math}%
+\defcsname\??mathfractionstrut\v!math\endcsname
{\enforced\let\m_fractions_strut_top\mathstrut
\enforced\let\m_fractions_strut_bot\mathstrut}
-\letvalue{\??mathfractionstrut\v!no}\math_frac_no_strut
+\letcsname\??mathfractionstrut\v!no\endcsname\math_frac_no_strut
-\setvalue{\??mathfractionstrut\v!tight}%
+\defcsname\??mathfractionstrut\v!tight\endcsname
{\enforced\let\m_fractions_strut_top\mathbotstrut % indeed swapped name
\enforced\let\m_fractions_strut_bot\mathtopstrut} % indeed swapped name
@@ -255,21 +255,21 @@
% the denominator is in cramped!
-\setvalue{\??mathfractionalternative\v!inner}%
+\defcsname\??mathfractionalternative\v!inner\endcsname
{\ifcase\d_math_fraction_margin
\expandafter\math_fraction_inner_normal
\else
\expandafter\math_fraction_inner_margin
\fi}
-\setvalue{\??mathfractionalternative\v!outer}%
+\defcsname\??mathfractionalternative\v!outer\endcsname
{\ifcase\d_math_fraction_margin
\expandafter\math_fraction_outer_normal
\else
\expandafter\math_fraction_outer_margin
\fi}
-\setvalue{\??mathfractionalternative\v!both}%
+\defcsname\??mathfractionalternative\v!both\endcsname
{\ifcase\d_math_fraction_margin
\expandafter\math_fraction_both_normal
\else
@@ -310,7 +310,7 @@
% }%
% \math_frac_wrapup}
%
-% \def\math_fraction_inner_margin#1#2%
+% \def n_inner_margin#1#2%
% {\Ustack{%
% {%
% {\kern\d_math_fraction_margin
diff --git a/tex/context/base/mkxl/meta-tex.mkxl b/tex/context/base/mkxl/meta-tex.mkxl
index 5937ce408..00ad3a58b 100644
--- a/tex/context/base/mkxl/meta-tex.mkxl
+++ b/tex/context/base/mkxl/meta-tex.mkxl
@@ -166,70 +166,137 @@
\installcorenamespace {svgfamily}
-\setvalue{\??svgfamily }{serif}
-\setvalue{\??svgfamily serif}{serif}
-\setvalue{\??svgfamily sans}{sans}
-\setvalue{\??svgfamily mono}{mono}
+\defcsname\??svgfamily \endcsname{serif}
+\defcsname\??svgfamily serif\endcsname{serif}
+\defcsname\??svgfamily sans\endcsname{sans}
+\defcsname\??svgfamily mono\endcsname{mono}
-%D This can't change because otherwise \type {\scale[width=4cm]{graphic}} fails.
+\definelayer[svgmps][\c!method=\v!fit]
-\permanent\protected\def\svgscaled#1%
- {\fastsxsy{#1}{#1}\svgnormal}
+\permanent\protected\def\svghashed#1%
+ {\clf_svghashed#1\relax}
-\permanent\protected\def\svgnormal#1#2#3#4% family weight style text
- {\bgroup
- \edef\p_family{#1}%
- \ifempty\p_family\else
- \edef\p_font{\ifcsname\??svgfamily#1\endcsname\lastnamedcs\else#1\fi-#2-#3}%
- \predefinedfont[\s!spec:\p_font*\s!default\space @ 10bp]%
- \fi
- #4%
- \egroup}
+\permanent\protected\def\svg_normal_poscode#1#2#3%
+ {\glyph xoffset #1\onebasepoint yoffset #2\onebasepoint #3\relax}
-\permanent\protected\def\svgcolored#1#2#3#4% r g b text
- {\colored[r=#1,g=#2,b=#3]{#4}}
+\permanent\protected\def\svg_normal_poschar#1#2#3%
+ {\glyph xoffset #1\onebasepoint yoffset #2\onebasepoint `#3\relax}
+
+\permanent\protected\def\svg_normal_posspace#1#2%
+ {\space}
+
+\permanent\protected\def\svg_normal_space#1%
+ {\space}
-% \permanent\protected\def\svgplaced#1#2#3#4% dx dy width text
-% {\doifelsenothing{#3}%
-% {\hpack}%
-% {\hpack to #3}%
-% {\raise#2\onebasepoint\hbox{\kern#1\onebasepoint\relax#4}}}
-
-\permanent\protected\def\svgplaced#1#2#3#4% dx dy width text
- {\doifelsenothing{#3}%
- {\hpack}%
- {\hpack to #3}%
- {\offsetbox[\c!y=#2]\hbox{\kern#1\relax#4}}}
-
-\newdimen\grph_svg_scratchwidth % maybe \startsvgpos etc
-
-\permanent\protected\def\svgposchar#1#2#3% dx dy char
- {\setbox\scratchbox\hpack\bgroup
- \raise#2\onebasepoint\hbox\bgroup
- \kern\dimexpr#1\onebasepoint-\grph_svg_scratchwidth\relax
- \char#3\relax
- \egroup
- \egroup
- \advance\grph_svg_scratchwidth\wd\scratchbox
- \box\scratchbox}
-
-\permanent\protected\def\svgchar#1% char
+\permanent\protected\def\svg_normal_code#1%
{\char#1\relax}
-\definelayer[svgmps][\c!method=\v!fit]
+\permanent\protected\def\svg_normal_char#1%
+ {#1\relax}
-\permanent\protected\def\svgstartlayer
+\permanent\protected\def\svg_normal_startlayer
{\resetlayer[svgmps]%
\setlayer[svgmps]\bgroup}
-\permanent\protected\def\svgstoplayer
+\permanent\protected\def\svg_normal_stoplayer
{\egroup
\flushlayer[svgmps]}
-\permanent\protected\def\svgsetlayer#1#2%
- {\setlayer[svgmps][\c!x=#1\onebasepoint,\c!y=#2\onebasepoint]} % {#3}
+\permanent\protected\def\svg_normal_colored#1#2#3#4%
+ {\colored[r=#1,g=#2,b=#3]{#4}}
-\permanent\protected\def\svghashed#1%
- {\clf_svghashed#1\relax}
+\permanent\protected\def\svg_normal_setlayer#1#2#3%
+ {\setlayer[svgmps]{\hbox xoffset #1\onebasepoint yoffset #2\onebasepoint to 10sp{#3}}}
+
+\permanent\protected\def\svg_normal_scaled#1#2#3#4#5%
+ {\hbox\bgroup
+ \edef\p_family{#2}%
+ \ifempty\p_family\else
+ \edef\p_font{\ifcsname\??svgfamily#2\endcsname\lastnamedcs\else#2\fi-#3-#4}%
+ \predefinedfont[\s!spec:\p_font*\s!default\space @ 10bp]%
+ \fi
+ \glyphscale\numericscale#1\relax % we need a period !
+ #5%
+ \egroup}
+
+\permanent\protected\def\svg_traced_poscode#1#2#3%
+ {\writestatus{SVG TEXT}{....[poscode #1 #2 \Uchar #3]}%
+ \svg_normal_poscode{#1}{#2}{#3}}
+
+\permanent\protected\def\svg_traced_poschar#1#2#3%
+ {\writestatus{SVG TEXT}{....[poschar #1 #2 #3]}%
+ \svg_normal_poschar{#1}{#2}{#3}}
+
+\permanent\protected\def\svg_traced_posspace#1#2%
+ {\writestatus{SVG TEXT}{....[posspace #1 #2]}%
+ \svg_normal_posspace{#1}{#2}}
+
+\permanent\protected\def\svg_traced_code#1%
+ {\writestatus{SVG TEXT}{....[char \Uchar #1]}%
+ \svg_normal_code{#1}}
+
+\permanent\protected\def\svg_traced_char#1%
+ {\writestatus{SVG TEXT}{....[char #1]}%
+ \svg_normal_char{#1}}
+
+\permanent\protected\def\svg_traced_space
+ {\writestatus{SVG TEXT}{....[space]}%
+ \svg_normal_space}
+
+\permanent\protected\def\svg_traced_startlayer
+ {\writestatus{SVG TEXT}{[start layer]}%
+ \svg_normal_startlayer}
+
+\permanent\protected\def\svg_traced_stoplayer
+ {\svg_normal_stoplayer
+ \writestatus{SVG TEXT}{[stop layer]}}
+
+\permanent\protected\def\svg_traced_colored#1#2#3#4%
+ {\writestatus{SVG TEXT}{.[start color #1 #2 #3]}%
+ \svg_normal_colored{#1}{#2}{#3}{#4}%
+ \writestatus{SVG TEXT}{.[stop color]}}
+
+\permanent\protected\def\svg_traced_setlayer#1#2#3%
+ {\writestatus{SVG TEXT}{...[start set layer #1 #2]}%
+ \svg_normal_setlayer{#1}{#2}{#3}%
+ \writestatus{SVG TEXT}{...[stop set setlayer]}}
+
+\permanent\protected\def\svg_traced_scaled#1#2#3#4#5%
+ {\writestatus{SVG TEXT}{..[start scaled font #1 #2 #3 #4]}%
+ \svg_normal_scaled{#1}{#2}{#3}{#4}{#5}%
+ \writestatus{SVG TEXT}{..[stop scaled font]}}
+
+\permanent\protected\def\svg_normal_text
+ {\let\svgposcode \svg_normal_poscode
+ \let\svgposchar \svg_normal_poschar
+ \let\svgposspace \svg_normal_posspace
+ \let\svgcode \svg_normal_code
+ \let\svgchar \svg_normal_char
+ \let\svgspace \svg_normal_space
+ \let\svgstartlayer\svg_normal_startlayer
+ \let\svgstoplayer \svg_normal_stoplayer
+ \let\svgcolored \svg_normal_colored
+ \let\svgsetlayer \svg_normal_setlayer
+ \let\svgscaled \svg_normal_scaled}
+
+\permanent\protected\def\svg_traced_text
+ {\let\svgposcode \svg_traced_poscode
+ \let\svgposchar \svg_traced_poschar
+ \let\svgposspace \svg_traced_posspace
+ \let\svgcode \svg_traced_code
+ \let\svgchar \svg_traced_char
+ \let\svgspace \svg_traced_space
+ \let\svgstartlayer\svg_traced_startlayer
+ \let\svgstoplayer \svg_traced_stoplayer
+ \let\svgcolored \svg_traced_colored
+ \let\svgsetlayer \svg_traced_setlayer
+ \let\svgscaled \svg_traced_scaled}
+
+\installtextracker
+ {svg.text}
+ {\svg_traced_text}
+ {\svg_normal_text}
+
+\svg_normal_text
\protect \endinput
diff --git a/tex/context/base/mkxl/mlib-pdf.lmt b/tex/context/base/mkxl/mlib-pdf.lmt
index c383d52de..f3226d14d 100644
--- a/tex/context/base/mkxl/mlib-pdf.lmt
+++ b/tex/context/base/mkxl/mlib-pdf.lmt
@@ -68,14 +68,9 @@ trackers.register("metapost.forcestroke",function(v)
force_stroke = v
end)
--- Because in MKiV we always have two passes, we save the objects. When an extra
--- mp run is done (due to for instance texts identifier in the parse pass), we
--- get a new result table and the stored objects are forgotten. Otherwise they
--- are reused.
-
-local function getobjects(result,figure,index)
- return figure:objects()
-end
+-- local function gettolerance(objects)
+-- return objects:tolerance()
+-- end
function metapost.convert(specification,result)
local flusher = specification.flusher
@@ -116,8 +111,6 @@ function pdfflusher.textfigure(font,size,text,width,height,depth) -- we could sa
context.MPtextext(font,size,text,0,-number.dimenfactors.bp*depth)
end
-local bend_tolerance = 131/65536
-
local rx, sx, sy, ry, tx, ty, divider = 1, 0, 0, 1, 0, 0, 1
local function pen_characteristics(object)
@@ -131,18 +124,39 @@ local function mpconcat(px, py) -- no tx, ty here / we can move this one inline
return (sy*px-ry*py)/divider,(sx*py-rx*px)/divider
end
-local function curved(ith,pth)
+local getbendtolerance = metapost.getbendtolerance
+
+local function curved(ith,pth,tolerance) --- still better than the build in
+ -- if pth.right_x == pth.x_coord then
+ -- if pth.right_y == pth.y_coord then
+ -- if ith.left_x == ith.x_coord then
+ -- if ith.left_y == ith.y_coord then
+ -- return false
+ -- end
+ -- end
+ -- end
+ -- end
local d = pth.left_x - ith.right_x
- if abs(ith.right_x - ith.x_coord - d) <= bend_tolerance and abs(pth.x_coord - pth.left_x - d) <= bend_tolerance then
- d = pth.left_y - ith.right_y
- if abs(ith.right_y - ith.y_coord - d) <= bend_tolerance and abs(pth.y_coord - pth.left_y - d) <= bend_tolerance then
- return false
+ local b = abs(ith.right_x - ith.x_coord - d)
+ if b <= tolerance then
+ b = abs(pth.x_coord - pth.left_x - d)
+ if b <= tolerance then
+ d = pth.left_y - ith.right_y
+ b = abs(ith.right_y - ith.y_coord - d)
+ if b <= tolerance then
+ b = abs(pth.y_coord - pth.left_y - d)
+ if b <= tolerance then
+-- print(tolerance,ith.curved,pth.curved,false)
+ return false
+ end
+ end
end
end
+-- print(tolerance,ith.curved,pth.curved,true)
return true
end
-local function flushnormalpath(path, t, open)
+local function flushnormalpath(path, t, open, tolerance)
local pth, ith, nt
local length = #path
if t then
@@ -156,8 +170,8 @@ local function flushnormalpath(path, t, open)
pth = path[i]
if not ith then
t[nt] = f_m(pth.x_coord,pth.y_coord)
--- elseif curved(ith,pth) then
-elseif pth.curved then
+ elseif curved(ith,pth,tolerance) then
+-- elseif pth.curved then
t[nt] = f_c(ith.right_x,ith.right_y,pth.left_x,pth.left_y,pth.x_coord,pth.y_coord)
else
t[nt] = f_l(pth.x_coord,pth.y_coord)
@@ -167,8 +181,8 @@ elseif pth.curved then
if not open then
nt = nt + 1
local one = path[1]
--- if curved(pth,one) then
-if one.curved then
+ if curved(pth,one,tolerance) then
+-- if one.curved then
t[nt] = f_c(pth.right_x,pth.right_y,one.left_x,one.left_y,one.x_coord,one.y_coord)
else
t[nt] = f_l(one.x_coord,one.y_coord)
@@ -182,7 +196,7 @@ if one.curved then
return t
end
-local function flushconcatpath(path, t, open)
+local function flushconcatpath(path, t, open, tolerance)
local pth, ith, nt
local length = #path
if t then
@@ -198,8 +212,8 @@ local function flushconcatpath(path, t, open)
pth = path[i]
if not ith then
t[nt] = f_m(mpconcat(pth.x_coord,pth.y_coord))
--- elseif curved(ith,pth) then
-elseif pth.curved then
+ elseif curved(ith,pth,tolerance) then
+-- elseif pth.curved then
local a, b = mpconcat(ith.right_x,ith.right_y)
local c, d = mpconcat(pth.left_x,pth.left_y)
t[nt] = f_c(a,b,c,d,mpconcat(pth.x_coord,pth.y_coord))
@@ -211,8 +225,8 @@ elseif pth.curved then
if not open then
nt = nt + 1
local one = path[1]
--- if curved(pth,one) then
-if one.curved then
+ if curved(pth,one,tolerance) then
+-- if one.curved then
local a, b = mpconcat(pth.right_x,pth.right_y)
local c, d = mpconcat(one.left_x,one.left_y)
t[nt] = f_c(a,b,c,d,mpconcat(one.x_coord, one.y_coord))
@@ -256,7 +270,10 @@ local function toboundingbox(path)
end
end
-metapost.flushnormalpath = flushnormalpath
+
+function metapost.flushnormalpath(path, t, open, tolerance)
+ return flushnormalpath(path, t, open, tolerance or getbendtolerance())
+end
-- The flusher is pdf based, if another backend is used, we need to overload the
-- flusher; this is beta code, the organization will change (already upgraded in
@@ -376,7 +393,8 @@ function metapost.flush(specification,result)
local figure = figures[index]
local properties = pushproperties(figure)
if askedfig == "direct" or askedfig == "all" or askedfig == properties.number then
- local objects = getobjects(result,figure,index)
+ local objects = figure:objects()
+ local tolerance = figure:tolerance() or getbendtolerance()
local result = { }
local miterlimit = -1
local linecap = -1
@@ -424,26 +442,28 @@ function metapost.flush(specification,result)
__index = original
})
local before,
- after = processplugins(object)
+ after,
+ options = processplugins(object)
local evenodd = false
local collect = false
local both = false
local flush = false
local postscript = object.postscript
- if not object.istext then
- if postscript == "evenodd" then
- evenodd = true
- elseif postscript == "collect" then
- collect = true
- elseif postscript == "flush" then
- flush = true
- elseif postscript == "both" then
- both = true
- elseif postscript == "eoboth" then
- evenodd = true
- both = true
- end
+ local tolerance = options and tonumber(options.tolerance) or tolerance
+ -- if not object.istext then
+ if postscript == "evenodd" then
+ evenodd = true
+ elseif postscript == "collect" then
+ collect = true
+ elseif postscript == "flush" then
+ flush = true
+ elseif postscript == "both" then
+ both = true
+ elseif postscript == "eoboth" then
+ evenodd = true
+ both = true
end
+ -- end
--
if flush and not savedpath then
-- forget about it
@@ -520,9 +540,9 @@ function metapost.flush(specification,result)
for i=1,#savedpath do
local path = savedpath[i]
if transformed then
- flushconcatpath(path,result,open)
+ flushconcatpath(path,result,open,tolerance)
else
- flushnormalpath(path,result,open)
+ flushnormalpath(path,result,open,tolerance)
end
end
savedpath = nil
@@ -530,9 +550,9 @@ function metapost.flush(specification,result)
if flush then
-- ignore this path
elseif transformed then
- flushconcatpath(path,result,open)
+ flushconcatpath(path,result,open,tolerance)
else
- flushnormalpath(path,result,open)
+ flushnormalpath(path,result,open,tolerance)
end
if force_stroke then
result[#result+1] = open and "S" or "h S"
@@ -560,18 +580,18 @@ function metapost.flush(specification,result)
for i=1,#savedhtap do
local path = savedhtap[i]
if transformed then
- flushconcatpath(path,result,open)
+ flushconcatpath(path,result,open,tolerance)
else
- flushnormalpath(path,result,open)
+ flushnormalpath(path,result,open,tolerance)
end
end
savedhtap = nil
evenodd = true
end
if transformed then
- flushconcatpath(path,result,open)
+ flushconcatpath(path,result,open,tolerance)
else
- flushnormalpath(path,result,open)
+ flushnormalpath(path,result,open,tolerance)
end
if force_stroke then
result[#result+1] = open and "S" or "h S"
@@ -595,9 +615,10 @@ function metapost.flush(specification,result)
miterlimit, linecap, linejoin, dashed, linewidth = -1, -1, -1, "", false
end
elseif objecttype == "start_clip" then
- local evenodd = not object.istext and object.postscript == "evenodd"
+ -- local evenodd = not object.istext and object.postscript == "evenodd"
+ local evenodd = object.postscript == "evenodd"
result[#result+1] = "q"
- flushnormalpath(object.path,result,false)
+ flushnormalpath(object.path,result,false,tolerance)
result[#result+1] = evenodd and "W* n" or "W n"
elseif objecttype == "stop_clip" then
result[#result+1] = "Q"
@@ -715,7 +736,7 @@ function metapost.totable(result,askedfig)
local figure = result and result.fig and result.fig[1]
if figure then
local results = { }
- local objects = getobjects(result,figure,askedfig)
+ local objects = figure:objects()
for o=1,#objects do
local object = objects[o]
local result = { }
diff --git a/tex/context/base/mkxl/mlib-pps.lmt b/tex/context/base/mkxl/mlib-pps.lmt
index 32f23c39d..d668d1b10 100644
--- a/tex/context/base/mkxl/mlib-pps.lmt
+++ b/tex/context/base/mkxl/mlib-pps.lmt
@@ -709,15 +709,16 @@ function metapost.processplugins(object) -- each object (second pass)
if top and top.plugmode then
local prescript = object.prescript -- specifications
if prescript and #prescript > 0 then
- local before = { }
- local after = { }
- processoractions.runner(object,splitprescript(prescript) or { },before,after)
- return #before > 0 and before, #after > 0 and after
+ local before = { }
+ local after = { }
+ local options = splitprescript(prescript) or { }
+ processoractions.runner(object,options,before,after)
+ return #before > 0 and before, #after > 0 and after, options
else
local c = object.color
if c and #c > 0 then
local b, a = colorconverter(c)
- return { b }, { a }
+ return { b }, { a }, { }
end
end
end
diff --git a/tex/context/base/mkxl/mlib-run.lmt b/tex/context/base/mkxl/mlib-run.lmt
index eacb148cc..c85acdee3 100644
--- a/tex/context/base/mkxl/mlib-run.lmt
+++ b/tex/context/base/mkxl/mlib-run.lmt
@@ -184,6 +184,19 @@ end
local seed = nil
+local default_tolerance = 131/65536.0 -- a little below 0.001 * 0x7FFF/0x4000
+local bend_tolerance = default_tolerance
+
+----- bend_tolerance = 10/2000
+
+function metapost.setbendtolerance(t)
+ bend_tolerance = t or default_tolerance
+end
+
+function metapost.getbendtolerance()
+ return bend_tolerance
+end
+
function metapost.load(name,method)
starttiming(mplib)
if not seed then
@@ -198,6 +211,7 @@ function metapost.load(name,method)
local mpx, terminal = new_instance {
-- noninteractive = true;
-- ini_version = true,
+ tolerance = bend_tolerance,
math_mode = method,
run_script = metapost.runscript,
script_error = metapost.scripterror,
diff --git a/tex/context/base/mkxl/mlib-svg.lmt b/tex/context/base/mkxl/mlib-svg.lmt
index dca2b6d19..e405eaa8d 100644
--- a/tex/context/base/mkxl/mlib-svg.lmt
+++ b/tex/context/base/mkxl/mlib-svg.lmt
@@ -129,6 +129,9 @@ local trace_fonts = false trackers.register("metapost.svg.fonts", function(v)
-- This is just an experiment. Todo: reset hash etc. Also implement
-- an option handler.
+local s_draw_image_start = "draw image ("
+local s_draw_image_stop = ") ;"
+
local svghash = false do
local svglast = 0
@@ -477,12 +480,12 @@ local colorcomponents, withcolor, thecolor, usedcolors do
whitesmoke = 0xF5F5F5, yellow = 0xFFFF00, yellowgreen = 0x9ACD32,
}
- local f_rgb = formatters['withcolor svgcolor(%.3N,%.3N,%.3N)']
- local f_cmyk = formatters['withcolor svgcmyk(%.3N,%.3N,%.3N,%.3N)']
- local f_gray = formatters['withcolor svggray(%.3N)']
- local f_rgba = formatters['withcolor svgcolor(%.3N,%.3N,%.3N) withtransparency (1,%.3N)']
- local f_graya = formatters['withcolor svggray(%.3N) withtransparency (1,%.3N)']
- local f_name = formatters['withcolor "%s"']
+ local f_rgb = formatters[' withcolor svgcolor(%.3N,%.3N,%.3N)']
+ local f_cmyk = formatters[' withcolor svgcmyk(%.3N,%.3N,%.3N,%.3N)']
+ local f_gray = formatters[' withcolor svggray(%.3N)']
+ local f_rgba = formatters[' withcolor svgcolor(%.3N,%.3N,%.3N) withtransparency (2,1-%.3N)']
+ local f_graya = formatters[' withcolor svggray(%.3N) withtransparency (2,1-%.3N)']
+ local f_name = formatters[' withcolor "%s"']
local f_svgrgb = formatters['svgcolor(%.3N,%.3N,%.3N)']
local f_svgcmyk = formatters['svgcmyk(%.3N,%.3N,%.3N,%.3N)']
local f_svggray = formatters['svggray(%.3N)']
@@ -1166,104 +1169,129 @@ end
-- todo: viewbox helper
-local s_wrapped_start = "draw image ("
+local s_wrapped_start = s_draw_image_start
local f_wrapped_stop = formatters[") shifted (0,%N) scaled %N ;"]
local handletransform, handleviewbox do
local sind = math.sind
- --todo: better lpeg
-
- local f_rotatedaround = formatters[" rotatedaround((%N,%N),%N)"]
- local f_rotated = formatters[" rotated(%N)"]
- local f_shifted = formatters[" shifted(%N,%N)"]
- local f_slanted_x = formatters[" xslanted(%N)"]
- local f_slanted_y = formatters[" yslanted(%N)"]
- local f_scaled = formatters[" scaled(%N)"]
- local f_xyscaled = formatters[" xyscaled(%N,%N)"]
- local f_matrix = formatters[" transformed bymatrix(%N,%N,%N,%N,%N,%N)"]
-
+ -- local f_rotatedaround = formatters["svg_p := svg_p rotatedaround((%N,%N),%N) ;"]
+ -- local f_rotated = formatters["svg_p := svg_p rotated(%N) ;"]
+ -- local f_shifted = formatters["svg_p := svg_p shifted(%N,%N) ;"]
+ -- local f_slanted_x = formatters["svg_p := svg_p xslanted(%N) ;"]
+ -- local f_slanted_y = formatters["svg_p := svg_p yslanted(%N) ;"]
+ -- local f_scaled = formatters["svg_p := svg_p scaled(%N) ;"]
+ -- local f_xyscaled = formatters["svg_p := svg_p xyscaled(%N,%N) ;"]
+ -- local f_matrix = formatters["svg_p := svg_p transformed bymatrix(%N,%N,%N,%N,%N,%N) ;"]
+ -- local s_transform_start = "draw image ( begingroup ; save svg_p ; picture svg_p ; svg_p := image ( "
+ -- local f_transform_stop = formatters[" ; ) ; %s ; draw svg_p ; endgroup ; ) ; "]
+
+ local f_rotatedaround = formatters["rotatedaround((%N,%N),%N) "]
+ local f_rotated = formatters["rotated(%N) "]
+ local f_shifted = formatters["shifted(%N,%N) "]
+ local f_slanted_x = formatters["xslanted(%N) "]
+ local f_slanted_y = formatters["yslanted(%N) "]
+ local f_scaled = formatters["scaled(%N) "]
+ local f_xyscaled = formatters["xyscaled(%N,%N) "]
+ local f_matrix = formatters["transformed bymatrix(%N,%N,%N,%N,%N,%N) "]
local s_transform_start = "draw image ( "
- local f_transform_stop = formatters[")%s ;"]
+ local f_transform_stop = formatters[") %s ; "]
+
+ local transforms = { }
+ local noftransforms = 0
local function rotate(r,x,y)
- if x then
- return r and f_rotatedaround(x,-(y or x),-r)
- elseif r then
- return f_rotated(-r)
- else
- return ""
+ if r then
+ noftransforms = noftransforms + 1
+ if x then
+ transforms[noftransforms] = f_rotatedaround(x,-(y or x),-r)
+ else
+ transforms[noftransforms] = f_rotated(-r)
+ end
end
end
local function translate(x,y)
if y then
- return f_shifted(x,-y)
+ noftransforms = noftransforms + 1
+ transforms[noftransforms] = f_shifted(x,-y)
elseif x then
- return f_shifted(x,0)
- else
- return ""
+ noftransforms = noftransforms + 1
+ transforms[noftransforms] = f_shifted(x,0)
end
end
local function scale(x,y)
if y then
- return f_xyscaled(x,y)
+ noftransforms = noftransforms + 1
+ transforms[noftransforms] = f_xyscaled(x,y)
elseif x then
- return f_scaled(x)
- else
- return ""
+ noftransforms = noftransforms + 1
+ transforms[noftransforms] = f_scaled(x)
end
end
local function skewx(x)
if x then
- return f_slanted_x(sind(-x))
- else
- return ""
+ noftransforms = noftransforms + 1
+ transforms[noftransforms] = f_slanted_x(sind(-x))
end
end
local function skewy(y)
if y then
- return f_slanted_y(sind(-y))
- else
- return ""
+ noftransforms = noftransforms + 1
+ transforms[noftransforms] = f_slanted_y(sind(-y))
end
end
local function matrix(rx,sx,sy,ry,tx,ty)
- return f_matrix(rx or 1, sx or 0, sy or 0, ry or 1, tx or 0, - (ty or 0))
+ if not ty then
+ ty = 0
+ end
+ if not tx then
+ tx = 0
+ end
+ if not sx then
+ sx = 0
+ end
+ if not sy then
+ sy = 0
+ end
+ if not rx then
+ rx = 1
+ end
+ if not ry then
+ ry = 1
+ end
+ noftransforms = noftransforms + 1
+ -- transforms[noftransforms] = f_matrix(rx, sx, sy, ry, tx, -ty)
+ -- https://en.wikipedia.org/wiki/Rotation_matrix : we're counter clockwise
+ transforms[noftransforms] = f_matrix(rx, -sy, -sx, ry, tx, -ty)
end
- -- How to deal with units here? Anyway, order seems to matter.
-
- local p_transform = Cf ( Ct("") * (
- lpegpatterns.whitespace^0 * Cg(
- C("translate") * (p_numbers / translate) -- maybe xy
- + C("scale") * (p_numbers / scale)
- + C("rotate") * (p_numbers / rotate)
- + C("matrix") * (p_numbers / matrix)
- + C("skewX") * (p_numbers / skewx)
- + C("skewY") * (p_numbers / skewy)
+ local p_transform = (
+ lpegpatterns.whitespace^0 * (
+ P("translate") * (p_numbers / translate) -- maybe xy
+ + P("scale") * (p_numbers / scale)
+ + P("rotate") * (p_numbers / rotate)
+ + P("matrix") * (p_numbers / matrix)
+ + P("skewX") * (p_numbers / skewx)
+ + P("skewY") * (p_numbers / skewy)
)
- )^1, rawset)
+ )^1
handletransform = function(at)
local t = at.transform
if t then
- local e = lpegmatch(p_transform,t)
- if e then
- e = concat({
- e.rotate or "",
- e.skewX or "",
- e.skewY or "",
- e.scale or "",
- e.translate or "",
- e.matrix or "",
- }, " ")
- return s_transform_start, f_transform_stop(e), t
+ noftransforms = 0
+ lpegmatch(p_transform,t)
+ if noftransforms > 0 then
+ -- currentpicture
+ local start = s_transform_start
+ local stop = f_transform_stop(concat(transforms,"",1,noftransforms))
+ return start, stop, t
end
end
end
@@ -1564,15 +1592,15 @@ do
end
end
- local s_shade_linear = ' withshademethod "linear" '
- local s_shade_circular = ' withshademethod "circular" '
+ local s_shade_linear = ' withshademethod "linear" '
+ local s_shade_circular = ' withshademethod "circular" '
local f_shade_step = formatters['withshadestep ( withshadefraction %N withshadecolors(%s,%s) )']
local f_shade_one = formatters['withprescript "sh_center_a=%N %N"']
local f_shade_two = formatters['withprescript "sh_center_b=%N %N"']
- local f_color = formatters['withcolor "%s"']
- local f_opacity = formatters['withtransparency (1,%N)']
- local f_pen = formatters['withpen pencircle scaled %N']
+ local f_color = formatters[' withcolor "%s"']
+ local f_opacity = formatters[' withtransparency (2,%N)']
+ local f_pen = formatters[' withpen pencircle scaled %N']
-- todo: gradient unfinished
-- todo: opacity but first we need groups in mp
@@ -1679,7 +1707,7 @@ do
elseif o then
o = asnumber_r(o)
if o and o ~= 1 then
- o = f_opacity(o)
+ o = f_opacity(1-o)
else
o = nil
end
@@ -1687,15 +1715,16 @@ do
return p, d, c, o
end
- local s_opacity_start = "draw image ("
- local f_opacity_stop = formatters["setgroup currentpicture to boundingbox currentpicture withtransparency (1,%N)) ;"]
+ local s_opacity_start = s_draw_image_start
+ local f_opacity_content = formatters["setgroup currentpicture to boundingbox currentpicture withtransparency (1,%N);"]
+ local s_opacity_stop = s_draw_image_stop
local function sharedopacity(at)
local o = at["opacity"]
if o and o ~= "none" then
o = asnumber_r(o)
if o and o ~= 1 then
- return s_opacity_start, f_opacity_stop(o)
+ return s_opacity_start, f_opacity_content(1-o), s_opacity_stop
end
end
end
@@ -1708,7 +1737,7 @@ do
if o == 1 then
return c
elseif o then
- return c, f_opacity(o), o == 0
+ return c, f_opacity(1-o), o == 0
end
end
return c
@@ -1730,11 +1759,11 @@ do
end
end
- local s_viewport_start = "draw image ("
- local s_viewport_stop = ") ;"
- local f_viewport_shift = formatters["currentpicture := currentpicture shifted (%03N,%03N);"]
- local f_viewport_scale = formatters["currentpicture := currentpicture xysized (%03N,%03N);"]
- local f_viewport_clip = formatters["clip currentpicture to (unitsquare xyscaled (%03N,%03N));"]
+ local s_viewport_start = s_draw_image_start
+ local s_viewport_stop = s_draw_image_stop
+ local f_viewport_shift = formatters["currentpicture := currentpicture shifted (%N,%N);"]
+ local f_viewport_scale = formatters["currentpicture := currentpicture xysized (%N,%N);"]
+ local f_viewport_clip = formatters["clip currentpicture to (unitsquare xyscaled (%N,%N));"]
local function viewport(x,y,w,h,noclip,scale)
r = r + 1 ; result[r] = s_viewport_start
@@ -1783,7 +1812,7 @@ do
end
local uselevel = 0
- local bodyfontscale = 1
+ -- local bodyfontscale = 1
function handlers.use(c)
local at = c.at
@@ -1829,14 +1858,14 @@ do
end
end
- local f_no_draw = formatters['nodraw (%s)']
- local f_do_draw = formatters['draw (%s)']
- local f_no_fill_c = formatters['nofill (%s..cycle)']
- local f_do_fill_c = formatters['fill (%s..cycle)']
- local f_eo_fill_c = formatters['eofill (%s..cycle)']
- local f_no_fill_l = formatters['nofill (%s--cycle)']
- local f_do_fill_l = formatters['fill (%s--cycle)']
- local f_eo_fill_l = formatters['eofill (%s--cycle)']
+ local f_no_draw = formatters[' nodraw (%s)']
+ local f_do_draw = formatters[' draw (%s)']
+ local f_no_fill_c = formatters[' nofill closedcurve(%s)']
+ local f_do_fill_c = formatters[' fill closedcurve(%s)']
+ local f_eo_fill_c = formatters[' eofill closedcurve(%s)']
+ local f_no_fill_l = formatters[' nofill closedlines(%s)']
+ local f_do_fill_l = formatters[' fill closedlines(%s)']
+ local f_eo_fill_l = formatters[' eofill closedlines(%s)']
local f_do_fill = f_do_fill_c
local f_eo_fill = f_eo_fill_c
local f_no_fill = f_no_fill_c
@@ -1883,7 +1912,7 @@ do
r = r + 1 ; result[r] = etransform
end
- r = r + 1 ; result[r] = ";"
+ r = r + 1 ; result[r] = " ;"
if cpath then
local f_done = cpath.evenodd
@@ -1900,9 +1929,9 @@ do
local flush
- local f_linecap = formatters["interim linecap := %s ;"]
- local f_linejoin = formatters["interim linejoin := %s ;"]
- local f_miterlimit = formatters["interim miterlimit := %s ;"]
+ local f_linecap = formatters[" interim linecap := %s ;"]
+ local f_linejoin = formatters[" interim linejoin := %s ;"]
+ local f_miterlimit = formatters[" interim miterlimit := %s ;"]
local s_begingroup = "begingroup;"
local s_endgroup = "endgroup;"
@@ -2128,12 +2157,12 @@ do
local has_stroke = stroke and stroke ~= "none"
local has_fill = fill and fill ~= "none"
- local bopacity, eopacity
+ local bopacity, copacity, eopacity
if has_stroke and has_fill then
- bopacity, eopacity = sharedopacity(at)
+ bopacity, copacity, eopacity = sharedopacity(at)
end
- if bopacity then
+ if copacity then
r = r + 1 ; result[r] = bopacity
end
@@ -2150,7 +2179,7 @@ do
if opacity then
r = r + 1 ; result[r] = opacity
end
- r = r + 1 ; result[r] = etransform or ";"
+ r = r + 1 ; result[r] = etransform or " ;"
end
if has_stroke then
@@ -2172,7 +2201,7 @@ do
if opacity then
r = r + 1 ; result[r] = opacity
end
- r = r + 1 ; result[r] = etransform or ";"
+ r = r + 1 ; result[r] = etransform or " ;"
--
if list then
addmarkers(list,begmarker,midmarker,endmarker,at)
@@ -2183,7 +2212,8 @@ do
end
end
- if eopacity then
+ if copacity then
+ r = r + 1 ; result[r] = copacity
r = r + 1 ; result[r] = eopacity
end
@@ -2230,8 +2260,8 @@ do
y = y - height
- if rx then rx = asnumber(rx) end
- if ry then ry = asnumber(ry) end
+ if rx then rx = asnumber_x(rx) end
+ if ry then ry = asnumber_y(ry) end
if rx or ry then
if not rx then rx = ry end
@@ -2298,8 +2328,8 @@ do
function handlers.polyline(c) poly(c, ")") end
function handlers.polygon (c) poly(c,"--cycle)") end
- local s_image_start = "draw image ("
- local s_image_stop = ") ;"
+ local s_image_start = s_draw_image_start
+ local s_image_stop = s_draw_image_stop
function handlers.path(c)
local at = c.at
@@ -2339,7 +2369,7 @@ do
if opacity then
r = r + 1 ; result[r] = opacity
end
- r = r + 1 ; result[r] = etransform or ";"
+ r = r + 1 ; result[r] = etransform or " ;"
else
r = r + 1 ; result[r] = btransform or s_image_start
for i=1,n do
@@ -2354,7 +2384,7 @@ do
else
r = r + 1 ; result[r] = f_no_fill(shape[i])
end
- r = r + 1 ; result[r] = ";"
+ r = r + 1 ; result[r] = " ;"
end
r = r + 1 ; result[r] = etransform or s_image_stop
end
@@ -2386,9 +2416,9 @@ do
if opacity then
r = r + 1 ; result[r] = opacity
end
- r = r + 1 result[r] = etransform or ";"
+ r = r + 1 result[r] = etransform or " ;"
else
- r = r + 1 result[r] = btransform or "draw image ("
+ r = r + 1 result[r] = btransform or s_draw_image_start
for i=1,n do
r = r + 1 result[r] = f_do_draw(shape[i])
if pen then
@@ -2403,12 +2433,12 @@ do
if opacity then
r = r + 1 ; result[r] = opacity
end
- r = r + 1 ; result[r] = ";"
+ r = r + 1 ; result[r] = " ;"
end
if list then
addmarkers(list,begmarker,midmarker,endmarker,at)
end
- r = r + 1 ; result[r] = etransform or ") ;"
+ r = r + 1 ; result[r] = etransform or s_draw_image_stop
end
if wrapup then
wrapup()
@@ -2554,25 +2584,26 @@ do
-- The size is a bit of an issue. I assume that the specified size relates to the
-- designsize but we want to be able to use other fonts.
- do
-
- local f_styled = formatters["\\svgstyled{%s}{%s}{%s}{%s}"]
- local f_colored = formatters["\\svgcolored{%.3N}{%.3N}{%.3N}{"]
--- local f_placed = formatters["\\svgplaced{%.3N}{%.3N}{}{"]
-local f_placed = formatters["\\svgplaced{%s}{%s}{}{"]
- local f_poschar = formatters["\\svgposchar{%.3N}{%.3N}{%s}"]
- local f_char = formatters["\\svgchar{%s}"]
-
- local f_scaled = formatters["\\svgscaled{%N}{%s}{%s}{%s}"]
- local f_normal = formatters["\\svgnormal{%s}{%s}{%s}"]
- local f_hashed = formatters["\\svghashed{%s}"]
+ -- a mix of text and spans and possibly wrap (where xy is to be ignored) ... bah ...
+ -- it's fuzzy when we have a span with positions mixed with text ... basically that
+ -- is a box and we can assume that an editor then has all positioned
- -- We move to the outer (x,y) and when we have an inner offset we
- -- (need to) compensate for that outer offset.
+ do
- -- local f_text_scaled_svg = formatters['(svgtext("%s") scaled %N shifted (%N,%N))']
- -- local f_text_normal_svg = formatters['(svgtext("%s") shifted (%N,%N))']
- -- local f_text_simple_svg = formatters['svgtext("%s")']
+ local s_startlayer = "\\svgstartlayer "
+ local s_stoplayer = "\\svgstoplayer "
+ local f_setlayer = formatters["\\svgsetlayer{%N}{%N}"] -- we need a period
+ local f_colored = formatters["\\svgcolored{%.3N}{%.3N}{%.3N}{"]
+ local f_poscode = formatters["\\svgposcode{%N}{%N}{%s}"]
+ local f_poschar = formatters["\\svgposchar{%N}{%N}{%s}"]
+ local f_posspace = formatters["\\svgposspace{%N}{%N}"]
+ local f_coder = formatters["\\svgcode{%s}"]
+ local f_char = formatters["\\svgchar{%s}"]
+ local s_space = "\\svgspace "
+ local f_scaled = formatters["\\svgscaled{%0.6f}{%s}{%s}{%s}"] -- we need a period
+ local f_hashed = formatters["\\svghashed{%s}"]
+
+ local p_texescape = lpegpatterns.texescape
local anchors = {
["start"] = "drt",
@@ -2580,11 +2611,10 @@ local f_placed = formatters["\\svgplaced{%s}{%s}{}{"]
["middle"] = "d",
}
+ -- we can now just use the lmt maptext feature
+
local f_text_normal_svg = formatters['(textext.%s("%s") shifted (%N,%N))']
local f_text_simple_svg = formatters['textext.%s("%s")']
-
- -- or just maptext
-
local f_mapped_normal_svg = formatters['(svgtext("%s") shifted (%N,%N))']
local f_mapped_simple_svg = formatters['svgtext("%s")']
@@ -2599,8 +2629,6 @@ local f_placed = formatters["\\svgplaced{%s}{%s}{}{"]
return v
end)
- local p_texescape = lpegpatterns.texescape
-
-- For now as I need it for my (some 1500) test files.
local function checkedfamily(name)
@@ -2612,14 +2640,62 @@ local f_placed = formatters["\\svgplaced{%s}{%s}{}{"]
-- todo: only escape some chars and handle space
+ -- An arbitrary mix of text and spans with x/y is asking for troubles. The fact that the
+ -- description in the (proposed) standard is so complex indicates this (its also looks
+ -- like reveng application specs and doesn't aim at simplicity. Basically we have two
+ -- cases: positioned lines and words and such (text & span with xy), or just stripes of
+ -- text and span. Free flow automatically broken into lines text is kind of strange in
+ -- svg and the fact that glyph placement is dropped is both an indication that svg lost
+ -- part of its purpose and probably also that it never really was a standard (although
+ -- maybe today standards are just short term specifications. Who knows.
+
+ -- text with spans, all with x/y
+ -- text mixed with spans, no xy in inner elements
+ --
+ -- the spec says that nested x/y are absolute
+
local defaultsize = 10
- local function collect(t,c,x,y,size,scale,family,tx,ty)
+ local sensitive = { -- todo: characters.sensitive
+ ["#"] = true,
+ ["$"] = true,
+ ["%"] = true,
+ ["&"] = true,
+ ["\\"] = true,
+ ["{"] = true,
+ ["|"] = true,
+ ["}"] = true,
+ ["~"] = true,
+ }
+
+ -- messy: in nested spans (they happen) the x/y are not accumulated
+
+ local function validdelta(usedscale,d)
+ if d then
+ local value, unit = match(d,"^([%A]-)(%a+)")
+ value = tonumber(value) or 0
+ if not unit then
+ return value .. "bp"
+ elseif unit == "ex" or unit == "em" then
+ return (usedscale * value) .. unit
+ else
+ return value .. "bp"
+ end
+ else
+ return "0bp"
+ end
+ end
+
+ local function collect(parent,t,c,x,y,size,scale,family,tx,ty,tdx,tdy)
+ if c.special then
+ return nil
+ end
+ local dt = c.dt
+ local nt = #dt
local at = c.at
+ local tg = c.tg
local ax = rawget(at,"x")
local ay = rawget(at,"y")
- local dx = rawget(at,"dx")
- local dy = rawget(at,"dy")
local v_fill = at["fill"]
local v_family = at["font-family"]
local v_style = at["font-style"]
@@ -2629,9 +2705,6 @@ local f_placed = formatters["\\svgplaced{%s}{%s}{}{"]
ax = ax and asnumber_vx(ax) or x
ay = ay and asnumber_vy(ay) or y
--
-local d_x = dx and asnumber_vx(dx) or 0
-local d_y = dy and asnumber_vy(dy) or 0
- --
if v_family then v_family = cssfamily(v_family) end
if v_style then v_style = cssstyle (v_style) end
if v_weight then v_weight = cssweight(v_weight) end
@@ -2651,63 +2724,27 @@ local d_y = dy and asnumber_vy(dy) or 0
ax = ax - x
ay = ay - y
--
- local elayered = ax ~= 0 or ay ~= 0 or false
--- local eplaced = dx ~= 0 or dy ~= 0 or false
-local eplaced = d_x ~= 0 or d_y ~= 0 or false
- local usedsize, usedscaled
-
- if elayered then
- -- we're now at the outer level again so we need to scale
- -- back to the outer level values
- t[#t+1] = formatters["\\svgsetlayer{%0N}{%0N}{"](ax,-ay)
- usedsize = v_size or defaultsize
- usedscale = usedsize / defaultsize
- else
- -- we're nested so we can be scaled
- usedsize = v_size or size
- usedscale = (usedsize / defaultsize) / scale
- end
-usedscale = (10 / bodyfontscale) * usedscale
+ local usedsize = v_size or defaultsize
+ local usedscale = usedsize / defaultsize
--
- if eplaced then
-if dx then
- if not find(dx,"%a") then
- dx = dx .. "bp"
- elseif find(dx,"e") then
- dx = formatters["%s\\dimexpr %s\\relax"](usedscale,dx)
- end
-else
- dx = "0pt"
-end
-if dy then
- if not find(dy,"%a") then
- dy = dy .. "bp"
- elseif find(dy,"e") then
- dy = formatters["%s\\dimexpr %s\\relax"](usedscale,dy)
- end
-else
- dy = "0pt"
-end
- t[#t+1] = f_placed(dx,dy)
- end
- --
--- if usedscale == 1 then
--- t[#t+1] = f_normal( v_family,v_weight,v_style)
--- else
- t[#t+1] = f_scaled(usedscale,v_family,v_weight,v_style)
+-- local useddelta = d_x ~= 0 or d_y ~= 0 or false
+-- if useddelta then
+-- dx = validdelta(usedscale,dx)
+-- dy = validdelta(usedscale,dy)
-- end
+ --
+ t[#t+1] = f_scaled(usedscale,v_family,v_weight,v_style)
t[#t+1] = "{"
--
if trace_fonts then
+ -- we can hash and keep it when no change
report("element : %s",c.tg)
report(" font family : %s",v_family)
report(" font weight : %s",v_weight)
report(" font style : %s",v_style)
report(" parent size : %s",size)
- report(" parent scale : %s",scale)
- report(" used size : %s",usedsize)
- report(" used scale : %s",usedscale)
- report(" layered : %l",elayered)
+ -- report(" parent scale : %s",scale)
+ report(" used size : %s",v_size or defaultsize)
end
--
local ecolored = v_fill and v_fill ~= "" or false
@@ -2721,14 +2758,23 @@ end
end
end
--
- local dt = c.dt
- local nt = #dt
for i=1,nt do
local di = dt[i]
if type(di) == "table" then
- -- can be a tspan (should we pass dx too)
- collect(t,di,x,y,usedsize,usedscale,v_family)
+ -- when x or y then absolute else inline
+ if #di.dt > 0 then
+ t[#t+1] = f_setlayer(ax,ay)
+ t[#t+1] = "{"
+ local ok = collect(tg,t,di,x,y,usedsize,usedscale,v_family)
+ if not ok then
+ t[#t] = nil
+ t[#t] = nil
+ else
+ t[#t+1] = "}"
+ end
+ end
else
+ -- check for preserve
if i == 1 then
di = gsub(di,"^%s+","")
end
@@ -2737,14 +2783,25 @@ end
end
local chars = utfsplit(di)
if svghash then
+ -- dx dy
di = f_hashed(svghash[di])
- elseif tx then
+ elseif tx or ty or tdx or tdy then
+ local txi, tyi, tdxi, tdyi
for i=1,#chars do
- chars[i] = f_poschar(
- (tx[i] or 0) - x,
- (ty[i] or 0) - y,
- utfbyte(chars[i])
- )
+ txi = tx and (tx [i] or txi )
+ tyi = ty and (ty [i] or tyi )
+ tdxi = tdx and (tdx[i] or tdxi) or 0
+ tdyi = tdy and (tdy[i] or tdyi) or 0
+ local dx = (txi and (txi - x) or 0) + tdxi
+ local dy = (tyi and (tyi - y) or 0) + tdyi
+ local ci = chars[i]
+ if ci == " " then
+ chars[i] = f_posspace(dx, dy)
+ elseif sensitive[ci] then
+ chars[i] = f_poscode(dx, dy, utfbyte(ci))
+ else
+ chars[i] = f_poschar(dx, dy, ci)
+ end
end
di = "{" .. concat(chars) .. "}"
else
@@ -2753,7 +2810,14 @@ end
-- and don't know what we can expect here
-- di = lpegmatch(p_texescape,di) or di
for i=1,#chars do
- chars[i] = f_char(utfbyte(chars[i]))
+ local ci = chars[i]
+ if ci == " " then
+ chars[i] = s_space
+ elseif sensitive[ci] then
+ chars[i] = f_code(utfbyte(chars[i]))
+ else
+ chars[i] = f_char(ci)
+ end
end
di = concat(chars)
end
@@ -2767,87 +2831,89 @@ end
--
t[#t+1] = "}"
--
- if eplaced then
- t[#t+1] = "}"
- end
- if elayered then
- t[#t+1] = "}"
- end
- --
return t
end
- local s_startlayer = "\\svgstartlayer "
- local s_stoplayer = "\\svgstoplayer "
+ -- case 1: just text, maybe with spans
+ -- case 2: only positioned spans
+ -- case 3: just text, seen as label
+
+ local textlevel = 0
function handlers.text(c)
+ textlevel = textlevel + 1
+ -- analyze
local only = fullstrip(xmltextonly(c))
- -- if metapost.processing() then
- local at = c.at
- local x = rawget(at,"x")
- local y = rawget(at,"y")
+ local at = c.at
+ local x = rawget(at,"x")
+ local y = rawget(at,"y")
--- local dx = rawget(at,"dx")
--- local dy = rawget(at,"dy")
+ local dx = rawget(at,"dx")
+ local dy = rawget(at,"dy")
- local tx = asnumber_vx_t(x)
- local ty = asnumber_vy_t(y)
+ local tx = asnumber_vx_t(x)
+ local ty = asnumber_vy_t(y)
--- dx = dx and asnumber_vx(dx) or 0
--- dy = dy and asnumber_vy(dy) or 0
+ local tdx = asnumber_vx_t(dx)
+ local tdy = asnumber_vy_t(dy)
- x = tx[1] or 0 -- catch bad x/y spec
- y = ty[1] or 0 -- catch bad x/y spec
+ x = tx[1] or 0 -- catch bad x/y spec
+ y = ty[1] or 0 -- catch bad x/y spec
- local v_fill = at["fill"]
- if not v_fill or v_fill == "none" then
- v_fill = "black"
+ dx = tdx[1] or 0 -- catch bad x/y spec
+ dy = tdy[1] or 0 -- catch bad x/y spec
+
+ local v_fill = at["fill"]
+ if not v_fill or v_fill == "none" then
+ v_fill = "black"
+ end
+ local color, opacity, invisible = fillproperties(v_fill,at)
+ local anchor = anchors[at["text-anchor"] or "start"] or "drt"
+ local remap = metapost.remappedtext(only)
+ -- x = x + dx
+ -- y = y + dy
+ if remap then
+ if x == 0 and y == 0 then
+ only = f_mapped_simple_svg(remap.index)
+ else
+ only = f_mapped_normal_svg(remap.index,x,y)
end
- local color, opacity, invisible = fillproperties(v_fill,at)
- local anchor = anchors[at["text-anchor"] or "start"] or "drt"
- local r = metapost.remappedtext(only)
--- x = x + dx
--- y = y + dy
- if r then
- if x == 0 and y == 0 then
- only = f_mapped_simple_svg(r.index)
- else
- only = f_mapped_normal_svg(r.index,x,y)
- end
- flushobject(only,at,color,opacity)
- if trace_text then
- report("text: %s",only)
- end
- elseif not invisible then -- can be an option
- local scale = 1
- local textid = 0
- local result = { }
- local nx = #tx
- local ny = #ty
- --
- result[#result+1] = s_startlayer
- if nx > 1 or ny > 1 then
- concat(collect(result,c,x,y,defaultsize,1,"serif",tx,ty))
- else
- concat(collect(result,c,x,y,defaultsize,1,"serif"))
- end
- result[#result+1] = s_stoplayer
- result = concat(result)
- if x == 0 and y == 0 then
- result = f_text_simple_svg(anchor,result)
- else
- result = f_text_normal_svg(anchor,result,x,y)
- end
- flushobject(result,at,color,opacity)
- if trace_text then
- report("text: %s",result)
- end
- elseif trace_text then
- report("invisible text: %s",only)
+ flushobject(only,at,color,opacity)
+ if trace_text then
+ report("text: %s",only)
+ end
+ elseif not invisible then -- can be an option
+ local scale = 1
+ local textid = 0
+ local result = { }
+ local nx = #tx
+ local ny = #ty
+ local ndx = #tdx
+ local ndy = #tdy
+ --
+ local t = { }
+ t[#t+1] = s_startlayer
+ if nx > 1 or ny > 1 or ndx > 1 or ndy > 1 then
+ collect(tg,t,c,x,y,defaultsize,1,"serif",tx,ty,tdx,tdy)
+ else
+ collect(tg,t,c,x,y,defaultsize,1,"serif")
+ end
+ t[#t+1] = s_stoplayer
+ t = concat(t)
+ if x == 0 and y == 0 then
+ t = f_text_simple_svg(anchor,t)
+ else -- dx dy
+ t = f_text_normal_svg(anchor,t,x,y)
+ end
+ flushobject(t,at,color,opacity)
+ if trace_text then
+ report("text: %s",result)
end
- -- elseif trace_text then
- -- report("ignored text: %s",only)
- -- end
+ elseif trace_text then
+ report("invisible text: %s",only)
+ end
+ --
+ textlevel = textlevel - 1
end
function metapost.reportsvgfonts()
@@ -2892,7 +2958,7 @@ end
local btransform, etransform, transform = handletransform(at)
-bodyfontscale = tex.getdimen("bodyfontsize") / 65536
+ -- bodyfontscale = tex.getdimen("bodyfontsize") / 65536
if trace then
report("view: %s, xpct %N, ypct %N","before",percentage_x,percentage_y)
diff --git a/tex/context/base/mkxl/node-ini.lmt b/tex/context/base/mkxl/node-ini.lmt
index 4ba4b4000..f29a2e448 100644
--- a/tex/context/base/mkxl/node-ini.lmt
+++ b/tex/context/base/mkxl/node-ini.lmt
@@ -198,3 +198,14 @@ end
for i=0,#gluecodes do
texsetintegervalue(gluecodes[i] .. "subtypecode",i,"immutable")
end
+
+nodes.specialskipcodes = {
+ [gluecodes.leftskip] = true,
+ [gluecodes.rightskip] = true,
+ [gluecodes.lefthangskip] = true,
+ [gluecodes.righthangskip] = true,
+ [gluecodes.parfillleftskip or parfillskip_code] = true,
+ [gluecodes.parfillrightskip or parfillskip_code] = true,
+ [gluecodes.indentskip] = true,
+ [gluecodes.correctionskip] = true,
+}
diff --git a/tex/context/base/mkxl/pack-mrl.mkxl b/tex/context/base/mkxl/pack-mrl.mkxl
index 8bbeeb798..0e7540921 100644
--- a/tex/context/base/mkxl/pack-mrl.mkxl
+++ b/tex/context/base/mkxl/pack-mrl.mkxl
@@ -257,10 +257,10 @@
\c!background=,
\c!rulethickness=\linewidth]
-\letvalue{\??thinrulealternatives\v!a }\zerocount
-\letvalue{\??thinrulealternatives\v!b }\plusone
-\letvalue{\??thinrulealternatives\v!c }\plustwo
-\letvalue{\??thinrulealternatives\v!none}\zerocount
+\letcsname\??thinrulealternatives\v!a \endcsname\zerocount
+\letcsname\??thinrulealternatives\v!b \endcsname\plusone
+\letcsname\??thinrulealternatives\v!c \endcsname\plustwo
+\letcsname\??thinrulealternatives\v!none\endcsname\zerocount
\newconstant\c_pack_thinrules_type
@@ -562,7 +562,7 @@
%D
%D \typebuffer \start \getbuffer \stop
-\setvalue{\??textrulealternatives\v!top}#1%
+\defcsname\??textrulealternatives\v!top\endcsname#1%
{\page[\v!preference] % interferes
\directtextrulesparameter\c!before\relax
\blank[\v!samepage,\v!nowhite]%
@@ -571,14 +571,14 @@
\directtextrulesparameter\c!inbetween\relax
\endgraf}
-\setvalue{\??textrulealternatives\v!bottom}#1%
+\defcsname\??textrulealternatives\v!bottom\endcsname#1%
{\blank[\v!samepage,\v!nowhite]%
\pack_textrule_following{#1}%
\blank[\v!samepage,\v!nowhite]%
\directtextrulesparameter\c!after\relax
\page[\v!preference]}
-\setvalue{\??textrulealternatives\v!middle}#1%
+\defcsname\??textrulealternatives\v!middle\endcsname#1%
{\blank[\v!samepage,\v!nowhite]%
\directtextrulesparameter\c!inbetween\relax
\pack_textrule_following{#1}%
@@ -697,6 +697,8 @@
%D
%D \showsetup{fillinrules}
%D \showsetup{setupfillinrules}
+%D
+%D I NEED TO UPGRADE THIS!
\installcorenamespace{fillinrules}
diff --git a/tex/context/base/mkxl/page-app.mkxl b/tex/context/base/mkxl/page-app.mkxl
index d75366cca..d41487640 100644
--- a/tex/context/base/mkxl/page-app.mkxl
+++ b/tex/context/base/mkxl/page-app.mkxl
@@ -123,7 +123,7 @@
\setupfittingpage
[%\c!scale=1000,
%\c!pagestate=,
- \c!strut=\v!no,
+ \c!strut=\v!none, % was no, but we get a noindent then (with the danger of a lineskip)
\c!align=\v!normal,
\c!offset=\v!overlay,
\c!width=\v!fit,
diff --git a/tex/context/base/mkxl/strc-not.mklx b/tex/context/base/mkxl/strc-not.mklx
index 5ac571374..dd22bc6df 100644
--- a/tex/context/base/mkxl/strc-not.mklx
+++ b/tex/context/base/mkxl/strc-not.mklx
@@ -139,15 +139,15 @@
\protected\def\strc_define_commands_notation#tag#level#parent%
{\doifelsenothing{#parent}
{\normalexpanded{\defineconstruction[#tag][\s!handler=\v!notation,\c!level=#level]}%
- \setevalue{\??notation#tag:\s!parent}{\??notation}}%
+ \edefcsname\??notation#tag:\s!parent\endcsname{\??notation}}%
{\normalexpanded{\defineconstruction[#tag][#parent][\s!handler=\v!notation,\c!level=#level]}%
- \setevalue{\??note #tag:\s!parent}{\??note#parent}% see later for \s!note
- \setevalue{\??notation#tag:\s!parent}{\??notation#parent}}%
- \instance\setuevalue{\e!next #tag}{\strc_notations_next {#tag}{\number#level}}% obsolete
- \instance\setuevalue{\c!reset#tag}{\strc_notations_reset {#tag}{\number#level}}% obsolete
- \instance\setuevalue {#tag}{\strc_notations_command[#tag]}%
- \instance\setuevalue{\e!start#tag}{\strc_notations_start [#tag]}%
- \instance\setuevalue{\e!stop #tag}{\strc_notations_stop }}
+ \edefcsname\??note #tag:\s!parent\endcsname{\??note#parent}% see later for \s!note
+ \edefcsname\??notation#tag:\s!parent\endcsname{\??notation#parent}}%
+ \instance\protected\edefcsname\e!next #tag\endcsname{\strc_notations_next {#tag}{\number#level}}% obsolete
+ \instance\protected\edefcsname\c!reset#tag\endcsname{\strc_notations_reset {#tag}{\number#level}}% obsolete
+ \instance\protected\edefcsname #tag\endcsname{\strc_notations_command[#tag]}%
+ \instance\protected\edefcsname\e!start#tag\endcsname{\strc_notations_start [#tag]}%
+ \instance\protected\edefcsname\e!stop #tag\endcsname{\strc_notations_stop }}
\let\m_strc_notation_sub\empty
@@ -323,10 +323,10 @@
%D indirectness. This way notations don't bark on undefined macros when used in
%D combination.
-\protected\setvalue{\??constructionnotehandler\v!notation}%
+\protected\defcsname\??constructionnotehandler\v!notation\endcsname
{\csname\??constructionnotehandler\currentconstructionhandler:\constructionparameter\c!type\endcsname}
-\protected\setvalue{\??constructionnotehandler\v!notation:}% empty case
+\protected\defcsname\??constructionnotehandler\v!notation:\endcsname% empty case
{[\currentconstructionhandler:\currentconstruction]}
%D Here is a simple renderer for notes
@@ -445,7 +445,7 @@
\letcsname\??constructioncommandhandler\v!notation\expandafter\endcsname\csname\??constructioncommandhandler\v!enumeration \endcsname
\letcsname\??constructiontexthandler \v!notation\expandafter\endcsname\csname\??constructiontexthandler \v!enumeration \endcsname
-\protected\setvalue{\??constructionmainhandler\v!notation}#following%
+\protected\defcsname\??constructionmainhandler\v!notation\endcsname#following%
{\iftrialtypesetting \else
\begingroup
\currentconstructionsynchronize
@@ -454,7 +454,7 @@
\endgroup
\fi#following}
-\protected\setvalue{\??constructionnotehandler\v!notation:\v!note}% in the running text
+\protected\defcsname\??constructionnotehandler\v!notation:\v!note\endcsname % in the running text
{\ifnotesenabled
% do be done elsewhere
%
@@ -572,11 +572,11 @@
\edef\strc_notes_get_reference_attribute_symbol{attr\referenceattribute\currentreferenceattribute}%
\let\strc_notes_set_style_color_inline\strc_notes_set_style_color_inline_yes}
-\letvalue{\??noteinteractioninline\v!no }\strc_notes_prepare_inline_references_nop
-\letvalue{\??noteinteractioninline\v!all }\strc_notes_prepare_inline_references_yes
-\letvalue{\??noteinteractioninline\v!number}\strc_notes_prepare_inline_references_yes
-\letvalue{\??noteinteractioninline\v!text }\strc_notes_prepare_inline_references_yes
-\letvalue{\??noteinteractioninline\v!yes }\strc_notes_prepare_inline_references_yes
+\letcsname\??noteinteractioninline\v!no \endcsname\strc_notes_prepare_inline_references_nop
+\letcsname\??noteinteractioninline\v!all \endcsname\strc_notes_prepare_inline_references_yes
+\letcsname\??noteinteractioninline\v!number\endcsname\strc_notes_prepare_inline_references_yes
+\letcsname\??noteinteractioninline\v!text \endcsname\strc_notes_prepare_inline_references_yes
+\letcsname\??noteinteractioninline\v!yes \endcsname\strc_notes_prepare_inline_references_yes
% display (for 'all' we need unique text and number attributes so we resolve twice
% as we otherwise don't get the number one which is lapped in the margin so we need
@@ -622,11 +622,11 @@
\let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes
\fi}
-\letvalue{\??noteinteractiondisplay\v!no }\strc_notes_prepare_display_references_nop
-\letvalue{\??noteinteractiondisplay\v!all }\strc_notes_prepare_display_references_yes_all
-\letvalue{\??noteinteractiondisplay\v!number}\strc_notes_prepare_display_references_yes_number
-\letvalue{\??noteinteractiondisplay\v!text }\strc_notes_prepare_display_references_yes_text
-\letvalue{\??noteinteractiondisplay\v!yes }\strc_notes_prepare_display_references_yes_number
+\letcsname\??noteinteractiondisplay\v!no \endcsname\strc_notes_prepare_display_references_nop
+\letcsname\??noteinteractiondisplay\v!all \endcsname\strc_notes_prepare_display_references_yes_all
+\letcsname\??noteinteractiondisplay\v!number\endcsname\strc_notes_prepare_display_references_yes_number
+\letcsname\??noteinteractiondisplay\v!text \endcsname\strc_notes_prepare_display_references_yes_text
+\letcsname\??noteinteractiondisplay\v!yes \endcsname\strc_notes_prepare_display_references_yes_number
\mutable\let\strc_notes_set_style_color_inline_nop \usenotestyleandcolor
\mutable\let\strc_notes_set_style_color_display_nop\usenotationstyleandcolor
@@ -647,7 +647,7 @@
\setlocationcolorspecified\scratchcounter
\fi}
-\setvalue{\??constructiontexthandler\v!notation}%
+\defcsname\??constructiontexthandler\v!notation\endcsname
{\begingroup
% we need to retrigger the reference as otherwise it gets lost because we don't do nested
% references with the same id ... maybe some day if we can figure out a nice heuristic ...
@@ -698,8 +698,7 @@
\fi
\nobreak
\begingroup
- \strc_notes_interaction_check_inline
- \strc_notes_set_style_color_inline\c!textstyle\c!textcolor
+ \strc_notes_interaction_check_inline\strc_notes_set_style_color_inline\c!textstyle\c!textcolor
\hbox \strc_notes_get_reference_attribute_symbol \strc_notes_get_destination_attribute_symbol \bgroup
% \hbox \strc_notes_get_reference_attribute_symbol \bgroup \strc_notes_destination_hack
\strc_references_flush_destination_nodes % a bit late but ok
@@ -732,8 +731,7 @@
% skip or kern
\nobreak
\hbox\bgroup
- \strc_notes_interaction_check_inline
- \strc_notes_set_style_color_inline\c!textstyle\c!textcolor
+ \usenotestyleandcolor\c!textstyle\c!textcolor
\noteparameter\c!textcommand{\p_textseparator}%
\kern\noteparameter\c!distance
\egroup
@@ -885,16 +883,16 @@
\def\strc_notes_set_rule_autodir
{\doifelserighttoleftinbox\currentnoteinsertionnumber\righttoleft\lefttoright}
-\setvalue{\??noterule \v!command}{\letcurrentnoterulecommand\currentnoterulecommandcommand}
-\setvalue{\??noterule \v!on}{\letcurrentnoterulecommand\currentnoterulecommandnormal}
-\setvalue{\??noterule \v!normal}{\letcurrentnoterulecommand\currentnoterulecommandnormal}
-\setvalue{\??noterule \v!left}{\letcurrentnoterulecommand\currentnoterulecommandnormal
- \letcurrentnoterulealign \lefttoright}
-\setvalue{\??noterule \v!right}{\letcurrentnoterulecommand\currentnoterulecommandnormal
- \letcurrentnoterulealign \righttoleft}
-\setvalue{\??noterule\v!paragraph}{\letcurrentnoterulecommand\currentnoterulecommandnormal
- \letcurrentnoterulealign \strc_notes_set_rule_autodir}
-\setvalue{\??noterule \v!off}{\letcurrentnoterulecommand\relax}
+\defcsname\??noterule \v!command\endcsname{\letcurrentnoterulecommand\currentnoterulecommandcommand}
+\defcsname\??noterule \v!on\endcsname{\letcurrentnoterulecommand\currentnoterulecommandnormal}
+\defcsname\??noterule \v!normal\endcsname{\letcurrentnoterulecommand\currentnoterulecommandnormal}
+\defcsname\??noterule \v!left\endcsname{\letcurrentnoterulecommand\currentnoterulecommandnormal
+ \letcurrentnoterulealign \lefttoright}
+\defcsname\??noterule \v!right\endcsname{\letcurrentnoterulecommand\currentnoterulecommandnormal
+ \letcurrentnoterulealign \righttoleft}
+\defcsname\??noterule\v!paragraph\endcsname{\letcurrentnoterulecommand\currentnoterulecommandnormal
+ \letcurrentnoterulealign \strc_notes_set_rule_autodir}
+\defcsname\??noterule \v!off\endcsname{\letcurrentnoterulecommand\relax}
\appendtoks
\strc_notes_set_rule
@@ -911,10 +909,10 @@
\setnewconstant\notepenaltystrict 9999
\setnewconstant\notepenaltyverystrict\maxdimen
-\letvalue{\??notepenalty\v!tolerant }\notepenaltytolerant
-\letvalue{\??notepenalty\v!strict }\notepenaltystrict
-\letvalue{\??notepenalty\v!verystrict}\notepenaltyverystrict
-\letvalue{\??notepenalty }\notepenaltytolerant
+\letcsname\??notepenalty\v!tolerant \endcsname\notepenaltytolerant
+\letcsname\??notepenalty\v!strict \endcsname\notepenaltystrict
+\letcsname\??notepenalty\v!verystrict\endcsname\notepenaltyverystrict
+\letcsname\??notepenalty \endcsname\notepenaltytolerant
%D The following switch can be used to disable limiting the height of the footnote
%D area, something that is needed in multi column balancing. Use this switch with
@@ -947,24 +945,24 @@
\protected\def\strc_notes_set_delayed_yes{\settrue \c_strc_notes_delayed}
\protected\def\strc_notes_set_delayed_nop{\setfalse\c_strc_notes_delayed}
-\setvalue{\??notelocation\v!page }{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_nop
- \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_page}
-\setvalue{\??notelocation\v!columns }{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_nop
- \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_columns}
-\setvalue{\??notelocation\v!lastcolumn }{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_nop
- \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_lastcolumn}
-\setvalue{\??notelocation\v!firstcolumn}{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_nop
- \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_firstcolumn}
-\setvalue{\??notelocation\v!none }{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_yes
- \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_none}
-\setvalue{\??notelocation\v!text }{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_yes
- \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_text}
-\setvalue{\??notelocation\v!high }{\letcsname\??notepositionvariant\currentnote\endcsname\strc_notes_set_position_high}
-\setvalue{\??notelocation\v!bottom }{\letcsname\??notepositionvariant\currentnote\endcsname\strc_notes_set_position_bottom}
-
-\setvalue{\??notedelayedvariant \??notedelayedvariant }{\strc_notes_set_delayed_nop} % not let
-\setvalue{\??notepositionvariant\??notepositionvariant}{\strc_notes_set_position_bottom} % not let
-\setvalue{\??notelocationvariant\??notelocationvariant}{\strc_notes_set_location_page} % not let
+\defcsname\??notelocation\v!page \endcsname{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_nop
+ \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_page}
+\defcsname\??notelocation\v!columns \endcsname{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_nop
+ \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_columns}
+\defcsname\??notelocation\v!lastcolumn \endcsname{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_nop
+ \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_lastcolumn}
+\defcsname\??notelocation\v!firstcolumn\endcsname{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_nop
+ \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_firstcolumn}
+\defcsname\??notelocation\v!none \endcsname{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_yes
+ \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_none}
+\defcsname\??notelocation\v!text \endcsname{\letcsname\??notedelayedvariant \currentnote\endcsname\strc_notes_set_delayed_yes
+ \letcsname\??notelocationvariant\currentnote\endcsname\strc_notes_set_location_text}
+\defcsname\??notelocation\v!high \endcsname{\letcsname\??notepositionvariant\currentnote\endcsname\strc_notes_set_position_high}
+\defcsname\??notelocation\v!bottom \endcsname{\letcsname\??notepositionvariant\currentnote\endcsname\strc_notes_set_position_bottom}
+
+\defcsname\??notedelayedvariant \??notedelayedvariant \endcsname{\strc_notes_set_delayed_nop} % not let
+\defcsname\??notepositionvariant\??notepositionvariant\endcsname{\strc_notes_set_position_bottom} % not let
+\defcsname\??notelocationvariant\??notelocationvariant\endcsname{\strc_notes_set_location_page} % not let
\protected\def\strc_notes_set_delayed
{\csname\??notedelayedvariant
@@ -1658,7 +1656,7 @@
\installcorenamespace{notealternative}
\permanent\protected\def\installnotealternative#alternative#command%
- {\setvalue{\??notealternative#alternative}{#command}}
+ {\defcsname\??notealternative#alternative\endcsname{#command}}
\permanent\protected\def\doifnotescollected#tag%
{\clf_doifnotecontent{#tag}}
@@ -1672,7 +1670,7 @@
\fi
\begingroup
\strc_notes_set_bodyfont
- \csname\??notealternative\noteparameter\c!alternative\endcsname
+ \begincsname\??notealternative\noteparameter\c!alternative\endcsname
\endgroup
\ifvmode
\noteparameter\c!after
diff --git a/tex/context/base/mkxl/supp-box.mkxl b/tex/context/base/mkxl/supp-box.mkxl
index e52ea90b8..943415596 100644
--- a/tex/context/base/mkxl/supp-box.mkxl
+++ b/tex/context/base/mkxl/supp-box.mkxl
@@ -484,6 +484,9 @@
\enforced\let\\\endgraf
\dowithnextboxcs\syst_boxes_determine_noflines\vbox}
+\def\determinednoflines#1%
+ {\localcontrolled{\determinenoflines{#1}}\noflines}
+
%D \macros
%D {doiftextelse, doiftext}
%D
diff --git a/tex/context/base/mkxl/typo-hid.lmt b/tex/context/base/mkxl/typo-hid.lmt
new file mode 100644
index 000000000..9cc77ffac
--- /dev/null
+++ b/tex/context/base/mkxl/typo-hid.lmt
@@ -0,0 +1,74 @@
+if not modules then modules = { } end modules ['typo-krn'] = {
+ version = 1.001,
+ comment = "companion to typo-krn.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local a_hidecontent = attributes.system("hidecontent")
+local specialskips = nodes.specialskipcodes
+local glue_code = nodes.nodecodes.glue
+local nuts = nodes.nuts
+local getattr = nuts.getattr
+local getnext = nuts.getnext
+local setnext = nuts.setnext
+local getprev = nuts.getprev
+local setlist = nuts.setlist
+local setlink = nuts.setlink
+local nextnode = nuts.traversers.node
+local flushlist = nuts.flush_list
+local dimensions = nuts.rangedimensions
+local hpack = nuts.hpack
+local setwhd = nuts.setwhd
+local setattrlist = nuts.setattrlist
+local enableaction = nodes.tasks.enableaction
+
+function nodes.handlers.wipe(head,groupcode,line)
+ if getattr(line,a_hidecontent) then
+ flushlist(head)
+ setlist(line)
+ else
+ -- we have normalized lines so always some skip to start with
+ local b, e = nil, nil
+ local function wipe()
+ local h = hpack()
+ local n = getnext(e)
+ setwhd(h,dimensions(line,b,n))
+ setlink(getprev(b),h,n)
+ setattrlist(h,b)
+ setnext(b)
+ flushlist(b)
+ b = nil
+ e = nil
+ end
+ for n, id, subtype in nextnode, head do
+ if id == glue_code and specialskips[subtype] then
+ if b then
+ wipe()
+ end
+ elseif getattr(n,a_hidecontent) then
+ if not b then
+ b = n
+ end
+ e = n
+ elseif b then
+ wipe()
+ end
+ end
+ if b then
+ -- can't happen because we had a skip
+ wipe()
+ end
+ setlist(line,head)
+ end
+ return nil
+end
+
+interfaces.implement {
+ name = "enablehidecontent",
+ onlyonce = true,
+ actions = function()
+ enableaction("contributers","nodes.handlers.wipe")
+ end,
+}
diff --git a/tex/context/base/mkxl/typo-hid.mkxl b/tex/context/base/mkxl/typo-hid.mkxl
new file mode 100644
index 000000000..cf9759c85
--- /dev/null
+++ b/tex/context/base/mkxl/typo-hid.mkxl
@@ -0,0 +1,38 @@
+%D \module
+%D [ file=typo-krn,
+%D version=2021.03.15, % based on old code lying around
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Hiding,
+%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 Typesetting Macros / Hiding}
+
+\registerctxluafile{typo-hid}{autosuffix}
+
+\definesystemattribute[hidecontent][public]
+
+\unprotect
+
+\newcount\c_typo_hidden_level
+
+\permanent\protected\def\starthiddencontent
+ {\ifcase\c_typo_hidden_level
+ \clf_enablehidecontent
+ \let\clf_enablehidecontent\relax
+ \attribute\hidecontentattribute\plusone
+ \fi
+ \advance\c_typo_hidden_level\plusone}
+
+\permanent\protected\def\stophiddencontent
+ {\advance\c_typo_hidden_level\minusone
+ \ifcase\c_typo_hidden_level
+ \attribute\hidecontentattribute\attributeunsetvalue
+ \fi}
+
+\protect \endinput
diff --git a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv
index 01cbb869d..f839db298 100644
--- a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv
+++ b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv
@@ -21,9 +21,7 @@
%D around but I won't waste time on sorting out all the (changing) font hassles. Also,
%D the T1 fonts involved are unlikely to be available.
-\definefontfeature
- [mathcollapseitalics]
- [collapseitalics=yes]
+% \definefontfeature[mathextra][mathcollapseitalics]
\starttypescriptcollection[texgyre]
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index f23926727..b7ee64864 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-03-13 11:18
+-- merge date : 2021-03-17 17:43
do -- begin closure to overcome local limits and interference