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/char-def.lua8
-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/font-oup.lua4
-rw-r--r--tex/context/base/mkiv/lang-imp-simpleascii-data.lgzbin0 -> 554570 bytes
-rw-r--r--tex/context/base/mkiv/lang-imp-simpleascii.lua114
-rw-r--r--tex/context/base/mkiv/lang-rep.lua2
-rw-r--r--tex/context/base/mkiv/mult-low.lua10
-rw-r--r--tex/context/base/mkiv/mult-prm.lua23
-rw-r--r--tex/context/base/mkiv/publ-imp-apa.mkvi59
-rw-r--r--tex/context/base/mkiv/publ-ini.mkiv5
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin24652 -> 24659 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin271456 -> 270690 bytes
-rw-r--r--tex/context/base/mkiv/util-zip.lua55
-rw-r--r--tex/context/base/mkxl/buff-ini.lmt29
-rw-r--r--tex/context/base/mkxl/buff-ini.mkxl2
-rw-r--r--tex/context/base/mkxl/buff-ver.lmt970
-rw-r--r--tex/context/base/mkxl/buff-ver.mkxl3
-rw-r--r--tex/context/base/mkxl/chem-str.mkxl14
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl31
-rw-r--r--tex/context/base/mkxl/driv-shp.lmt2
-rw-r--r--tex/context/base/mkxl/file-job.mklx2
-rw-r--r--tex/context/base/mkxl/font-ctx.lmt13
-rw-r--r--tex/context/base/mkxl/font-dsp.lmt926
-rw-r--r--tex/context/base/mkxl/font-ini.mklx2
-rw-r--r--tex/context/base/mkxl/font-ogr.lmt7
-rw-r--r--tex/context/base/mkxl/lang-rep.lmt91
-rw-r--r--tex/context/base/mkxl/lang-rep.mkxl18
-rw-r--r--tex/context/base/mkxl/lang-tra.lmt5
-rw-r--r--tex/context/base/mkxl/lang-tra.mkxl174
-rw-r--r--tex/context/base/mkxl/math-acc.mklx18
-rw-r--r--tex/context/base/mkxl/math-act.lmt233
-rw-r--r--tex/context/base/mkxl/math-ali.mkxl357
-rw-r--r--tex/context/base/mkxl/math-frc.mkxl12
-rw-r--r--tex/context/base/mkxl/math-ini.mkxl41
-rw-r--r--tex/context/base/mkxl/math-map.lmt4
-rw-r--r--tex/context/base/mkxl/math-spa.lmt106
-rw-r--r--tex/context/base/mkxl/mult-aux.mkxl15
-rw-r--r--tex/context/base/mkxl/mult-sys.mkxl2
-rw-r--r--tex/context/base/mkxl/node-ini.lmt7
-rw-r--r--tex/context/base/mkxl/node-nut.lmt1
-rw-r--r--tex/context/base/mkxl/node-ref.lmt2
-rw-r--r--tex/context/base/mkxl/node-res.lmt12
-rw-r--r--tex/context/base/mkxl/pack-cut.mkxl17
-rw-r--r--tex/context/base/mkxl/pack-rul.mkxl10
-rw-r--r--tex/context/base/mkxl/page-com.mkxl18
-rw-r--r--tex/context/base/mkxl/page-imp.mkxl8
-rw-r--r--tex/context/base/mkxl/page-mix.mkxl12
-rw-r--r--tex/context/base/mkxl/page-mrk.mkxl8
-rw-r--r--tex/context/base/mkxl/page-pcl.mkxl2
-rw-r--r--tex/context/base/mkxl/publ-ini.mkxl6
-rw-r--r--tex/context/base/mkxl/spac-ali.mkxl47
-rw-r--r--tex/context/base/mkxl/spac-hor.mkxl2
-rw-r--r--tex/context/base/mkxl/spac-ver.mkxl8
-rw-r--r--tex/context/base/mkxl/strc-mat.mkxl366
-rw-r--r--tex/context/base/mkxl/strc-ref.lmt8
-rw-r--r--tex/context/base/mkxl/strc-sec.mkxl6
-rw-r--r--tex/context/base/mkxl/syst-con.lmt113
-rw-r--r--tex/context/base/mkxl/syst-con.mkxl15
-rw-r--r--tex/context/base/mkxl/syst-ini.mkxl8
-rw-r--r--tex/context/base/mkxl/tabl-ltb.mkxl4
-rw-r--r--tex/context/base/mkxl/tabl-ntb.mkxl6
-rw-r--r--tex/context/base/mkxl/toks-aux.lmt1
-rw-r--r--tex/context/base/mkxl/toks-ini.lmt2
-rw-r--r--tex/context/base/mkxl/toks-scn.lmt2
-rw-r--r--tex/context/base/mkxl/trac-tex.lmt113
-rw-r--r--tex/context/base/mkxl/trac-tex.mkxl39
-rw-r--r--tex/context/base/mkxl/trac-vis.lmt20
-rw-r--r--tex/context/base/mkxl/typo-brk.lmt4
-rw-r--r--tex/context/base/mkxl/typo-brk.mkxl10
-rw-r--r--tex/context/base/mkxl/typo-del.mkxl2
-rw-r--r--tex/context/base/mkxl/typo-itm.mkxl2
-rw-r--r--tex/context/base/mkxl/typo-mar.mkxl2
-rw-r--r--tex/context/fonts/mkiv/modern-math.lfg2
-rw-r--r--tex/context/fonts/mkiv/newcomputermodern-math.lfg2
-rw-r--r--tex/context/interface/mkiv/context-en.xml2
-rw-r--r--tex/context/interface/mkiv/i-align.xml2
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin848669 -> 848873 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin24624 -> 24428 bytes
-rw-r--r--tex/context/modules/mkxl/s-math-show.mkxl138
-rw-r--r--tex/context/modules/mkxl/s-text-tests.mkxl22
-rw-r--r--tex/context/modules/third/mtx-install-imp-modules.lua18
-rw-r--r--tex/context/sample/common/knuthmath.tex3
-rw-r--r--tex/context/sample/common/samples.tex7
-rw-r--r--tex/context/sample/math/math-knuth-dt.tex13
-rw-r--r--tex/context/sample/math/math-kontinuitet-sv.tex8
-rw-r--r--tex/context/sample/third/alfredsson-sv.tex6
-rw-r--r--tex/context/sample/third/falstaff-sv.tex5
-rw-r--r--tex/context/sample/third/lansburgh-letterspacing-sv.tex6
-rw-r--r--tex/context/sample/third/readme.txt23
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua6
94 files changed, 3226 insertions, 1287 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 3175dd98a..35e9fb615 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{2023.05.08 17:36}
+\newcontextversion{2023.05.27 12:11}
%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 ba1b29308..8737d7c70 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{2023.05.08 17:36}
+\edef\contextversion{2023.05.27 12:11}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua
index 1d4c130e9..de3ded98b 100644
--- a/tex/context/base/mkiv/char-def.lua
+++ b/tex/context/base/mkiv/char-def.lua
@@ -67014,7 +67014,7 @@ characters.data={
description="NABLA",
direction="on",
linebreak="ai",
- mathclass="ordinary",
+ mathclass="differential",
mathname="nabla",
synonyms={ "backward difference", "del" },
unicodeslot=0x2207,
@@ -234204,6 +234204,7 @@ characters.data={
description="MATHEMATICAL BOLD NABLA",
direction="l",
linebreak="al",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D6C1,
visual="bf",
@@ -234727,7 +234728,7 @@ characters.data={
description="MATHEMATICAL ITALIC NABLA",
direction="l",
linebreak="al",
- mathclass="ordinary",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D6FB,
visual="it",
@@ -235256,6 +235257,7 @@ characters.data={
description="MATHEMATICAL BOLD ITALIC NABLA",
direction="l",
linebreak="al",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D735,
visual="bi",
@@ -235779,6 +235781,7 @@ characters.data={
description="MATHEMATICAL SANS-SERIF BOLD NABLA",
direction="l",
linebreak="al",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D76F,
visual="bf",
@@ -236302,6 +236305,7 @@ characters.data={
description="MATHEMATICAL SANS-SERIF BOLD ITALIC NABLA",
direction="l",
linebreak="al",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D7A9,
visual="bi",
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index d262c380f..596dd0299 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{2023.05.08 17:36}
+\newcontextversion{2023.05.27 12:11}
%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 e6522ec5c..c5be65048 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -49,7 +49,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2023.05.08 17:36}
+\edef\contextversion{2023.05.27 12:11}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index 198e62bee..0d1f9d6a6 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -945,7 +945,9 @@ local function unifyglyphs(fontdata,usenames)
if colors then
for i=1,#colors do
local c = colors[i]
- c.slot = indices[c.slot]
+ if c then -- safeguard
+ c.slot = indices[c.slot]
+ end
end
end
end
diff --git a/tex/context/base/mkiv/lang-imp-simpleascii-data.lgz b/tex/context/base/mkiv/lang-imp-simpleascii-data.lgz
new file mode 100644
index 000000000..9bbcc6afc
--- /dev/null
+++ b/tex/context/base/mkiv/lang-imp-simpleascii-data.lgz
Binary files differ
diff --git a/tex/context/base/mkiv/lang-imp-simpleascii.lua b/tex/context/base/mkiv/lang-imp-simpleascii.lua
new file mode 100644
index 000000000..8fe664a27
--- /dev/null
+++ b/tex/context/base/mkiv/lang-imp-simpleascii.lua
@@ -0,0 +1,114 @@
+-- The data is taken from:
+--
+-- https://github.com/anyascii/anyascii/blob/master/table.tsv
+--
+-- by Hunter WB under the ISC License (2020-2023).
+--
+-- Updating:
+--
+-- -- copy table.tsv to lang-imp-simpleascii-data.tsv
+-- -- mtxrun --script lang-imp-simpleascii
+-- -- copy lang-imp-simpleascii-data.lgz over old file
+--
+-- Usage:
+--
+-- \usetransliteration[simpleascii]
+--
+-- \definetransliteration
+-- [simpleascii]
+-- [color=blue,
+-- vector={simple ascii}]
+--
+-- \settransliteration[simpleascii]
+--
+-- \starttext
+--
+-- \startchapter[title={深圳 ଗଜପତି Blöße}]
+-- 深圳 ଗଜପତି Blöße\par
+-- 深圳 ଗଜପତି Blöße\par
+-- 深圳 ଗଜପତି Blöße\par
+-- 深圳 ଗଜପତି Blöße\par
+-- \stopchapter
+--
+-- \stoptext
+
+local textfile = "lang-imp-simpleascii-data.tsv" -- a copy of table.tsv
+local datafile = "lang-imp-simpleascii-data.lua" -- for tracing
+local compfile = "lang-imp-simpleascii-data.lgz" -- idem in distribution
+
+local verbose = false -- when true, saved uncompressed file for tracing
+local report = logs.reporter("simpleascii")
+
+if not context and lfs.isfile(textfile) then
+
+ -- We save it in the local path so we need to move it explicitly into
+ -- the tree which prevents errors.
+
+ local data = io.loaddata(textfile)
+ if data and data ~= "" then
+ local mapping = { }
+ for k, v in string.gmatch(data,"(%S+)[\t]*([^\n\r]-)[\n\r]") do
+ if k ~= "" and v ~= "" and k ~= v then
+ mapping[k] = v
+ end
+ end
+ if verbose then
+ table.save(datafile,mapping)
+ else
+ mapping = gzip.compress(table.fastserialize(mapping)) -- zlib.compress(d,9)
+ datafile = compfile
+ io.savedata(compfile,mapping)
+ end
+ report("data from %a saved in %a",textfile,datafile)
+ else
+ report("no data file %a",textfile)
+ end
+
+else
+
+ local mapping = false
+
+ if not verbose then
+ mapping = io.loaddata(resolvers.findfile(compfile) or "")
+ if mapping then
+ mapping = table.deserialize(gzip.decompress(mapping)) -- zlib.decompress(d)
+ if mapping then
+ datafile = compfile
+ else
+ report("data file %a is corrupt",compfile)
+ end
+ end
+ end
+ if not mapping then
+ mapping = table.load(resolvers.findfile(datafile) or "")
+ end
+
+ if mapping then
+
+ report("data file %a loaded",datafile)
+
+ -- for i = 0, 127 do
+ -- mapping[utfchar(i)] = utfchar(i) -- not needed
+ -- end
+
+ return {
+
+ name = "simple ascii",
+ version = "1.00",
+ comment = "Unicode to ASCII transliteration",
+ author = "Jairo A. del Rio & Hans Hagen",
+ copyright = "ConTeXt development team & whoever made this list",
+
+ transliterations = {
+ ["simple ascii"] = {
+ mapping = mapping
+ },
+ }
+
+ }
+
+ else
+ report("no data file %a",datafile)
+ end
+
+end
diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua
index d2c47f5ba..a07524a93 100644
--- a/tex/context/base/mkiv/lang-rep.lua
+++ b/tex/context/base/mkiv/lang-rep.lua
@@ -266,7 +266,7 @@ local function replace(head,first,last,final,hasspace,overload)
current = getnext(current)
end
end
- current = getnext(final)
+ -- current = getnext(final) -- some left over? no next!
elseif oldlength < newlength then
for i=1,newlength-oldlength do
local n = copy_node(current)
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index a250fdefd..d57c686a2 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -193,7 +193,7 @@ return {
--
"Ux", "eUx",
--
- "parfillleftskip", "parfillrightskip",
+ -- "parfillleftskip", "parfillrightskip",
--
"startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode",
--
@@ -209,7 +209,7 @@ return {
"breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode",
"discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode",
--
- "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode",
+ "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "limitprevgrafnormalizeparcode",
--
"nopreslackclassoptioncode", "nopostslackclassoptioncode",
"lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode",
@@ -219,7 +219,7 @@ return {
"flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode",
"carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode",
"preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode",
- "operatoritaliccorrectionclassoptioncode",
+ "operatoritaliccorrectionclassoptioncode", "shortinlineclassoptioncode",
--
"noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode",
"noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode",
@@ -270,6 +270,8 @@ return {
--
"autorule",
--
+ "tobits", "tohexa",
+ --
"strippedcsname","checkedstrippedcsname",
--
"nofarguments",
@@ -281,7 +283,7 @@ return {
"sixthargumentfalse", "sixthargumenttrue",
"seventhargumentfalse", "seventhargumenttrue",
--
- "vkern", "hkern", "vpenalty", "hpenalty",
+ -- "vkern", "hkern", "vpenalty", "hpenalty", -- native in mkxl
--
"doglobal", "dodoglobal", "redoglobal", "resetglobal",
--
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 37779ec57..cf83244cf 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -249,6 +249,7 @@ return {
"adjustspacingshrink",
"adjustspacingstep",
"adjustspacingstretch",
+ "advanceby",
"afterassigned",
"aftergrouped",
"aliased",
@@ -320,10 +321,12 @@ return {
"dbox",
"defcsname",
"deferred",
+ "detokened",
"detokenized",
"dimensiondef",
"dimexpression",
"directlua",
+ "divideby",
"dpack",
"dsplit",
"edefcsname",
@@ -403,6 +406,7 @@ return {
"hmcode",
"holdingmigrations",
"hpack",
+ "hpenalty",
"hyphenationmin",
"hyphenationmode",
"ifabsdim",
@@ -429,6 +433,9 @@ return {
"ifhasxtoks",
"ifincsname",
"ifinsert",
+ "ifintervaldim",
+ "ifintervalfloat",
+ "ifintervalnum",
"ifmathparameter",
"ifmathstyle",
"ifnumexpression",
@@ -571,6 +578,7 @@ return {
"meaningles",
"meaningless",
"mugluespecdef",
+ "multiplyby",
"mutable",
"noaligned",
"noatomruling",
@@ -598,18 +606,24 @@ return {
"parametermark",
"parattribute",
"pardirection",
+ "parfillleftskip",
+ "parfillrightskip",
+ "parinitleftskip",
+ "parinitrightskip",
"permanent",
"pettymuskip",
"positdef",
"postexhyphenchar",
"posthyphenchar",
"postinlinepenalty",
+ "postshortinlinepenalty",
"prebinoppenalty",
"predisplaygapfactor",
"preexhyphenchar",
"prehyphenchar",
"preinlinepenalty",
"prerelpenalty",
+ "preshortinlinepenalty",
"protrudechars",
"protrusionboundary",
"pxdimen",
@@ -691,6 +705,7 @@ return {
"virtualhrule",
"virtualvrule",
"vpack",
+ "vpenalty",
"wordboundary",
"wrapuppar",
"xdefcsname",
@@ -829,7 +844,6 @@ return {
"accent",
"adjdemerits",
"advance",
- "advanceby",
"afterassignment",
"aftergroup",
"atop",
@@ -874,7 +888,6 @@ return {
"displaywidowpenalty",
"displaywidth",
"divide",
- "divideby",
"doublehyphendemerits",
"dp",
"dump",
@@ -923,6 +936,7 @@ return {
"hfill",
"hfilneg",
"hfuzz",
+ "hkern",
"holdinginserts",
"hrule",
"hsize",
@@ -1000,7 +1014,6 @@ return {
"moveright",
"mskip",
"multiply",
- "multiplyby",
"muskip",
"muskipdef",
"newlinechar",
@@ -1031,11 +1044,8 @@ return {
"pagestretch",
"pagetotal",
"par",
- "parfillleftskip",
"parfillskip",
"parindent",
- "parinitleftskip",
- "parinitrightskip",
"parshape",
"parskip",
"patterns",
@@ -1125,6 +1135,7 @@ return {
"vfill",
"vfilneg",
"vfuzz",
+ "vkern",
"vrule",
"vsize",
"vskip",
diff --git a/tex/context/base/mkiv/publ-imp-apa.mkvi b/tex/context/base/mkiv/publ-imp-apa.mkvi
index 65f33fa9f..bfbc97a57 100644
--- a/tex/context/base/mkiv/publ-imp-apa.mkvi
+++ b/tex/context/base/mkiv/publ-imp-apa.mkvi
@@ -941,8 +941,6 @@
\btxlabeltext{apa:Translator}
\btxrightparenthesis
}
- \btxperiod
- % TODO: this period may NOT be wanted, as in: Title (2nd ed.).
}
\stoptexdefinition
@@ -951,7 +949,7 @@
\resetmode{btx:apa:title-placed}
} {
\btxdoif {title} {
- \btxspace
+ \btxperiod
\texdefinition {btx:apa:title}
}
}
@@ -1087,7 +1085,6 @@
\btxrightparenthesis
}
% outside of interaction
- \btxperiod
\doif {\btxfoundname{author}} {title} {
\setmode{btx:apa:title-placed}
}
@@ -1095,6 +1092,7 @@
\starttexdefinition mutable protected btx:apa:editor-in
\btxdoif {booktitle} {
+ \btxperiod
\btxlabeltext{In}
\btxspace
\doifnot {\btxfoundname{author}} {editor} {
@@ -1104,7 +1102,6 @@
}
}
\texdefinition{btx:apa:composed-title}{booktitle}
- \btxperiod
}
\stoptexdefinition
@@ -1118,9 +1115,6 @@
}
\stoptexdefinition
-% TODO: The title is terminated with period. However,
-% we probably don't want this before the parenthesis.
-
\starttexdefinition mutable protected btx:apa:leftparenthesis-or-comma
\doifelsemode {btx:apa:editionset-is-empty} {
\btxleftparenthesis
@@ -1180,8 +1174,9 @@
\btxflush{pages}
}
\doifnotmode {btx:apa:editionset-is-empty} {
- \btxrightparenthesisperiod
+ \btxrightparenthesis
}
+ \btxperiod
\stoptexdefinition
\starttexdefinition mutable protected btx:apa:journal
@@ -1275,36 +1270,26 @@
\btxperiod
\stoptexdefinition
-\definebreakpoints[doi]
-\definebreakpoint [doi][:][nleft=3,type=1]
-\definebreakpoint [doi][/][nleft=3,type=1]
-\definebreakpoint [doi][-][nleft=3,type=1]
-\definebreakpoint [doi][.][nleft=3,type=1]
-
% use \btxentry here?
+\sethyphenatedurlafter{:./-_} % question of taste
+
\starttexdefinition mutable protected btx:apa:url
- \begingroup
- \setbreakpoints[doi]
- \texdefinition {btx:format:goto} {
- url(\btxflush{url})
- } {
- \hyphenatedurl{\btxflush{url}}
- }
- \endgroup
+ \texdefinition {btx:format:goto} {
+ url(\btxflush{url})
+ } {
+ \hyphenatedurl{\btxflush{url}}
+ }
\stoptexdefinition
% use \btxentry here?
\starttexdefinition mutable protected btx:apa:doi
- \begingroup
- \setbreakpoints[doi]
- \texdefinition {btx:format:goto} {
- url(http://dx.doi.org/\btxflush{doi})
- } {
- \hyphenatedurl{doi:\btxflush{doi}}
- }
- \endgroup
+ \texdefinition {btx:format:goto} {
+ url(http://dx.doi.org/\btxflush{doi})
+ } {
+ \hyphenatedurl{doi:\btxflush{doi}}
+ }
\stoptexdefinition
\starttexdefinition mutable protected btx:apa:note
@@ -1326,13 +1311,14 @@
\btxspace
\texdefinition{btx:apa:doi}
}
+ % should the following be hyperlinks? To where?
\btxdoif {issn} {
\btxspace
- issn\colon\btxflush{issn}
+ \hyphenatedurl{issn:\btxflush{issn}}
}
\btxdoif {isbn} {
\btxspace
- isbn\colon\btxflush{isbn}
+ \hyphenatedurl{isbn:\btxflush{isbn}}
}
\texdefinition{btx:apa:note}
\removeunwantedspaces
@@ -1342,7 +1328,7 @@
\btxdoif {type} {
\btxleftbracket
\btxflush{type}
- \btxrightbracketperiod
+ \btxrightbracket
}
\stoptexdefinition
@@ -1357,6 +1343,7 @@
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}
\texdefinition{btx:apa:type}
+ \btxperiod
\texdefinition{btx:apa:journal-volume-number-pages}
\texdefinition{btx:apa:url-doi-note}
\stopsetups
@@ -1394,6 +1381,7 @@
\startsetups btx:apa:list:standard
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}
+ \btxperiod
\texdefinition{btx:apa:url-doi-note}
\stopsetups
@@ -1636,10 +1624,10 @@
}
\doifnot {\btxfoundname{title}} {album} {
\btxdoif {album} {
+ \btxperiod
\btxlabeltext{In}
\btxspace
\btxflush{album}
- \btxperiod
}
}
\texdefinition{btx:apa:type}
@@ -1662,6 +1650,7 @@
\startsetups btx:apa:list:misc
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}
+ \btxperiod
\btxdoif {howpublished} {
\btxspace
\btxflush{howpublished}
diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv
index d75006b18..9410e007d 100644
--- a/tex/context/base/mkiv/publ-ini.mkiv
+++ b/tex/context/base/mkiv/publ-ini.mkiv
@@ -420,6 +420,7 @@
\unexpanded\def\btxcommabreak {\removeunwantedspaces,\hskip\zeropoint plus .5\emwidth\relax}
\unexpanded\def\btxcolon {\removeunwantedspaces:\space}
\unexpanded\def\btxsemicolon {\removeunwantedspaces;\space}
+\unexpanded\def\btxhyphen {\removeunwantedspaces-}
\unexpanded\def\btxlparent {\removeunwantedspaces\space(} % obsolete
\unexpanded\def\btxrparent {\removeunwantedspaces)\space} % obsolete
\unexpanded\def\btxleftparenthesis {\removeunwantedspaces\space(}
@@ -1995,9 +1996,9 @@
\c!otherstext={\btxspace et al.},
\c!separator:firstnames={\btxspace},
\c!separator:juniors={\btxspace},
- \c!separator:vons={\btxspace},
+ \c!separator:vons={\btxnobreakspace},
\c!separator:initials={\btxspace},
- \c!connector:initials={-},
+ \c!connector:initials={\btxhyphen},
\c!stopper:initials={.},
%\c!surnamesep={\btxcomma}, % is this used anywhere?
\c!separator:invertedinitials={\btxcomma},
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index dad92835c..dff0084d6 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 25fae18e2..3c16a859d 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/util-zip.lua b/tex/context/base/mkiv/util-zip.lua
index 84539492c..404b39713 100644
--- a/tex/context/base/mkiv/util-zip.lua
+++ b/tex/context/base/mkiv/util-zip.lua
@@ -619,11 +619,13 @@ if xzip then -- flate then do
end
end
- local function unzipdir(zipname,path,verbose)
+ local function unzipdir(zipname,path,verbose,collect,validate)
if type(zipname) == "table" then
- verbose = zipname.verbose
- path = zipname.path
- zipname = zipname.zipname
+ validate = zipname.validate
+ collect = zipname.collect
+ verbose = zipname.verbose
+ path = zipname.path
+ zipname = zipname.zipname
end
if not zipname or zipname == "" then
return
@@ -641,34 +643,49 @@ if xzip then -- flate then do
local done = 0
local steps = verbose == "steps"
local time = steps and osclock()
+ -- local skip = 0
+ if collect then
+ collect = { }
+ else
+ collect = false
+ end
for i=1,count do
local l = list[i]
local n = l.filename
- local d = unzipfile(z,n) -- true for check
- if d then
- local p = filejoin(path,n)
- if mkdirs(dirname(p)) then
- if steps then
- total = total + #d
- done = done + 1
- if done >= step then
- done = 0
- logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ if not validate or validate(n) then
+ local d = unzipfile(z,n) -- true for check
+ if d then
+ local p = filejoin(path,n)
+ if mkdirs(dirname(p)) then
+ if steps then
+ total = total + #d
+ done = done + 1
+ if done >= step then
+ done = 0
+ logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ end
+ elseif verbose then
+ logwriter(n)
+ end
+ savedata(p,d)
+ if collect then
+ collect[#collect+1] = p
end
- elseif verbose then
- logwriter(n)
end
- savedata(p,d)
+ else
+ logwriter(format("problem with file %s",n))
end
else
- logwriter(format("problem with file %s",n))
+ -- skip = skip + 1
end
end
if steps then
logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time))
end
closezipfile(z)
- return true
+ if collect then
+ return collect
+ end
else
closezipfile(z)
end
diff --git a/tex/context/base/mkxl/buff-ini.lmt b/tex/context/base/mkxl/buff-ini.lmt
index 9f5535638..39c7ee655 100644
--- a/tex/context/base/mkxl/buff-ini.lmt
+++ b/tex/context/base/mkxl/buff-ini.lmt
@@ -828,7 +828,7 @@ end
-- moved here:
-function buffers.samplefile(name)
+function buffers.samplefile(name,before,after,inbetween)
if not exists(name) then
assign(name,io.loaddata(resolvers.findfile(name)))
end
@@ -837,10 +837,37 @@ end
implement {
name = "samplefile", -- bad name, maybe rename to injectbuffercontent
+ public = true,
+ protected = true,
actions = buffers.samplefile,
arguments = "string"
}
+function buffers.splitsamplefile(name,before,after,inbetween)
+ local data = io.loaddata(resolvers.findfile(name)) or ""
+ local split = string.split(utilities.strings.striplines(data,"prune and collapse"),lpeg.patterns.whitespace^1)
+ local size = #split
+ local before = tonumber(before) or 1
+ local after = tonumber(after) or 1
+ if before + after < size then
+ table.move(split,size-after,size,before+1)
+ if inbetween and inbetween ~= "" then
+ split[before+1] = inbetween
+ end
+ data = concat(split, " ",1,before+after+1)
+ end
+ assign(name,data)
+ getbuffer(name)
+end
+
+implement {
+ name = "splitsamplefile", -- bad name, maybe rename to injectbuffercontent
+ public = true,
+ protected = true,
+ actions = buffers.splitsamplefile,
+ arguments = "4 strings",
+}
+
-- A somewhat strange place (for now) so the *.log definitions might move someplace
-- else (if useful at all).
diff --git a/tex/context/base/mkxl/buff-ini.mkxl b/tex/context/base/mkxl/buff-ini.mkxl
index 0bc4d665f..ce185d70f 100644
--- a/tex/context/base/mkxl/buff-ini.mkxl
+++ b/tex/context/base/mkxl/buff-ini.mkxl
@@ -96,7 +96,7 @@
% \expandafter\relax\string} % dirty trick
\scratchcounterone
% better than \string but still a dirty trick to avoid \par mess in blocks
- \expandafter\scratchcountertwo\detokenized}
+ \expandafter\scratchcountertwo\detokenized} % the bare token (so not \detokened !)
\protected\def\buff_stop#1%
{\endgroup % (3 & 4 & 5 & 6)
diff --git a/tex/context/base/mkxl/buff-ver.lmt b/tex/context/base/mkxl/buff-ver.lmt
new file mode 100644
index 000000000..25d92618e
--- /dev/null
+++ b/tex/context/base/mkxl/buff-ver.lmt
@@ -0,0 +1,970 @@
+if not modules then modules = { } end modules ['buff-ver'] = {
+ version = 1.001,
+ comment = "companion to buff-ver.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- The default visualizers have reserved names starting with buff-imp-*. Users are
+-- supposed to use different names for their own variants.
+--
+-- todo: skip=auto
+--
+-- todo: update to match context scite lexing
+
+local type, next, rawset, rawget, setmetatable, getmetatable, tonumber = type, next, rawset, rawget, setmetatable, getmetatable, tonumber
+local lower, upper,match, find, sub = string.lower, string.upper, string.match, string.find, string.sub
+local splitlines = string.splitlines
+local concat = table.concat
+local C, P, R, S, V, Carg, Cc, Cs = lpeg.C, lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.Carg, lpeg.Cc, lpeg.Cs
+local patterns, lpegmatch, is_lpeg = lpeg.patterns, lpeg.match, lpeg.is_lpeg
+
+local trace_visualize = false trackers.register("buffers.visualize", function(v) trace_visualize = v end)
+local report_visualizers = logs.reporter("buffers","visualizers")
+
+local allocate = utilities.storage.allocate
+
+visualizers = visualizers or { }
+local specifications = allocate()
+visualizers.specifications = specifications
+
+local context = context
+local commands = commands
+local implement = interfaces.implement
+
+local formatters = string.formatters
+
+local tabtospace = utilities.strings.tabtospace
+local variables = interfaces.variables
+local settings_to_array = utilities.parsers.settings_to_array
+local variables = interfaces.variables
+local findfile = resolvers.findfile
+local addsuffix = file.addsuffix
+
+local v_yes = variables.yes
+local v_no = variables.no
+local v_last = variables.last
+local v_all = variables.all
+local v_absolute = variables.absolute
+----- v_inline = variables.inline -- not !
+----- v_display = variables.display -- not !
+
+-- beware, all macros have an argument:
+
+local ctx_inlineverbatimnewline = context.doinlineverbatimnewline
+local ctx_inlineverbatimbeginline = context.doinlineverbatimbeginline
+local ctx_inlineverbatimemptyline = context.doinlineverbatimemptyline
+local ctx_inlineverbatimstart = context.doinlineverbatimstart
+local ctx_inlineverbatimstop = context.doinlineverbatimstop
+
+local ctx_displayverbatiminitialize = context.dodisplayverbatiminitialize -- the number of arguments might change over time
+local ctx_displayverbatimnewline = context.dodisplayverbatimnewline
+local ctx_displayverbatimbeginline = context.dodisplayverbatimbeginline
+local ctx_displayverbatimemptyline = context.dodisplayverbatimemptyline
+local ctx_displayverbatimstart = context.dodisplayverbatimstart
+local ctx_displayverbatimstop = context.dodisplayverbatimstop
+
+local ctx_verbatim = context.verbatim
+local ctx_verbatimspace = context.doverbatimspace
+
+local CargOne = Carg(1)
+
+local function f_emptyline(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimemptyline()
+ else
+ ctx_displayverbatimemptyline()
+ end
+end
+
+local function f_beginline(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimbeginline()
+ else
+ ctx_displayverbatimbeginline()
+ end
+end
+
+local function f_newline(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimnewline()
+ else
+ ctx_displayverbatimnewline()
+ end
+end
+
+local function f_start(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimstart()
+ else
+ ctx_displayverbatimstart()
+ end
+end
+
+local function f_stop(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimstop()
+ else
+ ctx_displayverbatimstop()
+ end
+end
+
+local function f_default(s) -- (s,settings)
+ ctx_verbatim(s)
+end
+
+local function f_space() -- (s,settings)
+ ctx_verbatimspace()
+end
+
+local function f_signal() -- (s,settings)
+ -- we use these for special purposes
+end
+
+local signal = "\000"
+
+visualizers.signal = signal
+visualizers.signalpattern = P(signal)
+
+local functions = {
+ __index = {
+ emptyline = f_emptyline,
+ newline = f_newline,
+ default = f_default,
+ beginline = f_beginline,
+ space = f_space,
+ start = f_start,
+ stop = f_stop,
+ signal = f_signal,
+ }
+}
+
+local handlers = { }
+
+function visualizers.newhandler(name,data)
+ local tname = type(name)
+ local tdata = type(data)
+ if tname == "table" then -- (data)
+ setmetatable(name,getmetatable(name) or functions)
+ return name
+ elseif tname == "string" then
+ if tdata == "string" then -- ("name","parent")
+ local result = { }
+ setmetatable(result,getmetatable(handlers[data]) or functions)
+ handlers[name] = result
+ return result
+ elseif tdata == "table" then -- ("name",data)
+ setmetatable(data,getmetatable(data) or functions)
+ handlers[name] = data
+ return data
+ else -- ("name")
+ local result = { }
+ setmetatable(result,functions)
+ handlers[name] = result
+ return result
+ end
+ else -- ()
+ local result = { }
+ setmetatable(result,functions)
+ return result
+ end
+end
+
+function visualizers.newgrammar(name,t)
+ name = lower(name)
+ t = t or { }
+ local g = visualizers.specifications[name]
+ g = g and g.grammar
+ if g then
+ if trace_visualize then
+ report_visualizers("cloning grammar %a",name)
+ end
+ for k,v in next, g do
+ if not t[k] then
+ t[k] = v
+ end
+ if is_lpeg(v) then
+ t[name..":"..k] = v
+ end
+ end
+ end
+ return t
+end
+
+local function getvisualizer(method,nature)
+ method = lower(method)
+ local m = specifications[method] or specifications.default
+ if nature then
+ if trace_visualize then
+ report_visualizers("getting visualizer %a with nature %a",method,nature)
+ end
+ return m and (m[nature] or m.parser) or nil
+ else
+ if trace_visualize then
+ report_visualizers("getting visualizer %a",method)
+ end
+ return m and m.parser or nil
+ end
+end
+
+local ctx_fallback = ctx_verbatim
+
+local function makepattern(visualizer,replacement,pattern)
+ if not pattern then
+ report_visualizers("error in visualizer %a",replacement)
+ return patterns.alwaystrue
+ else
+ if type(visualizer) == "table" and type(replacement) == "string" then
+ replacement = visualizer[replacement] or ctx_fallback
+ else
+ replacement = ctx_fallback
+ end
+ return (C(pattern) * CargOne) / replacement
+ end
+end
+
+local function makenested(handler,how,start,stop)
+ local b, e, f = P(start), P(stop), how
+ if type(how) == "string" then
+ f = function(s) getvisualizer(how,"direct")(s) end
+ end
+ return makepattern(handler,"name",b)
+ * ((1-e)^1/f)
+ * makepattern(handler,"name",e)
+end
+
+visualizers.pattern = makepattern
+visualizers.makepattern = makepattern
+visualizers.makenested = makenested
+
+function visualizers.load(name)
+ name = lower(name)
+ if rawget(specifications,name) == nil then
+ name = lower(name)
+ local impname = "buff-imp-"..name
+ local texname = findfile(addsuffix(impname,"mkiv"))
+ local luaname = findfile(addsuffix(impname,"lua"))
+ if texname == "" or luaname == "" then
+ -- assume a user specific file
+ luaname = findfile(addsuffix(name,"mkiv"))
+ texname = findfile(addsuffix(name,"lua"))
+ end
+ if texname == "" or luaname == "" then
+ if trace_visualize then
+ report_visualizers("unknown visualizer %a",name)
+ end
+ else
+ if trace_visualize then
+ report_visualizers("loading visualizer %a",name)
+ end
+ lua.registercode(luaname) -- only used here, end up in format
+ context.input(texname)
+ end
+ if rawget(specifications,name) == nil then
+ rawset(specifications,name,false)
+ end
+ end
+end
+
+function visualizers.register(name,specification)
+ name = lower(name)
+ if trace_visualize then
+ report_visualizers("registering visualizer %a",name)
+ end
+ specifications[name] = specification
+ local parser = specification.parser
+ local handler = specification.handler
+ local displayparser = specification.display or parser
+ local inlineparser = specification.inline or parser
+ local isparser = is_lpeg(parser)
+ local start, stop
+ if isparser then
+ start = makepattern(handler,"start",patterns.alwaysmatched)
+ stop = makepattern(handler,"stop", patterns.alwaysmatched)
+ end
+ if handler then
+ if isparser then
+ specification.display = function(content,settings)
+ if handler.startdisplay then handler.startdisplay(settings) end
+ lpegmatch(start * displayparser * stop,content,1,settings)
+ if handler.stopdisplay then handler.stopdisplay(settings) end
+ end
+ specification.inline = function(content,settings)
+ if handler.startinline then handler.startinline(settings) end
+ lpegmatch(start * inlineparser * stop,content,1,settings)
+ if handler.stopinline then handler.stopinline(settings) end
+ end
+ specification.direct = function(content,settings)
+ lpegmatch(parser,content,1,settings)
+ end
+ elseif parser then
+ specification.display = function(content,settings)
+ if handler.startdisplay then handler.startdisplay(settings) end
+ parser(content,settings)
+ if handler.stopdisplay then handler.stopdisplay(settings) end
+ end
+ specification.inline = function(content,settings)
+ if handler.startinline then handler.startinline(settings) end
+ parser(content,settings)
+ if handler.stopinline then handler.stopinline(settings) end
+ end
+ specification.direct = parser
+ end
+ elseif isparser then
+ specification.display = function(content,settings)
+ lpegmatch(start * displayparser * stop,content,1,settings)
+ end
+ specification.inline = function(content,settings)
+ lpegmatch(start * inlineparser * stop,content,1,settings)
+ end
+ specification.direct = function(content,settings)
+ lpegmatch(parser,content,1,settings)
+ end
+ elseif parser then
+ specification.display = parser
+ specification.inline = parser
+ specification.direct = parser
+ end
+ return specification
+end
+
+function visualizers.getspecification(name)
+ return specifications[lower(name)]
+end
+
+local escapepatterns = allocate()
+visualizers.escapepatterns = escapepatterns
+
+local function texmethod(s)
+ context.bgroup()
+ context(s)
+ context.egroup()
+end
+
+local function texcommand(s)
+ context[s]()
+end
+
+local function defaultmethod(s,settings)
+ lpegmatch(getvisualizer("default"),lower(s),1,settings)
+end
+
+-- we can consider using a nested instead
+
+local space_pattern = patterns.space^0
+local name_pattern = R("az","AZ")^1
+
+-- the hack is needed in order to retain newlines when an escape happens at the
+-- at the begin of a line; it also ensures proper line numbering; a bit messy
+
+local function hack(pattern)
+ return Cs(pattern * Cc(signal))
+end
+
+local split_processor = typesetters.processors.split
+local apply_processor = typesetters.processors.apply
+
+-- todo: { before = b, after = a, processor = p }, ...
+
+function visualizers.registerescapepattern(name,befores,afters,normalmethod,escapemethod,processors)
+ local escapepattern = escapepatterns[name]
+ if not escapepattern then
+ if type(befores) ~= "table" then befores = { befores } end
+ if type(afters) ~= "table" then afters = { afters } end
+ if type(processors) ~= "table" then processors = { processors } end
+ for i=1,#befores do
+ local before = befores[i]
+ local after = afters[i]
+ local processor = processors[i]
+ if trace_visualize then
+ report_visualizers("registering escape pattern, name %a, index %a, before %a, after %a, processor %a",
+ name,i,before,after,processor or "default")
+ end
+ before = P(before) * space_pattern
+ after = space_pattern * P(after)
+ local action
+ if processor then
+ action = function(s) apply_processor(processor,s) end
+ else
+ action = escapemethod or texmethod
+ end
+ local ep = (before / "") * ((1 - after)^0 / action) * (after / "")
+ if escapepattern then
+ escapepattern = escapepattern + ep
+ else
+ escapepattern = ep
+ end
+ end
+ escapepattern = (
+ escapepattern
+ + hack((1 - escapepattern)^1) / (normalmethod or defaultmethod)
+ )^0
+ escapepatterns[name] = escapepattern
+ end
+ return escapepattern
+end
+
+function visualizers.registerescapeline(name,befores,normalmethod,escapemethod,processors)
+ local escapepattern = escapepatterns[name]
+ if not escapepattern then
+ if type(befores) ~= "table" then befores = { befores } end
+ if type(processors) ~= "table" then processors = { processors } end
+ for i=1,#befores do
+ local before = befores[i]
+ local processor = processors[i]
+ if trace_visualize then
+ report_visualizers("registering escape line pattern, name %a, before %a, after <<newline>>",name,before)
+ end
+ before = P(before) * space_pattern
+ after = space_pattern * P("\n")
+ local action
+ if processor then
+ action = function(s) apply_processor(processor,s) end
+ else
+ action = escapemethod or texmethod
+ end
+ local ep = (before / "") * ((1 - after)^0 / action) * (space_pattern / "")
+ if escapepattern then
+ escapepattern = escapepattern + ep
+ else
+ escapepattern = ep
+ end
+ end
+ escapepattern = (
+ escapepattern
+ + hack((1 - escapepattern)^1) / (normalmethod or defaultmethod)
+ )^0
+ escapepatterns[name] = escapepattern
+ end
+ return escapepattern
+end
+
+function visualizers.registerescapecommand(name,token,normalmethod,escapecommand,processor)
+ local escapepattern = escapepatterns[name]
+ if not escapepattern then
+ if trace_visualize then
+ report_visualizers("registering escape token, name %a, token %a",name,token)
+ end
+ token = P(token)
+ local notoken = hack((1 - token)^1)
+ local cstoken = Cs(name_pattern * (space_pattern/""))
+ escapepattern = (
+ (token / "")
+ * (cstoken / (escapecommand or texcommand))
+ + (notoken / (normalmethod or defaultmethod))
+ )^0
+ escapepatterns[name] = escapepattern
+ end
+ return escapepattern
+end
+
+local escapedvisualizers = { }
+local f_escapedvisualizer = formatters["%s : %s"]
+
+local function visualize(content,settings) -- maybe also method in settings
+ if content and content ~= "" then
+ local method = lower(settings.method or "default")
+ local m = specifications[method] or specifications.default
+ local e = settings.escape
+ if e and e ~= "" and not m.handler.noescape then
+ local newname = f_escapedvisualizer(method,e)
+ local newspec = specifications[newname]
+ if newspec then
+ m = newspec
+ else
+ local starts, stops, processors = { }, { }, { }
+ if e == v_yes then
+ starts[1] = "/BTEX"
+ stops [1] = "/ETEX"
+ else
+ local s = settings_to_array(e,true)
+ for i=1,#s do
+ local si = s[i]
+ local processor, pattern = split_processor(si)
+ si = processor and pattern or si
+ local start, stop = match(si,"^(.-),(.-)$")
+ if start then
+ local n = #starts + 1
+ starts[n] = start
+ stops [n] = stop or ""
+ processors[n] = processor
+ end
+ end
+ end
+ local oldm = m
+ local oldparser = oldm.direct
+ local newhandler = oldm.handler
+ local newparser = oldm.parser -- nil
+ if starts[1] and stops[1] ~= "" then
+ newparser = visualizers.registerescapepattern(newname,starts,stops,oldparser,nil,processors)
+ elseif starts[1] then
+ newparser = visualizers.registerescapeline(newname,starts,oldparser,nil,processors)
+ else -- for old times sake: /em
+ newparser = visualizers.registerescapecommand(newname,e,oldparser,nil,processors)
+ end
+ m = visualizers.register(newname, {
+ parser = newparser,
+ handler = newhandler,
+ })
+ end
+ else
+ m = specifications[method] or specifications.default
+ end
+ local nature = settings.nature or "display"
+ local n = m and m[nature]
+ if n then
+ if trace_visualize then
+ report_visualizers("visualize using method %a and nature %a",method,nature)
+ end
+ n(content,settings)
+ else
+ if trace_visualize then
+ report_visualizers("visualize using method %a",method)
+ end
+ ctx_fallback(content,1,settings)
+ end
+ end
+end
+
+visualizers.visualize = visualize
+visualizers.getvisualizer = getvisualizer
+
+local fallbacks = { } table.setmetatableindex(fallbacks,function(t,k) local v = { nature = k } t[k] = v return v end)
+
+local function checkedsettings(settings,nature)
+ if not settings then
+ -- let's avoid dummy tables as much as possible
+ return fallbacks[nature]
+ else
+ if not settings.nature then
+ settings.nature = nature
+ end
+ return settings
+ end
+end
+
+function visualizers.visualizestring(content,settings)
+ visualize(content,checkedsettings(settings,"inline"))
+end
+
+function visualizers.visualizefile(name,settings)
+ visualize(resolvers.loadtexfile(name),checkedsettings(settings,"display"))
+end
+
+function visualizers.visualizebuffer(name,settings)
+ visualize(buffers.getcontent(name),checkedsettings(settings,"display"))
+end
+
+-- --
+
+local space = C(patterns.space) * CargOne / f_space
+local newline = C(patterns.newline) * CargOne / f_newline
+local emptyline = C(patterns.emptyline) * CargOne / f_emptyline
+local beginline = C(patterns.beginline) * CargOne / f_beginline
+local anything = C(patterns.somecontent) * CargOne / f_default
+
+----- verbosed = (space + newline * (emptyline^0) * beginline + anything)^0
+local verbosed = (space + newline * (emptyline^0) * beginline + newline * emptyline + newline + anything)^0
+
+local function write(s,settings) -- bad name
+ lpegmatch(verbosed,s,1,settings or false)
+end
+
+visualizers.write = write
+visualizers.writenewline = f_newline
+visualizers.writeemptyline = f_emptyline
+visualizers.writespace = f_space
+visualizers.writedefault = f_default
+
+function visualizers.writeargument(...)
+ context("{") -- If we didn't have tracing then we could
+ write(...) -- use a faster print to tex variant for the
+ context("}") -- { } tokens as they always have ctxcatcodes.
+end
+
+-- helpers
+
+local function realign(lines,strip) -- "yes", <number>
+ local n
+ if strip == v_yes then
+ n = 0xFFFF
+ for i=1, #lines do
+ local spaces = find(lines[i],"%S") -- can be lpeg
+ if not spaces then
+ -- empty line
+ elseif spaces == 0 then
+ n = 0
+ break
+ elseif spaces < n then
+ n = spaces
+ end
+ end
+ n = n - 1
+ else
+ n = tonumber(strip)
+ end
+ if n and n > 0 then
+ local copy = { }
+ for i=1,#lines do
+ copy[i] = sub(lines[i],n+1)
+ end
+ return copy
+ end
+ return lines
+end
+
+local onlyspaces = S(" \t\f\n\r")^0 * P(-1)
+
+local function getstrip(lines,first,last)
+ if not first then
+ first = 1
+ end
+ if not last then
+ last = #lines
+ end
+ for i=first,last do
+ local li = lines[i]
+ if #li == 0 or lpegmatch(onlyspaces,li) then
+ first = first + 1
+ else
+ break
+ end
+ end
+ for i=last,first,-1 do
+ local li = lines[i]
+ if #li == 0 or lpegmatch(onlyspaces,li) then
+ last = last - 1
+ else
+ break
+ end
+ end
+ return first, last, last - first + 1
+end
+
+-- we look for text (todo):
+--
+-- "foo" : start after line with "foo"
+-- "=" : ignore first blob
+-- "=foo" : start at "foo"
+-- "!foo" : maybe a not "foo"
+
+-- % - # lines start a comment
+
+local comment = "^[%%%-#]"
+
+local function getrange(lines,first,last,range) -- 1,3 1,+3 fromhere,tothere
+ local noflines = #lines
+ local first = first or 1
+ local last = last or noflines
+ if last < 0 then
+ last = noflines + last
+ end
+ local what = settings_to_array(range) -- maybe also n:m
+ local r_first = what[1]
+ local r_last = what[2]
+ local f = tonumber(r_first)
+ local l = tonumber(r_last)
+ if r_first then
+ if f then
+ if f > first then
+ first = f
+ end
+ elseif r_first == "=" then
+ for i=first,last do
+ if find(lines[i],comment) then
+ first = i + 1
+ else
+ break
+ end
+ end
+ elseif r_first ~= "" then
+ local exact, r_first = match(r_first,"^([=]?)(.*)")
+ for i=first,last do
+ if find(lines[i],r_first) then
+ if exact == "=" then
+ first = i
+ else
+ first = i + 1
+ end
+ break
+ else
+ first = i
+ end
+ end
+ end
+ end
+ if r_last then
+ if l then
+ if l < 0 then
+ l = noflines + l
+ end
+ if find(r_last,"^[%+]") then -- 1,+3
+ l = first + l
+ end
+ if l < last then
+ last = l
+ end
+ elseif r_first == "=" then
+ for i=first,last do
+ if find(lines[i],comment) then
+ break
+ else
+ last = i
+ end
+ end
+ elseif r_last ~= "" then
+ local exact, r_last = match(r_last,"^([=]?)(.*)")
+ for i=first,last do
+ if find(lines[i],r_last) then
+ if exact == "=" then
+ last = i
+ end
+ break
+ else
+ last = i
+ end
+ end
+ end
+ end
+ return first, last
+end
+
+local tablength = 7
+
+local function dotabs(content,settings)
+ local tab = settings.tab
+ tab = tab and (tab == v_yes and tablength or tonumber(tab))
+ if tab then
+ return tabtospace(content,tab)
+ else
+ return content
+ end
+end
+
+local function filter(lines,settings) -- todo: inline or display in settings
+ local strip = settings.strip
+ -- if strip and strip == "" then
+ if strip ~= v_no and strip ~= false then
+ lines = realign(lines,strip)
+ end
+ local line = 0
+ local n = 0
+ local range = settings.range
+ local first, last, m = getstrip(lines)
+ if range then
+ first, last = getrange(lines,first,last,range)
+ first, last = getstrip(lines,first,last)
+ end
+ -- \r is \endlinechar but \n would is more generic so this choice is debatable
+ local content = concat(lines,(settings.nature == "inline" and " ") or "\n",first,last)
+ return content, m
+end
+
+local getlines = buffers.getlines
+
+-- local decodecomment = resolvers.macros.decodecomment -- experiment
+
+local function typebuffer(settings)
+ local lines = getlines(settings.name)
+ if lines then
+ ctx_displayverbatiminitialize(#lines)
+ local content, m = filter(lines,settings)
+ if content and content ~= "" then
+ -- content = decodecomment(content)
+ content = dotabs(content,settings)
+ visualize(content,checkedsettings(settings,"display"))
+ end
+ end
+end
+
+local function processbuffer(settings)
+ local lines = getlines(settings.name)
+ if lines then
+ local content, m = filter(lines,settings)
+ if content and content ~= "" then
+ content = dotabs(content,settings)
+ visualize(content,checkedsettings(settings,"direct"))
+ end
+ end
+end
+
+-- not really buffers but it's closely related
+
+-- A string.gsub(str,"(\\.-) +$","%1") is faster than an lpeg when there is a
+-- match but slower when there is no match. But anyway, we need a more clever
+-- parser so we use lpeg.
+--
+-- [[\text ]] [[\text{}]] [[\foo\bar .tex]] [[\text \text ]] [[\text \\ \text ]]
+--
+-- needed in e.g. tabulate (manuals)
+
+local fences = S([[[{]])
+local symbols = S([[!#"$%&'*()+,-./:;<=>?@[]^_`{|}~0123456789]]) -- digits added but maybe split it
+local space = S([[ ]])
+local backslash = S([[\]])
+local nospace = space^1/""
+local endstring = P(-1)
+
+local compactors = {
+ [v_all] = Cs((backslash * (1-backslash-space)^1 * nospace * (endstring + fences + #backslash) + 1)^0),
+ [v_absolute] = Cs((backslash * (1-symbols -space)^1 * nospace * (symbols + backslash ) + 1)^0),
+ [v_last] = Cs((space^1 * endstring/"" + 1)^0),
+}
+
+local function typestring(settings)
+ local content = settings.data
+ if content and content ~= "" then
+ local compact = settings.compact
+ local compactor = compact and compactors[compact]
+ if compactor then
+ content = lpegmatch(compactor,content) or content
+ end
+ -- content = decodecomment(content)
+ -- content = dotabs(content,settings)
+ visualize(content,checkedsettings(settings,"inline"))
+ end
+end
+
+local function typefile(settings)
+ local filename = settings.name
+ local foundname = resolvers.findtexfile(filename)
+ if foundname and foundname ~= "" then
+ local str = resolvers.loadtexfile(foundname)
+ if str and str ~= "" then
+ local regime = settings.regime
+ if regime and regime ~= "" then
+ str = regimes.translate(str,regime)
+ end
+ if str and str~= "" then
+ -- content = decodecomment(content)
+ local lines = splitlines(str)
+ local content, m = filter(lines,settings)
+ if content and content ~= "" then
+ content = dotabs(content,settings)
+ visualize(content,checkedsettings(settings,"display"))
+ end
+ end
+ end
+ end
+end
+
+implement {
+ name = "type",
+ actions = typestring,
+ arguments = {
+ {
+ { "data" },
+-- { "data", "detokened" },
+ { "tab" },
+ { "method" },
+ { "compact" },
+ { "nature" },
+ { "escape" },
+ }
+ }
+}
+
+-- implement {
+-- name = "type_x",
+-- actions = typestring,
+-- arguments = {
+-- {
+-- { "data", "verbatim" },
+-- { "tab" },
+-- { "method" },
+-- { "compact" },
+-- { "nature" },
+-- { "escape" },
+-- }
+-- }
+-- }
+
+-- local function typestring_y(settings)
+-- local content = tex.toks[settings.n]
+-- if content and content ~= "" then
+-- local compact = settings.compact
+-- local compactor = compact and compactors[compact]
+-- if compactor then
+-- content = lpegmatch(compactor,content)
+-- end
+-- -- content = decodecomment(content)
+-- -- content = dotabs(content,settings)
+-- visualize(content,checkedsettings(settings,"inline"))
+-- end
+-- end
+
+-- implement {
+-- name = "type_y",
+-- actions = typestring_y,
+-- arguments = {
+-- {
+-- { "n", "integer" },
+-- { "tab" },
+-- { "method" },
+-- { "compact" },
+-- { "nature" },
+-- { "escape" },
+-- }
+-- }
+-- }
+
+implement {
+ name = "processbuffer",
+ actions = processbuffer,
+ arguments = {
+ {
+ { "name" },
+ { "strip" },
+ { "tab" },
+ { "method" },
+ { "nature" },
+ }
+ }
+}
+
+implement {
+ name = "typebuffer",
+ actions = typebuffer,
+ arguments = {
+ {
+ { "name" },
+ { "strip" },
+ { "range" },
+ { "regime" },
+ { "tab" },
+ { "method" },
+ { "escape" },
+ { "nature" },
+ }
+ }
+}
+
+implement {
+ name = "typefile",
+ actions = typefile,
+ arguments = {
+ {
+ { "name" },
+ { "strip" },
+ { "range" },
+ { "regime" },
+ { "tab" },
+ { "method" },
+ { "escape" },
+ { "nature" },
+ }
+ }
+}
+
+implement {
+ name = "doifelsevisualizer",
+ actions = { visualizers.getspecification, commands.doifelse },
+ arguments = "string"
+}
+
+implement {
+ name = "loadvisualizer",
+ actions = visualizers.load,
+ arguments = "string"
+}
diff --git a/tex/context/base/mkxl/buff-ver.mkxl b/tex/context/base/mkxl/buff-ver.mkxl
index 8c42694a3..145613877 100644
--- a/tex/context/base/mkxl/buff-ver.mkxl
+++ b/tex/context/base/mkxl/buff-ver.mkxl
@@ -15,7 +15,7 @@
\writestatus{loading}{ConTeXt Buffer Macros / Verbatim}
-\registerctxluafile{buff-ver}{}
+\registerctxluafile{buff-ver}{autosuffix}
\unprotect
@@ -310,6 +310,7 @@
\dostarttaggedchained\t!verbatim\currenttype\??type
\clf_type
data {\detokenize{#1}}%
+% data {#1}%
tab {\typeparameter\c!tab}%
method {\p_buff_option}%
compact {\typeparameter\c!compact}% % none | all | last (all needed in tabulate etc for manuals)
diff --git a/tex/context/base/mkxl/chem-str.mkxl b/tex/context/base/mkxl/chem-str.mkxl
index a4a974de1..227f98c4b 100644
--- a/tex/context/base/mkxl/chem-str.mkxl
+++ b/tex/context/base/mkxl/chem-str.mkxl
@@ -273,11 +273,11 @@
\setbox\scratchboxthree\hpack to \d_chem_width{\strut\hss\hbox{\strut\m_chem_bot_text}\hss}%
\setbox\b_chem_result\hpack \bgroup
\box\b_chem_result
- \hskip-\d_chem_width
+ \kern-\d_chem_width
\raise\d_chem_height\hpack{\lower\ht\scratchboxtwo\box\scratchboxtwo}%
- \hskip-\d_chem_width
+ \kern-\d_chem_width
\lower.5\dimexpr\ht\scratchboxone-\dp\scratchboxone\relax\box\scratchboxone
- \hskip-\d_chem_width
+ \kern-\d_chem_width
\lower\d_chem_depth\hpack{\raise\dp\scratchboxthree\box\scratchboxthree}%
\hss
\egroup} % text on top of chemicals
@@ -544,8 +544,8 @@
\definechemicalsymbol[i:equilibrium] [\enspace\mathematics{\xrightoverleftarrow{}{}}\enspace]
\definechemicalsymbol[i:mesomeric] [\enspace\mathematics{\xleftrightarrow{}{}}\enspace]
\definechemicalsymbol[i:single] [\chemicalbondrule]
-\definechemicalsymbol[i:double] [\hpack{\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
-\definechemicalsymbol[i:triple] [\hpack{\chemicalbondrule\hskip-1em\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
+\definechemicalsymbol[i:double] [\hpack{\lower.5ex\chemicalbondrule\kern-\emwidth\raise.5\exheight\chemicalbondrule}]
+\definechemicalsymbol[i:triple] [\hpack{\chemicalbondrule\kern-\emwidth\lower.5\exheight\chemicalbondrule\kern-\emwidth\raise.5\exheight\chemicalbondrule}]
\permanent\protected\def\chemicalsinglebond {\chemicalsymbol[i:single]}
\permanent\protected\def\chemicaldoublebond {\chemicalsymbol[i:double]}
@@ -614,8 +614,8 @@
\definechemicalsymbol[d:equilibrium] [\cleftarrow]
\definechemicalsymbol[d:mesomeric] [\crightoverleftarrow]
\definechemicalsymbol[d:single] [\chemicalbondrule]
-\definechemicalsymbol[d:double] [\hpack{\lower.5\exheight\chemicalbondrule\hskip-\emwidth\raise.5\exheight\chemicalbondrule}]
-\definechemicalsymbol[d:triple] [\hpack{\chemicalbondrule\hskip-\emwidth\lower.5\exheight\chemicalbondrule\hskip-\emwidth\raise.5\exheight\chemicalbondrule}]
+\definechemicalsymbol[d:double] [\hpack{\lower.5\exheight\chemicalbondrule\kern-\emwidth\raise.5\exheight\chemicalbondrule}]
+\definechemicalsymbol[d:triple] [\hpack{\chemicalbondrule\kern-\emwidth\lower.5\exheight\chemicalbondrule\kern-\emwidth\raise.5\exheight\chemicalbondrule}]
\definechemicalsymbol[d:opencomplex] [\mathematics{\Bigg[}] % not yet ok
\definechemicalsymbol[d:closecomplex][\mathematics{\Bigg]}] % not yet ok
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index b8b8f8562..fb9c31af8 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{2023.05.08 17:36}
+\newcontextversion{2023.05.27 12:11}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 3f878c72c..73864fbe6 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{2023.05.08 17:36}
+\immutable\edef\contextversion{2023.05.27 12:11}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -655,8 +655,7 @@
%
% % luat-bas.mkxl l-macro-imp-optimize % this is no longer used
-% c:/data/develop/context/sources/buff-par.lua
-% c:/data/develop/context/sources/buff-ver.lua
+% c:/data/develop/context/sources/buff-par.lua % parallel
%
% c:/data/develop/context/sources/buff-imp-default.lua % shared
% c:/data/develop/context/sources/buff-imp-escaped.lua % shared
@@ -758,7 +757,7 @@
% c:/data/develop/context/sources/luat-iop.lua
% c:/data/develop/context/sources/luat-mac.lua % will become lmt
-% c:/data/develop/context/sources/lxml-aux.lua % the xml interfcace is rather stable
+% c:/data/develop/context/sources/lxml-aux.lua % the xml interface is rather stable
% c:/data/develop/context/sources/lxml-css.lua % and is also provided/used in lua so
% c:/data/develop/context/sources/lxml-dir.lua % might as well share these because they
% c:/data/develop/context/sources/lxml-ent.lua % are unlikely to change
@@ -787,17 +786,17 @@
% c:/data/develop/context/sources/page-mix.lua
% c:/data/develop/context/sources/page-pst.lua
-% c:/data/develop/context/sources/publ-aut.lua % shared
-% c:/data/develop/context/sources/publ-dat.lua % shared
-% c:/data/develop/context/sources/publ-fnd.lua % shared
-% c:/data/develop/context/sources/publ-inc.lua % shared
-% c:/data/develop/context/sources/publ-ini.lua % shared
-% c:/data/develop/context/sources/publ-jrn.lua % shared
-% c:/data/develop/context/sources/publ-oth.lua % shared
-% c:/data/develop/context/sources/publ-reg.lua % shared
-% c:/data/develop/context/sources/publ-sor.lua % shared
-% c:/data/develop/context/sources/publ-tra.lua % shared
-% c:/data/develop/context/sources/publ-usr.lua % shared
+% c:/data/develop/context/sources/publ-aut.lua % These files are shared and it makes
+% c:/data/develop/context/sources/publ-dat.lua % no sense to make lmtx variants (yet),
+% c:/data/develop/context/sources/publ-fnd.lua %
+% c:/data/develop/context/sources/publ-inc.lua %
+% c:/data/develop/context/sources/publ-ini.lua %
+% c:/data/develop/context/sources/publ-jrn.lua %
+% c:/data/develop/context/sources/publ-oth.lua %
+% c:/data/develop/context/sources/publ-reg.lua %
+% c:/data/develop/context/sources/publ-sor.lua %
+% c:/data/develop/context/sources/publ-tra.lua %
+% c:/data/develop/context/sources/publ-usr.lua %
% c:/data/develop/context/sources/scrn-but.lua
% c:/data/develop/context/sources/scrn-fld.lua
@@ -822,9 +821,7 @@
% c:/data/develop/context/sources/strc-usr.lua
% c:/data/develop/context/sources/syst-cmp.lua -- nothing
-% c:/data/develop/context/sources/syst-con.lua
% c:/data/develop/context/sources/trac-ctx.lua
% c:/data/develop/context/sources/trac-lmx.lua
% c:/data/develop/context/sources/trac-par.lua
-% c:/data/develop/context/sources/trac-tex.lua
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index be156affb..48fbe1ad6 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -392,7 +392,6 @@ local flush_character do
if v and v ~= 0 then
pos_v = pos_v + v * sy
end
-print("6>",fnt)
flushchar(fnt,c,csx,csy)
pos_h = ph
pos_v = pv
@@ -524,7 +523,6 @@ print("6>",fnt)
local okay = fonts and fonts[index]
if okay then
fnt = okay.id or fnt -- or maybe just return
-print("7>",fnt)
end
elseif command == "lua" then
local code = packet[2]
diff --git a/tex/context/base/mkxl/file-job.mklx b/tex/context/base/mkxl/file-job.mklx
index 1c57a832d..b7883ddcd 100644
--- a/tex/context/base/mkxl/file-job.mklx
+++ b/tex/context/base/mkxl/file-job.mklx
@@ -355,7 +355,7 @@
% \fi
% \lastnamedcs}
-\permanent\protected\def\samplefile#1{\clf_samplefile{#1}}
+% \permanent\protected\def\samplefile#1{\clf_samplefile{#1}} % defined at the lua end
% \adddefaultsuffix[foo,{},crap]
% \adddefaultsuffix[{}]
diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt
index 113cade52..af4bf919a 100644
--- a/tex/context/base/mkxl/font-ctx.lmt
+++ b/tex/context/base/mkxl/font-ctx.lmt
@@ -1601,13 +1601,14 @@ do -- else too many locals
-- here
- local infofont = 0
+ local infofont = table.setmetatableindex(function(t,k)
+ local v = define { name = "dejavusansmono", size = texsp("6pt") }
+ t[k] = v
+ return v
+ end)
- function fonts.infofont()
- if infofont == 0 then
- infofont = define { name = "dejavusansmono", size = texsp("6pt") }
- end
- return infofont
+ function fonts.infofont(small)
+ return infofont[small == true and "3pt" or "6pt"]
end
-- abstract interfacing : we could actually do a runmacro or so
diff --git a/tex/context/base/mkxl/font-dsp.lmt b/tex/context/base/mkxl/font-dsp.lmt
index a1bf6f641..8746f4712 100644
--- a/tex/context/base/mkxl/font-dsp.lmt
+++ b/tex/context/base/mkxl/font-dsp.lmt
@@ -755,8 +755,8 @@ local function readposition(f,format,mainoffset,getdelta)
local Y = (format & 0x20) ~= 0 and skipshort(f) or 0
local H = (format & 0x40) ~= 0 and skipshort(f) or 0
local V = (format & 0x80) ~= 0 and skipshort(f) or 0
- -- local s = skips[extract(format,4,4)]
- local s = skips[(format >> 4) & 0xF]
+ -- local s = skips[extract(format,4,4)]
+ local s = skips[(format >> 4) & 0xF]
if s > 0 then
skipshort(f,s)
end
@@ -3145,9 +3145,18 @@ do
local linesdata -- for the moment verbose, will be just indexed
local affinedata -- for the moment verbose, will be just indexed
+local layerlistoffset
+local layeroffset
+
+local paintindex
+
local function getpaintoffset(f,offset)
- offset = offset + readuoffset(f)
- return paintdata[offset] and offset or nil
+ local o = readuoffset(f)
+ if o == 0 then
+ --
+ else
+ return paintdata[offset+o] -- and offset or nil
+ end
end
local function getlinesoffset(f,offset,var)
@@ -3166,138 +3175,138 @@ do
return offset
end
- paintreaders = {
+ local paintreaders = {
-- uint8 numLayers Number of offsets to paint tables to read from LayerList.
-- uint32 firstLayerIndex Index (base 0) into the LayerList.
- [1] = function(f,format)
- return {
- format = format,
- name = "PaintColrLayers",
- count = readuinteger(f),
- index = readulong(f),
- list = false,
- }
- end,
- -- uint16 paletteIndex Index for a CPAL palette entry.
- -- F2DOT14 alpha Alpha value.
- [2] = function(f,format)
- return {
- format = format,
- name = "Paintsolid",
- palette = readushort(f),
- alpha = read2dot14(f),
- }
- end,
- -- uint16 paletteIndex Index for a CPAL palette entry.
- -- F2DOT14 alpha Alpha value. For variation, use varIndexBase + 0.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [3] = function(f,format)
- return {
- format = format,
- name = "Paintsolid",
- palette = readushort(f),
- alpha = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 colorLineOffset Offset to VarColorLine table.
- -- FWORD x0 Start point (p₀) x coordinate. For variation, use varIndexBase + 0.
- -- FWORD y0 Start point (p₀) y coordinate. For variation, use varIndexBase + 1.
- -- FWORD x1 End point (p₁) x coordinate. For variation, use varIndexBase + 2.
- -- FWORD y1 End point (p₁) y coordinate. For variation, use varIndexBase + 3.
- -- FWORD x2 Rotation point (p₂) x coordinate. For variation, use varIndexBase + 4.
- -- FWORD y2 Rotation point (p₂) y coordinate. For variation, use varIndexBase + 5.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [4] = function(f,format,offset)
- return {
- format = format,
- name = "PaintLinearGradient",
- color = getlinesoffset(f,offset,false),
- x0 = readfword(f),
- y0 = readfword(f),
- x1 = readfword(f),
- y1 = readfword(f),
- x2 = readfword(f),
- y2 = readfword(f),
- }
- end,
- [5] = function(f,format,offset)
- return {
- format = format,
- name = "PaintLinearGradient",
- color = getlinesoffset(f,offset,true),
- x0 = readfword(f),
- y0 = readfword(f),
- x1 = readfword(f),
- y1 = readfword(f),
- x2 = readfword(f),
- y2 = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 colorLineOffset Offset to VarColorLine table.
- -- FWORD x0 Start circle center x coordinate. For variation, use varIndexBase + 0.
- -- FWORD y0 Start circle center y coordinate. For variation, use varIndexBase + 1.
- -- UFWORD radius0 Start circle radius. For variation, use varIndexBase + 2.
- -- FWORD x1 End circle center x coordinate. For variation, use varIndexBase + 3.
- -- FWORD y1 End circle center y coordinate. For variation, use varIndexBase + 4.
- -- UFWORD radius1 End circle radius. For variation, use varIndexBase + 5.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [6] = function(f,format)
- return {
- format = format,
- name = "PaintRadialGradient",
- color = getlinesoffset(f,offset,false),
- x0 = readfword(f),
- y0 = readfword(f),
- radius0 = readfword(f),
- x1 = readfword(f),
- y1 = readfword(f),
- radius1 = readfword(f),
- }
- end,
- [7] = function(f,format)
- return {
- format = format,
- name = "PaintRadialGradient",
- color = getlinesoffset(f,offset,true),
- x0 = readfword(f),
- y0 = readfword(f),
- radius0 = readfword(f),
- x1 = readfword(f),
- y1 = readfword(f),
- radius1 = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 colorLineOffset Offset to VarColorLine table.
- -- FWORD centerX Center x coordinate. For variation, use varIndexBase + 0.
- -- FWORD centerY Center y coordinate. For variation, use varIndexBase + 1.
- -- F2DOT14 startAngle Start of the angular range of the gradient, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 2.
- -- F2DOT14 endAngle End of the angular range of the gradient, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 3.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [8] = function(f,format)
- return {
- format = format,
- name = "PaintSweepGradient",
- color = getlinesoffset(f,offset,false),
- centerx = readfword(f),
- centery = readfword(f),
- startangle = read2dot14(f),
- endangle = read2dot14(f),
- }
- end,
- [9] = function(f,format)
- return {
- format = format,
- name = "PaintSweepGradient",
- color = getlinesoffset(f,offset,true),
- centerx = readfword(f),
- centery = readfword(f),
- startangle = read2dot14(f),
- endangle = read2dot14(f),
- varbase = readulong(f),
- }
+ [1] = function(f,format)
+ return {
+ format = format,
+ name = "PaintColrLayers",
+ count = readuinteger(f),
+ index = readulong(f),
+ list = false,
+ }
+ end,
+ -- uint16 paletteIndex Index for a CPAL palette entry.
+ -- F2DOT14 alpha Alpha value.
+ [2] = function(f,format)
+ return {
+ format = format,
+ name = "Paintsolid",
+ palette = readushort(f),
+ alpha = read2dot14(f),
+ }
+ end,
+ -- uint16 paletteIndex Index for a CPAL palette entry.
+ -- F2DOT14 alpha Alpha value. For variation, use varIndexBase + 0.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [3] = function(f,format)
+ return {
+ format = format,
+ name = "Paintsolid",
+ palette = readushort(f),
+ alpha = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 colorLineOffset Offset to VarColorLine table.
+ -- FWORD x0 Start point (p₀) x coordinate. For variation, use varIndexBase + 0.
+ -- FWORD y0 Start point (p₀) y coordinate. For variation, use varIndexBase + 1.
+ -- FWORD x1 End point (p₁) x coordinate. For variation, use varIndexBase + 2.
+ -- FWORD y1 End point (p₁) y coordinate. For variation, use varIndexBase + 3.
+ -- FWORD x2 Rotation point (p₂) x coordinate. For variation, use varIndexBase + 4.
+ -- FWORD y2 Rotation point (p₂) y coordinate. For variation, use varIndexBase + 5.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [4] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintLinearGradient",
+ color = getlinesoffset(f,offset,false),
+ x0 = readfword(f),
+ y0 = readfword(f),
+ x1 = readfword(f),
+ y1 = readfword(f),
+ x2 = readfword(f),
+ y2 = readfword(f),
+ }
+ end,
+ [5] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintLinearGradient",
+ color = getlinesoffset(f,offset,true),
+ x0 = readfword(f),
+ y0 = readfword(f),
+ x1 = readfword(f),
+ y1 = readfword(f),
+ x2 = readfword(f),
+ y2 = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 colorLineOffset Offset to VarColorLine table.
+ -- FWORD x0 Start circle center x coordinate. For variation, use varIndexBase + 0.
+ -- FWORD y0 Start circle center y coordinate. For variation, use varIndexBase + 1.
+ -- UFWORD radius0 Start circle radius. For variation, use varIndexBase + 2.
+ -- FWORD x1 End circle center x coordinate. For variation, use varIndexBase + 3.
+ -- FWORD y1 End circle center y coordinate. For variation, use varIndexBase + 4.
+ -- UFWORD radius1 End circle radius. For variation, use varIndexBase + 5.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [6] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRadialGradient",
+ color = getlinesoffset(f,offset,false),
+ x0 = readfword(f),
+ y0 = readfword(f),
+ radius0 = readfword(f),
+ x1 = readfword(f),
+ y1 = readfword(f),
+ radius1 = readfword(f),
+ }
+ end,
+ [7] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRadialGradient",
+ color = getlinesoffset(f,offset,true),
+ x0 = readfword(f),
+ y0 = readfword(f),
+ radius0 = readfword(f),
+ x1 = readfword(f),
+ y1 = readfword(f),
+ radius1 = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 colorLineOffset Offset to VarColorLine table.
+ -- FWORD centerX Center x coordinate. For variation, use varIndexBase + 0.
+ -- FWORD centerY Center y coordinate. For variation, use varIndexBase + 1.
+ -- F2DOT14 startAngle Start of the angular range of the gradient, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 2.
+ -- F2DOT14 endAngle End of the angular range of the gradient, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 3.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [8] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSweepGradient",
+ color = getlinesoffset(f,offset,false),
+ centerx = readfword(f),
+ centery = readfword(f),
+ startangle = read2dot14(f),
+ endangle = read2dot14(f),
+ }
+ end,
+ [9] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSweepGradient",
+ color = getlinesoffset(f,offset,true),
+ centerx = readfword(f),
+ centery = readfword(f),
+ startangle = read2dot14(f),
+ endangle = read2dot14(f),
+ varbase = readulong(f),
+ }
end,
-- Offset24 paintOffset Offset to a Paint table.
-- uint16 glyphID Glyph ID for the source outline.
@@ -3310,269 +3319,273 @@ do
}
end,
-- uint16 glyphID Glyph ID for a BaseGlyphList base glyph.
- [11] = function(f,format)
- return {
- format = format,
- name = "PaintColrGlyph",
- glyph = readushort(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- Offset24 transformOffset Offset to an (Var)Affine2x3 table.
- [12] = function(f,format,offset)
- return {
- format = format,
- name = "PaintTransform",
- affine = getaffineoffset(f,offset,false),
- paint = getpaintoffset(f,offset),
- }
- end,
- [13] = function(f,format,offset)
- return {
- format = format,
- name = "PaintTransform",
- affine = getaffineoffset(f,offset,true),
- paint = getpaintoffset(f,offset),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- FWORD dx Translation in x direction. For variation, use varIndexBase + 0.
- -- FWORD dy Translation in y direction. For variation, use varIndexBase + 1.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [14] = function(f,format,offset)
- return {
- format = format,
- name = "PaintTranslate",
- paint = getpaintoffset(f,offset),
- dx = readfword(f),
- dy = readfword(f),
- }
- end,
- [15] = function(f,format,offset)
- return {
- format = format,
- name = "PaintTranslate",
- paint = getpaintoffset(f,offset),
- dx = readfword(f),
- dy = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 scaleX Scale factor in x direction. For variation, use varIndexBase + 0.
- -- F2DOT14 scaleY Scale factor in y direction. For variation, use varIndexBase + 1.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [16] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scalex = read2dot14(f),
- scaley = read2dot14(f),
- }
- end,
- [17] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scalex = read2dot14(f),
- scaley = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 scaleX Scale factor in x direction. For variation, use varIndexBase + 0.
- -- F2DOT14 scaleY Scale factor in y direction. For variation, use varIndexBase + 1.
- -- FWORD centerX x coordinate for the center of scaling. For variation, use varIndexBase + 2.
- -- FWORD centerY y coordinate for the center of scaling. For variation, use varIndexBase + 3.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [18] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scalex = read2dot14(f),
- scaley = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- }
- end,
- [19] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scalex = read2dot14(f),
- scaley = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 scale Scale factor in x and y directions. For variation, use varIndexBase + 0.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [20] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scale = read2dot14(f),
- }
- end,
- [21] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scale = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 scale Scale factor in x and y directions. For variation, use varIndexBase + 0.
- -- FWORD centerX x coordinate for the center of scaling. For variation, use varIndexBase + 1.
- -- FWORD centerY y coordinate for the center of scaling. For variation, use varIndexBase + 2.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [22] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scale = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- }
- end,
- [23] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scale = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 angle Rotation angle, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [24] = function(f,format,offset)
- return {
- format = format,
- angle = read2dot14(f),
- paint = getpaintoffset(f,offset),
- name = "PaintRotate",
- }
- end,
- [25] = function(f,format,offset)
- return {
- format = format,
- name = "PaintRotate",
- paint = getpaintoffset(f,offset),
- angle = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 angle Rotation angle, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
- -- FWORD centerX x coordinate for the center of rotation. For variation, use varIndexBase + 1.
- -- FWORD centerY y coordinate for the center of rotation. For variation, use varIndexBase + 2.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [26] = function(f,format,offset)
- return {
- format = format,
- name = "PaintRotate",
- paint = getpaintoffset(f,offset),
- centerx = readfword(f),
- centery = readfword(f),
- }
- end,
- [27] = function(f,format,offset)
- return {
- format = format,
- name = "PaintRotate",
- paint = getpaintoffset(f,offset),
- centerx = read2dot14(f),
- centery = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 xSkewAngle Angle of skew in the direction of the x-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
- -- F2DOT14 ySkewAngle Angle of skew in the direction of the y-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 1.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [28] = function(f,format,offset)
- return {
- format = format,
- name = "PaintSkew",
- paint = getpaintoffset(f,offset),
- xangle = read2dot14(f),
- yangle = read2dot14(f),
- }
- end,
- [29] = function(f,format,offset)
- return {
- format = format,
- name = "PaintSkew",
- paint = getpaintoffset(f,offset),
- xangle = read2dot14(f),
- yangle = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 xSkewAngle Angle of skew in the direction of the x-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
- -- F2DOT14 ySkewAngle Angle of skew in the direction of the y-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 1.
- -- FWORD centerX x coordinate for the center of rotation. For variation, use varIndexBase + 2.
- -- FWORD centerY y coordinate for the center of rotation. For variation, use varIndexBase + 3.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [30] = function(f,format,offset)
- return {
- format = format,
- name = "PaintSkew",
- paint = getpaintoffset(f,offset),
- xangle = read2dot14(f),
- yangle = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- }
- end,
- [31] = function(f,format,offset)
- return {
- format = format,
- name = "PaintSkew",
- paint = getpaintoffset(f,offset),
- xangle = read2dot14(f),
- yangle = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 sourcePaintOffset Offset to a source Paint table.
- -- uint8 compositeMode A CompositeMode enumeration value.
- -- Offset24 backdropaintOffset Offset to a backdrop Paint table.
- [32] = function(f,format,offset)
- return {
- format = format,
- name = "PaintComposite",
- source = getpaintoffset(f,offset),
- mode = readuinteger(f),
- backdrop = getpaintoffset(f,offset),
- }
- end,
+ [11] = function(f,format)
+ return {
+ format = format,
+ name = "PaintColrGlyph",
+ glyph = readushort(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- Offset24 transformOffset Offset to an (Var)Affine2x3 table.
+ [12] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintTransform",
+ affine = getaffineoffset(f,offset,false),
+ paint = getpaintoffset(f,offset),
+ }
+ end,
+ [13] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintTransform",
+ affine = getaffineoffset(f,offset,true),
+ paint = getpaintoffset(f,offset),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- FWORD dx Translation in x direction. For variation, use varIndexBase + 0.
+ -- FWORD dy Translation in y direction. For variation, use varIndexBase + 1.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [14] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintTranslate",
+ paint = getpaintoffset(f,offset),
+ dx = readfword(f),
+ dy = readfword(f),
+ }
+ end,
+ [15] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintTranslate",
+ paint = getpaintoffset(f,offset),
+ dx = readfword(f),
+ dy = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 scaleX Scale factor in x direction. For variation, use varIndexBase + 0.
+ -- F2DOT14 scaleY Scale factor in y direction. For variation, use varIndexBase + 1.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [16] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scalex = read2dot14(f),
+ scaley = read2dot14(f),
+ }
+ end,
+ [17] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scalex = read2dot14(f),
+ scaley = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 scaleX Scale factor in x direction. For variation, use varIndexBase + 0.
+ -- F2DOT14 scaleY Scale factor in y direction. For variation, use varIndexBase + 1.
+ -- FWORD centerX x coordinate for the center of scaling. For variation, use varIndexBase + 2.
+ -- FWORD centerY y coordinate for the center of scaling. For variation, use varIndexBase + 3.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [18] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scalex = read2dot14(f),
+ scaley = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ }
+ end,
+ [19] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scalex = read2dot14(f),
+ scaley = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 scale Scale factor in x and y directions. For variation, use varIndexBase + 0.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [20] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scale = read2dot14(f),
+ }
+ end,
+ [21] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scale = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 scale Scale factor in x and y directions. For variation, use varIndexBase + 0.
+ -- FWORD centerX x coordinate for the center of scaling. For variation, use varIndexBase + 1.
+ -- FWORD centerY y coordinate for the center of scaling. For variation, use varIndexBase + 2.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [22] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scale = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ }
+ end,
+ [23] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scale = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 angle Rotation angle, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [24] = function(f,format,offset)
+ return {
+ format = format,
+ angle = read2dot14(f),
+ paint = getpaintoffset(f,offset),
+ name = "PaintRotate",
+ }
+ end,
+ [25] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRotate",
+ paint = getpaintoffset(f,offset),
+ angle = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 angle Rotation angle, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
+ -- FWORD centerX x coordinate for the center of rotation. For variation, use varIndexBase + 1.
+ -- FWORD centerY y coordinate for the center of rotation. For variation, use varIndexBase + 2.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [26] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRotate",
+ paint = getpaintoffset(f,offset),
+ centerx = readfword(f),
+ centery = readfword(f),
+ }
+ end,
+ [27] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRotate",
+ paint = getpaintoffset(f,offset),
+ centerx = read2dot14(f),
+ centery = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 xSkewAngle Angle of skew in the direction of the x-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
+ -- F2DOT14 ySkewAngle Angle of skew in the direction of the y-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 1.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [28] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSkew",
+ paint = getpaintoffset(f,offset),
+ xangle = read2dot14(f),
+ yangle = read2dot14(f),
+ }
+ end,
+ [29] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSkew",
+ paint = getpaintoffset(f,offset),
+ xangle = read2dot14(f),
+ yangle = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 xSkewAngle Angle of skew in the direction of the x-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
+ -- F2DOT14 ySkewAngle Angle of skew in the direction of the y-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 1.
+ -- FWORD centerX x coordinate for the center of rotation. For variation, use varIndexBase + 2.
+ -- FWORD centerY y coordinate for the center of rotation. For variation, use varIndexBase + 3.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [30] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSkew",
+ paint = getpaintoffset(f,offset),
+ xangle = read2dot14(f),
+ yangle = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ }
+ end,
+ [31] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSkew",
+ paint = getpaintoffset(f,offset),
+ xangle = read2dot14(f),
+ yangle = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 sourcePaintOffset Offset to a source Paint table.
+ -- uint8 compositeMode A CompositeMode enumeration value.
+ -- Offset24 backdropaintOffset Offset to a backdrop Paint table.
+ [32] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintComposite",
+ source = getpaintoffset(f,offset),
+ mode = readuinteger(f),
+ backdrop = getpaintoffset(f,offset),
+ }
+ end,
}
local unsupported = function()
- return nil
+ return false
end
setmetatableindex(paintreaders,function(t,format)
- report("unsupported colr type 2 paint format %i",format)
- t[format] = unsupported
+ if format then
+ report("unsupported colr type 2 paint format %S",format)
+ t[format] = unsupported -- problem: we don't know what to skip, so maybe best is to quit
+ else
+ report("possible error reading colr type 2 paint format")
+ end
return unsupported
end)
@@ -3595,10 +3608,12 @@ do
local glyphs = fontdata.glyphs
local nofglyphs = readushort(f)
local baseoffset = readulong(f)
- local layeroffset = readulong(f)
+-- local layeroffset = readulong(f)
+layeroffset = readulong(f)
local noflayers = readushort(f)
local glyphlistoffset = 0
- local layerlistoffset = 0
+-- local layerlistoffset = 0
+layerlistoffset = 0
local cliplistoffset = 0
local varindexmapoffset = 0
local variationoffset = 0
@@ -3614,7 +3629,7 @@ do
-- The special value 0xFFFF is foreground (but we index from 1). It
-- more looks like indices into a palette so 'class' is a better name
-- than 'palette'.
- if layeroffset > 0 then
+ if layeroffset > 0 and noflayers > 0 then
setposition(f,tableoffset + layeroffset)
for i=1,noflayers do
local slot = readushort(f)
@@ -3632,7 +3647,7 @@ do
end
end
fontdata.maxcolorclass = maxclass
- if baseoffset > 0 then
+ if baseoffset > 0 and nofglyphs > 0 then
setposition(f,tableoffset + baseoffset)
for i=0,nofglyphs-1 do
local glyphindex = readushort(f)
@@ -3645,66 +3660,84 @@ do
glyphs[glyphindex].colors = t
end
end
-if next(layerrecords) then
- report("table version %a of %a is %s supported for font %s",version,"colr","partially",fontdata.filename)
- return
-end
+ if next(layerrecords) then
+ report("table version %a of %a is %s supported for font %s",version,"colr","partially",fontdata.filename)
+ return
+ end
-- if not (CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0) then
-- return
-- end
if layerlistoffset > 0 and glyphlistoffset > 0 then
local layers = { }
local paints = { }
- local count, offset
- --
- setposition(f,tableoffset + layerlistoffset)
- count = readulong(f)
- -- layers = readcardinaltable(f,count,uoffset)
- for i=1,count do -- zero ?
+layeroffset = tableoffset + layerlistoffset
+ setposition(f,layeroffset)
+ local layercount = readulong(f)
+ -- layers = readcardinaltable(f,layercount,uoffset)
+ for i=1,layercount do -- zero ?
layers[i] = readulong(f) -- offsets to painttable
end
--
- offset = tableoffset + glyphlistoffset
- setposition(f,offset)
- count = readulong(f)
- for i=1,count do
+ glyphoffset = tableoffset + glyphlistoffset
+ setposition(f,glyphoffset)
+ local glyphcount = readulong(f)
+ for i=1,glyphcount do
-- glyph index -> paintrecord
paints[readushort(f)] = readulong(f) -- paintrecord offset (32 formats)
end
paintdata = setmetatableindex(function(t,k)
+ local p = getposition(f)
setposition(f,k)
local format = readuinteger(f)
local v = paintreaders[format](f,format,k)
+ setposition(f,p)
t[k] = v
return v
end)
linesdata = { }
affinedata = { }
+ for i=1,layercount do -- zero ?
+ local o = layeroffset + layers[i]
+ local l = paintdata[o]
+ if not l then
+ report("color table in font %a has an invalid layer entry %i, offset %i",i,layers[i])
+ end
+ layers[i] = l
+ end
+-- io.savedata("e:/tmp/oeps.lua",table.serialize({ root = paintdata }))
+-- io.savedata("e:/tmp/oeps.lua",table.serialize(layers))
for k, v in next, paints do
- local o = offset + v
+ local o = glyphoffset + v - layeroffset
if paintdata[o] then
paints[k] = o -- first paint
end
end
-- expand format 1
- offset = tableoffset + layerlistoffset
for k, v in next, paints do
v = paintdata[v]
- local format = v.format
- if format == 1 then
- -- name
- local count = v.count
- local index = v.index
- local list = { }
- v.count = nil
- v.index = nil
- v.list = list
- for i=1,count do
- local o = offset + layers[index+i]
- if paintdata[o] then
- list[i] = o
+ if v then
+ local format = v.format
+ if format == 1 then
+ -- name
+ local count = v.count
+ if count then
+ local index = v.index + 1
+ local list = { }
+ v.count = nil
+ v.index = nil
+ v.list = list
+ for i=1,count do
+-- local o = layeroffset + layers[index+i]
+-- if paintdata[o] then
+ list[i] = layers[index]
+ index = index + 1
+ end
+ else
+ -- already done
end
end
+ else
+ -- missing
end
end
--
@@ -3732,18 +3765,27 @@ end
local extend = readuinteger(f)
local count = readushort(f)
local stops = { }
- for i=1,count do
- stops[i] = {
- stop = read2dot14(f),
- pallette = readushort(f),
- alpha = read2dot14(f),
- varbase = v and readulong(f) or nil,
+ if count then
+ for i=1,count do
+ stops[i] = {
+ stop = read2dot14(f),
+ pallette = readushort(f),
+ alpha = read2dot14(f),
+ varbase = v and readulong(f) or nil,
+ }
+ end
+ linesdata[k] = {
+ extend = readuinteger(f),
+ stops = stops,
+ }
+ else
+ report("running out of linedata in colr reading")
+ linesdata[k] = {
+ extend = 0,
+ stops = stops,
}
+ break
end
- linesdata[k] = {
- extend = readuinteger(f),
- stops = stops,
- }
end
--
for k, v in next, affinedata do
@@ -3775,6 +3817,9 @@ end
local lhash, ldata = rehash(linesdata)
local ahash, adata = rehash(affinedata)
for k, v in next, paintdata do
+if not v then
+ print("todo",k,v)
+else
local c = v.color
if c then
v.color = lhash[c]
@@ -3801,6 +3846,7 @@ end
v.backdrop = phash[v.backdrop]
-- goto done
end
+end
::done::
end
paintdata = pdata
@@ -3815,16 +3861,21 @@ end
local paint = paintdata[v]
local format = paint.format
if format == 1 then
- local list = paint.list
- local done = { }
+ local list = paint.list
+ local done = { }
+ local count = 0
for i=1,#list do
local p = paintdata[list[i]]
local f = p.format
if f == 10 or f == 11 then
- done[i] = {
+ count = count + 1
+ done[count] = {
slot = p.glyph,
class = i,
}
+ else
+ -- print(f)
+ -- missing
end
end
glyphs[k].colors = done
@@ -3837,6 +3888,7 @@ end
-- fontdata.coloraffinedata = affinedata
end
end
+ ::done::
fontdata.hascolor = true
end
diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx
index ea727bde4..ff9e45243 100644
--- a/tex/context/base/mkxl/font-ini.mklx
+++ b/tex/context/base/mkxl/font-ini.mklx
@@ -608,7 +608,7 @@
\def\font_basics_define_fontstyle_indeed#style#command%
{\defcsname\??fontshortstyle#command\endcsname{#style}%
- \defcsname\??fontstyle #command\endcsname{\csname#style\endcsname}}
+ \defcsname\??fontstyle #command\endcsname{\csname#style\endcsname}} % we could pre-expand
\permanent\protected\def\definefontsize[#size]%
{\ifcsname\??fontsizeknown#size\endcsname \else
diff --git a/tex/context/base/mkxl/font-ogr.lmt b/tex/context/base/mkxl/font-ogr.lmt
index 3b4f9f867..a36ee88b4 100644
--- a/tex/context/base/mkxl/font-ogr.lmt
+++ b/tex/context/base/mkxl/font-ogr.lmt
@@ -531,7 +531,12 @@ local initializeoverlay do
-- todo: use extender
local u = { "use", 0 }
for i=1,#colorlist do
- u[i+2] = colorlist[i].slot
+ local c = colorlist[i]
+ if c then
+ u[i+2] = c.slot
+ else
+ -- some error
+ end
end
v.commands = { u, slotcommand[slot][idx] }
-- hack to prevent that type 3 also gets 'use' flags .. todo
diff --git a/tex/context/base/mkxl/lang-rep.lmt b/tex/context/base/mkxl/lang-rep.lmt
index fcaff523a..1f1c1e417 100644
--- a/tex/context/base/mkxl/lang-rep.lmt
+++ b/tex/context/base/mkxl/lang-rep.lmt
@@ -111,28 +111,48 @@ lists[v_reset].attribute = unsetvalue -- so we discard 0
-- todo: glue kern attr
local function add(root,word,replacement)
- local processor, replacement = splitprocessor(replacement,true) -- no check
- replacement = lpegmatch(stripper,replacement) or replacement
- local list = utfsplit(word) -- ,true)
- local size = #list
- for i=1,size do
- local l = utfbyte(list[i])
- if not root[l] then
- root[l] = { }
+ if type(replacement) == "function" then
+ local list = utfsplit(word) -- ,true)
+ local size = #list
+ for i=1,size do
+ local l = utfbyte(list[i])
+ if not root[l] then
+ root[l] = { }
+ end
+ if i == size then
+ root[l].final = {
+ word = word,
+ replacer = replacement,
+ processor = processor,
+ oldlength = size,
+ }
+ end
+ root = root[l]
end
- if i == size then
- local special = find(replacement,"{",1,true)
- local newlist = lpegmatch(splitter,replacement)
- root[l].final = {
- word = word,
- replacement = replacement,
- processor = processor,
- oldlength = size,
- newcodes = newlist,
- special = special,
- }
+ else
+ local processor, replacement = splitprocessor(replacement,true) -- no check
+ replacement = lpegmatch(stripper,replacement) or replacement
+ local list = utfsplit(word) -- ,true)
+ local size = #list
+ for i=1,size do
+ local l = utfbyte(list[i])
+ if not root[l] then
+ root[l] = { }
+ end
+ if i == size then
+ local special = find(replacement,"{",1,true)
+ local newlist = lpegmatch(splitter,replacement)
+ root[l].final = {
+ word = word,
+ replacement = replacement,
+ processor = processor,
+ oldlength = size,
+ newcodes = newlist,
+ special = special,
+ }
+ end
+ root = root[l]
end
- root = root[l]
end
end
@@ -192,16 +212,29 @@ local ispunctuation = characters.is_punctuation
-- for punctuation was added.
local function replace(head,first,last,final,hasspace,overload)
- local current = first
- local prefirst = getprev(first) or head
- local postlast = getnext(last)
- local oldlength = final.oldlength
- local newcodes = final.newcodes
+ local current = first
+ local prefirst = getprev(first) or head
+ local postlast = getnext(last)
+ local oldlength = final.oldlength
+ local newcodes = final.newcodes
+ local word = final.word
+ local replacement = final.replacement
+ local replacer = final.replacer
+ local special = final.special
+ if type(replacer) == "function" then
+ replacement = replacer(word)
+ if type(replacement) == "string" then
+ special = find(replacement,"{",1,true)
+ newcodes = lpegmatch(splitter,replacement)
+ else
+ return
+ end
+ end
local newlength = newcodes and #newcodes or 0
if trace_replacements then
- report_replacement("replacing word %a by %a",final.word,final.replacement)
+ report_replacement("replacing word %a by %a",word,replacement)
end
- if hasspace or final.special then
+ if hasspace or special then
-- It's easier to delete and insert so we do just that. On the todo list is
-- turn injected spaces into glue but easier might be to let the char break
-- handler do that ...
@@ -271,13 +304,13 @@ local function replace(head,first,last,final,hasspace,overload)
elseif newlength == 0 then
-- we overload
elseif oldlength == newlength then
- if final.word ~= final.replacement then
+ if word ~= replacement then
for i=1,newlength do
setchar(current,newcodes[i])
current = getnext(current)
end
end
- current = getnext(final)
+ -- current = getnext(final) -- some left over? no next!
elseif oldlength < newlength then
for i=1,newlength-oldlength do
local n = copy_node(current)
diff --git a/tex/context/base/mkxl/lang-rep.mkxl b/tex/context/base/mkxl/lang-rep.mkxl
index 03b761bb7..f13e2ec7b 100644
--- a/tex/context/base/mkxl/lang-rep.mkxl
+++ b/tex/context/base/mkxl/lang-rep.mkxl
@@ -23,6 +23,7 @@
\definesystemattribute[replacements][public,global]
+%D \starttyping
%D \startluacode
%D
%D -- todo: other nodes (prelude to more experiments with auto dropped caps)
@@ -43,12 +44,27 @@
%D \replaceword[more][---][—]
%D \replaceword[basics][special][veryspe{>>>}{<<<}{=}cial]
%D
-%D \starttyping
%D \start \setreplacements[basics] What the heck, it's now or never, isn't it new? \par \stop
%D \start \setreplacements[more] Do we --- {\it really} --- need this kind of crap? \par \stop
%D \start \setreplacements[basics] All kinds of special thingies! \par \stop
%D \start \setreplacements[basics] \hsize1mm special \par \stop
%D \stoptyping
+%D
+%D Only in \LUA, functions:
+%D
+%D \startluacode
+%D languages.replacements.add("basics", {
+%D ["one"] = "cool",
+%D ["two"] = function(s)
+%D return "warm"
+%D end
+%D })
+%D \stopluacode
+%D
+%D \starttyping
+%D \start \setreplacements[basics] It's one in here! \stop \par
+%D \start \setreplacements[basics] It's two in here! \stop \par
+%D \stoptyping
\permanent\protected\def\setreplacements[#1]%
{\clf_setreplacements{#1}}
diff --git a/tex/context/base/mkxl/lang-tra.lmt b/tex/context/base/mkxl/lang-tra.lmt
index 259165928..28a534dc3 100644
--- a/tex/context/base/mkxl/lang-tra.lmt
+++ b/tex/context/base/mkxl/lang-tra.lmt
@@ -87,13 +87,14 @@ local converters = {
-- end,
["mapping"] = function(m)
local t_mapping = m.mapping
+-- inspect(t_mapping)
if t_mapping then
local t_exceptions = m.exceptions
local p = Cs ( (
utfchartabletopattern(t_mapping) / t_mapping
+ C(utfcharacterpattern)
)^0 )
- -- lpeg.print(p)
+-- lpeg.print(p)
return function(s,e)
return (e and e[s]) or t_exceptions[s] or lpegmatch(p,s) or s
end
@@ -114,7 +115,7 @@ function transliteration.use(library)
if lib == nil then
-- todo: use library loader
local data = require("lang-imp-" .. library)
- if data then
+ if type(data) == "table" then
local transliterations = data.transliterations
if transliterations then
for name, d in table.sortedhash(transliterations) do
diff --git a/tex/context/base/mkxl/lang-tra.mkxl b/tex/context/base/mkxl/lang-tra.mkxl
index 66a020a14..402251f36 100644
--- a/tex/context/base/mkxl/lang-tra.mkxl
+++ b/tex/context/base/mkxl/lang-tra.mkxl
@@ -87,53 +87,163 @@
\protect \endinput
-% \setupbodyfont[dejavu]
+% \starttext
+%
+% \switchtobodyfont[shobhika]
+%
+% \usetransliteration[indic]
+%
+% \definetransliteration
+% [MyDeva]
+% [color=blue,
+% vector={iast to deva}]
+%
+% \definetransliteration
+% [MyDevaB]
+% [MyDeva]
+% [color=green]
+%
+% \transliterationexception[iast to deva]{kauśika}{whoever}
+% \transliterationexception[MyDeva] {kauśika}{hans}
+% \transliterationexception[MyDevaB] {kauśika}{knuth}
%
-% \input lang-tra.mkiv
+% \starttransliteration[MyDeva]
+% idaṁ adbhutam kauśika tisraḥ garuḍavāhanan%
+% \stoptransliteration
%
-% \definetransliteration[serbian][serbian to latin]
+% \starttransliteration[MyDevaB]
+% idaṁ adbhutam kauśika tisraḥ garuḍavāhanan%
+% \stoptransliteration
+%
+% \stoptext
+%
+% \setupbodyfont[dejavu]
+%
+% \setupalign[tolerant,stretch]
%
% \starttext
%
-% \settransliteration[serbian to latin]
+% % \enabletrackers[languages.transliteration]
%
-% \startchapter[title={АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}]
-% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \start
-% \settransliteration[serbian to latin]
-% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \stop
-% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \stopchapter
+% \usetransliteration[serbian] %at some point we can preload
%
-% \resettransliteration
+% \definetransliteration
+% [MySerbian]
+% [color=red,
+% language=en,
+% vector={serbian to latin}]
%
-% \startchapter[title={АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}]
+% \definetransliteration
+% [MySerbianX]
+% [MySerbian]
+% [color=blue]
+%
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
+% \start
+% \settransliteration[serbian to latin]
% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \start
-% \settransliteration[serbian to latin]
-% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \stop
+% \stop
+% \starttransliteration[MySerbian]%
% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \stopchapter
+% \stoptransliteration
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
+% \transliteration[MySerbianX]{АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
+% \starttransliteration[MySerbian][color=green]%
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
+% \stoptransliteration
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
%
-% \definehead[ChapterA][chapter]
-% \definehead[ChapterB][chapter]
+% \switchtobodyfont[rachana]
%
-% \startsetups s-to-l
-% \settransliteration[serbian to latin]
-% \red
-% \stopsetups
+% \usetransliteration[indic]
+%
+% \definebuffer[passage]
+% \startbuffer[passage]
+% तिस्रः खलु विधेर्विधाः – अपूर्वविधिः नियमविधिः परिसङ्ख्याविधिश्च इति। तत्र
+% कालत्रयेऽपि कथमप्यप्राप्तस्य प्राप्तिफलको विधिराद्यः। यथा ‘व्रीहीन् प्रोक्षति’
+% ...
+% तदनुनिष्पादिन्या अविधेयगतत्वेन विप्रकृष्टाया इतरनिवृत्तेः सन्निकृष्टफलसम्भवे
+% फलत्वानौचित्यात् ।
+% \stopbuffer
+%
+% \language[sa]
+%
+% \definedfont[file:arialuni.ttf*devanagari-two at 12pt]
+%
+% \definedfont[file:shobhika-regular.otf*devanagari-two at 12pt]
+%
+% \getbuffer[passage]
+%
+% % \page
+% % {\settransliteration[deva to mlym]\getbuffer[passage]}
+%
+% \page
+%
+% \startlines
+% \transliterate[deva to iast]{आनन्दः}
+% \transliterate[deva to iast]{अक्षयं}
+% \transliterate[deva to iast]{अवप्लुतं}
+% \transliterate[deva to iast]{त्रैयी}
+% \transliterate[deva to iast]{वार्त्तां}
+% \transliterate[deva to iast]{सान्द्रानन्दावबोधात्मकं}
+% \transliterate[deva to iast]{गरुडवाहनन्}
+% \stoplines
+%
+% \page
%
-% % maybe we need a setups key for this
-% % hm, \definesetups [xxx] [aa,bb,cc]
+% \startlines
+% \transliterate[iast to deva]{ānandaḥ}
+% \transliterate[iast to deva]{ati}
+% \transliterate[iast to deva]{ānandaḥ}
+% \transliterate[iast to deva]{ati}
+% \transliterate[iast to deva]{krauñca}
+% \transliterate[iast to deva]{krodhaṁ}
+% \transliterate[iast to deva]{kruddhaṁ}
+% \transliterate[iast to deva]{upahvarāyi}
+% \transliterate[iast to deva]{hārdika}
+% \transliterate[iast to deva]{śaunaśśepaḥ}
+% \transliterate[iast to deva]{tiśṣitaḥ}
+% \transliterate[iast to deva]{agryīṁ}
+% \transliterate[iast to deva]{saṅkulam}
+% \transliterate[iast to deva]{śrīrāman}
+% \transliterate[iast to deva]{niścitavantaḥ}
+% \transliterate[iast to deva]{idam adbhutama ai kr}
+% \transliterate[iast to deva]{kr saṁdhi}
+% \transliterate[iast to deva]{a}
+% \transliterate[iast to deva]{akr}
+% \transliterate[iast to deva]{āhriyate iast}
+% \transliterate[iast to deva]{utkaṁpita iast}
+% \transliterate[iast to deva]{śagdhyūṣū}
+% \transliterate[iast to deva]{tretā}
+% \transliterate[iast to deva]{ati}
+% \transliterate[iast to deva]{"ai"}
+% \transliterate[iast to deva]{dhavaḻa}
+% \transliterate[iast to deva]{śrīrāman}
+% \transliterate[iast to deva]{ś}
+% \transliterate[iast to deva]{śra}
+% \transliterate[iast to deva]{​arkau}
+% \transliterate[iast to deva]{kāvikrato}
+% \transliterate[iast to deva]{saṅkulam}
+% \transliterate[iast to deva]{sundaraṁ}
+% \transliterate[iast to deva]{bhirarkiṇaḥ}
+% \transliterate[iast to deva]{bhirarkkiṇaḥ}
+% \transliterate[iast to deva]{karkki khārkki}
+% \transliterate[iast to deva]{cacchā}
+% \transliterate[iast to deva]{karkki khakhārkki "kr"}
+% \transliterate[iast to deva]{i‍​ast śrotṝn}
+% \transliterate[iast to deva]{test ati krarkkṛ au}
+% \stoplines
%
-% \setuphead[ChapterB][commandbefore=\setups{s-to-l}]
+% सङ्कुलम्​ श्रीरामन् निश्चितवन्तः इदम् अद्भुतम् ऐ
%
-% \startChapterA[title={АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}]
-% \stopChapterA
+% \transliterate [deva to iast] {सौन्दर्य सुन्दर सुंदर सौंदर्य आनन्दः कर्तृत्त्व
+% सिद्धम् सिद्धं बद्धैः भकार शब्दः बभ्रूवाहन गरुडवाहनन् सान्द्रानन्दावबोधात्मकं।
+% auṣadhi madhumattamaḥ इअस्त षट्त्रिंशत् तीर्थास्पदं शिवविरिञ्चिनुतं शरण्यं
+% ऐन्द्र पर्व अभ्यर्च्चैर चँद्रम् सदाऽत्मा, "तेस्त"
%
-% \startChapterB[title={АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}]
-% \stopChapterB
+% अ॒ग्निमी᳚ळे पुरोहि॑तम्
+% खखार्क्कि क्रर्क्कृ
+% }
%
% \stoptext
diff --git a/tex/context/base/mkxl/math-acc.mklx b/tex/context/base/mkxl/math-acc.mklx
index 2201ed886..4dc70055a 100644
--- a/tex/context/base/mkxl/math-acc.mklx
+++ b/tex/context/base/mkxl/math-acc.mklx
@@ -308,6 +308,24 @@
\aliased\let\mathring\ring % for a while
+% \permanent\protected\def\not#1{\Umathaccent class \mathordinarycode exact overlay 0 0 "338 {#1}}
+% \permanent\protected\def\not#1{\Umathaccent class \mathrelationcode exact overlay 0 0 "338 {#1}}
+% \permanent\protected\def\not#1{\Umathaccent class \mathbinarycode exact overlay 0 0 "338 {#1}}
+%
+% \definemathcommand[slashD][ordinary]{\Umathaccent class \mathordinarycode exact overlay 0 0 "338 {D}}
+% \definemathcommand[slashD][ordinary]{\Umathaccent class \mathordinarycode center overlay 0 0 "338 {D}}
+
+\permanent\tolerant\protected\def\slashed[#1]#:#2%
+ {\Umathaccent
+ \s!class \mathcodechecked{#1}%
+ \s!center \space
+ \s!overlay\space
+ \zerocount \zerocount \forwardslashasciicode
+ {#2}} % exact when =
+
+% \definemathcommand[slashD]{\slashed[ordinary]{D}}
+% \definemathcommand[slashD]{\slashed{D}}
+
\popoverloadmode
\protect \endinput
diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt
index a5ad102ec..b0243719e 100644
--- a/tex/context/base/mkxl/math-act.lmt
+++ b/tex/context/base/mkxl/math-act.lmt
@@ -73,6 +73,17 @@ local d_scratchrightoffset = texisdimen("scratchrightoffset")
local use_math_goodies = true directives.register("math.nogoodies", function(v) use_math_goodies = not v end)
local checkitalics = false trackers .register("math.checkitalics", function(v) checkitalics = v end)
+local function registerdone(done,unicode)
+ if not trace_tweaking then
+ done = true
+ elseif done then
+ done[unicode] = true
+ else
+ done = { [unicode] = true }
+ end
+ return done
+end
+
local mathfontparameteractions = sequencers.new {
name = "mathparameters",
arguments = "target,original",
@@ -789,13 +800,7 @@ do
end
ori.parts = prt
end
- if not trace_tweaking then
- done = true
- elseif done then
- done[k] = true
- else
- done = { [k] = true }
- end
+ done = registerdone(done,k)
end
end
feedback_tweak("wipevariants",target,original,done)
@@ -875,13 +880,7 @@ do
local t = mathgaps[nn] or nn
if t then
kerns[t] = vv * width
- if not trace_tweaking then
- done = true
- elseif done then
- done[t] = true
- else
- done = { [t] = true }
- end
+ done = registerdone(done,t)
end
end)
end
@@ -1108,13 +1107,7 @@ end
-- if a and a > 0 then
-- v.topanchor = a * factor
-- count = count + 1
--- if not trace_tweaking then
--- done = true
--- elseif done then
--- done[u] = true
--- else
--- done = { [u] = true }
--- end
+-- done = registerdone(done,u)
-- end
-- end
-- end
@@ -1189,13 +1182,7 @@ do
end
end
v.mathkerns = nil
- if not trace_tweaking then
- done = true
- elseif done then
- done[u] = true
- else
- done = { [u] = true }
- end
+ done = registerdone(done,u)
end
end
feedback_tweak("simplifykerns",target,original,done)
@@ -1271,13 +1258,7 @@ c.bottomanchor = width/2 -- maybe optional
okay = true
end
if okay then
- if not trace_tweaking then
- done = true
- elseif done then
- done[u] = true
- else
- done = { [u] = true }
- end
+ done = registerdone(done,u)
else
goto smaller
end
@@ -1371,16 +1352,7 @@ do
local w = c.width
if w and w ~= 0 then
c.topanchor = v * w
- if trace_tweaking then
- -- todo
- end
- if not trace_tweaking then
- done = true
- elseif done then
- done[u] = true
- else
- done = { [u] = true }
- end
+ done = registerdone(done,u)
end
end
end
@@ -1489,13 +1461,7 @@ do
local k = data.topright ; if k and k ~= 0 then chardata.topright = k * width end
local k = data.bottomleft ; if k and k ~= 0 then chardata.bottomleft = k * width end
local k = data.bottomright ; if k and k ~= 0 then chardata.bottomright = k * width end
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
end
local unicode = detail(characters,uc)
@@ -1534,13 +1500,7 @@ do
local k = data.right ; if k and k ~= 0 then chardata.rightmargin = k * width end
local k = data.top ; if k and k ~= 0 then chardata.topmargin = k * total end
local k = data.bottom ; if k and k ~= 0 then chardata.bottommargin = k * total end
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
end
for unicode, data in next, margins do
@@ -1778,15 +1738,17 @@ do
function mathtweaks.addrules(target,original,parameters)
local characters = target.characters
local thickness = target.mathparameters.OverbarRuleThickness
- local width = target.parameters.emwidth / 2
local width = target.parameters.emwidth / 3
--- local step = 0.8 * width
- local step = 0.5 * width
+ local step = width / 2
+ local quarter = thickness / 4
+ local half = thickness / 2
+ local double = thickness * 2
+ local done = false
characters[0x203E] = { -- middle used for all kind
width = width,
- height = thickness / 2,
- depth = thickness / 2,
- yoffset = - thickness / 2,
+ height = half,
+ depth = half,
+ yoffset = - half,
unicode = 0x203E,
commands = { { "rule", thickness, width } },
parts = {
@@ -1802,7 +1764,7 @@ do
local right = rightarrow.parts
if left and right then
local leftline = right[1].glyph
- local rightline = left [#left].glyph
+ local rightline = left[#left].glyph
local leftdata = characters[leftline]
local rightdata = characters[rightline]
local leftwidth = leftdata.width
@@ -1827,6 +1789,7 @@ do
{ advance = rightwidth, glyph = rightline, ["end"] = .1*leftwidth, start = .9*rightwidth, extender = 1 },
}
result.partsorientation = "horizontal"
+ done = registerdone(done,target)
end
end
end
@@ -1835,63 +1798,79 @@ do
--
-- lucida lacks them ...
--
- local half = thickness / 2
- local double = thickness * 2
- --
if not characters[0x23B4] then
+ local depth = 0
+ local height = 5 * thickness
local tpiece = addprivate(target,"bracket-piece-top",{
width = thickness,
- height = half,
- depth = double,
- yoffset = - double,
- commands = { { "rule", thickness * 2.5, thickness } },
+ height = height,
+ depth = depth,
+ commands = { upcommand[thickness], { "rule", 4 * thickness, thickness } },
+ })
+ local mpiece = addprivate(target,"bracket-piece-top-middle",{
+ width = width,
+ height = height,
+ depth = depth,
+ commands = { upcommand[4*thickness], { "rule", thickness, width } },
})
characters[0x23B4] = { -- over
--- width = width,
- width = 2*thickness+width,
- height = half,
- depth = double,
+ width = double + width,
+ height = height,
+ depth = depth,
unicode = 0x23B4,
+extensible = false,
commands = {
slotcommand[0][tpiece],
- slotcommand[0][0x203E],
+ slotcommand[0][mpiece],
slotcommand[0][tpiece],
},
parts = {
- { advance = thickness, glyph = tpiece, ["end"] = 0, start = half },
- { advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 },
+ { advance = thickness, glyph = tpiece, ["end"] = 0, start = half },
+ { advance = width, glyph = mpiece, ["end"] = step, start = step, extender = 1 },
{ advance = thickness, glyph = tpiece, ["end"] = half, start = 0 },
},
partsorientation = "horizontal",
}
+ done = registerdone(done,0x23B4)
end
if not characters[0x23B5] then
+ local depth = 0
+ local height = 5 * thickness
local bpiece = addprivate(target,"bracket-piece-bottom",{
width = thickness,
- height = double,
- depth = half,
- yoffset = - half,
- commands = { { "rule", thickness * 2.5, thickness } },
+ height = height,
+ depth = depth,
+ yoffset = depth,
+ commands = { { "rule", 4 * thickness, thickness } },
+ })
+ local mpiece = addprivate(target,"bracket-piece-bottom-middle",{
+ width = width,
+ height = height,
+ depth = depth,
+ commands = { { "rule", thickness, width } },
})
characters[0x23B5] = { -- under
- width = 2*thickness+width,
- height = double,
- depth = half,
+ width = double + width,
+ height = height,
+ depth = depth,
unicode = 0x23B5,
+extensible = false,
commands = {
slotcommand[0][bpiece],
- slotcommand[0][0x203E],
+ slotcommand[0][mpiece],
slotcommand[0][bpiece],
},
parts = {
- { advance = thickness, glyph = bpiece, ["end"] = 0, start = half },
- { advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 },
+ { advance = thickness, glyph = bpiece, ["end"] = 0, start = half },
+ { advance = width, glyph = mpiece, ["end"] = step, start = step, extender = 1 },
{ advance = thickness, glyph = bpiece, ["end"] = half, start = 0 },
},
partsorientation = "horizontal",
}
+ done = registerdone(done,0x23B5)
end
--
+ feedback_tweak("rules",target,original,done)
end
-- vfmath.builders.extension(target)
@@ -2587,13 +2566,7 @@ do
depth = 0,
unicode = unicode,
}
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
feedback_tweak("wipecues",target,original,done)
end
@@ -2616,13 +2589,7 @@ do
local weirdone = characters[weird]
if normalone and weirdone and not normalone.next then
normalone.next = weirdone.next
- -- if not trace_tweaking then
- -- done = true
- -- elseif done then
- -- done[normal] = true
- -- else
- -- done = { [normal] = true }
- -- end
+ -- done = registerdone(done,normal)
end
weirdone = copytable(normalone)
characters[weird] = weirdone
@@ -2700,13 +2667,7 @@ else
stretchingdata.topanchor = topanchor
stretchingdata.commands = { rightcommand[width + topanchor], charcommand[stretching] }
end
- if not trace_tweaking then
- done = true
- elseif done then
- done[stretching] = true
- else
- done = { [stretching] = true }
- end
+ done = registerdone(done,stretching)
end
end
feedback_tweak("fixaccents",target,original,done)
@@ -2728,6 +2689,7 @@ end
local llx = b[1] * factor
local urx = b[3] * factor
-- if topanchor < 0 then
+data.advance = data.width
if true then
-- width = - topanchor
width = 2 * (topanchor - llx)
@@ -2739,7 +2701,6 @@ if true then
data.xoffset = -llx
else
width = urx - llx
- -- data.advance = urx
data.commands = {
leftcommand[llx],
slotcommand[0][unicode]
@@ -2749,13 +2710,7 @@ end
data.topanchor = width/2
data.bottomanchor = width/2
end
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
end
end
@@ -2799,13 +2754,7 @@ end
cnt = cnt + 1
end
if okay then
- if not trace_tweaking then
- done = true
- elseif done then
- done[stretching] = true
- else
- done = { [stretching] = true }
- end
+ done = registerdone(done,stretching)
end
end
end
@@ -2852,13 +2801,7 @@ characters[slot] = {
-- end
last.flataccent = slot
- if not trace_tweaking then
- done = true
- elseif done then
- done[stretching] = true
- else
- done = { [stretching] = true }
- end
+ done = registerdone(done,stretching)
end
code = last.next
if code then
@@ -2891,13 +2834,7 @@ characters[slot] = {
-- unicode = stretching, -- when we alias to combiners
unicode = alias, -- when we keep the original
}
- if not trace_tweaking then
- done = true
- elseif done then
- done[stretching] = true
- else
- done = { [stretching] = true }
- end
+ done = registerdone(done,stretching)
end
end
end
@@ -2917,13 +2854,7 @@ characters[slot] = {
local chardata = characters[unicode]
if chardata then
chardata.keepbase = true
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
end
else
@@ -3814,13 +3745,7 @@ do
local data = characters[unicode]
if data then
data.topovershoot = top * (quad or data.width or 0)
- if not trace_tweaking then
- done = true
- elseif done then
- done[r] = true
- else
- done = { [r] = true }
- end
+ done = registerdone(done,r)
end
end
end
diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl
index 7b61fd234..7fc95ac4b 100644
--- a/tex/context/base/mkxl/math-ali.mkxl
+++ b/tex/context/base/mkxl/math-ali.mkxl
@@ -44,6 +44,8 @@
\else
\displaywidth
\fi
+ -\leftskip
+ -\rightskip
\relax}
\permanent\def\maximizeddisplaywidth % larger than zero but within hsize
@@ -55,6 +57,8 @@
\else
\displaywidth
\fi
+ -\leftskip
+ -\rightskip
\relax}
%D \macros
@@ -698,21 +702,21 @@
\newconditional\c_math_alignment_local_number % not used but when true puts in front (todo)
\def\math_number_right_of_eqalign
- {\ifcase\wd\b_strc_formulas_number\else
+ {\ifcase\d_strc_formulas_number\else
\ifconditional\c_math_alignment_local_number
\ifcase\c_strc_math_number_location\or\or
- \box\b_strc_formulas_number
+ \strc_math_flush_number_box
\fi
\else
- \box\b_strc_formulas_number
+ \strc_math_flush_number_box
\fi
\fi}
\def\math_number_left_of_eqalign
- {\ifcase\wd\b_strc_formulas_number\else
+ {\ifcase\d_strc_formulas_number\else
\ifconditional\c_math_alignment_local_number
\ifcase\c_strc_math_number_location\or
- \box\b_strc_formulas_number
+ \strc_math_flush_number_box
\fi
\fi
\fi}
@@ -1021,12 +1025,12 @@
\ifmmode\stopimath\fi
\hfil
\aligntab
- \kern\mathcasesparameter\c!distance\relax % hskip
+ \kern\mathcasesparameter\c!distance\relax
\math_cases_strut % looks better
\aligncontent
\hfil
\aligntab
- \kern\mathcasesparameter\c!numberdistance\relax % hskip
+ \kern\mathcasesparameter\c!numberdistance\relax
\span\math_text_in_eqalign{\aligncontent}%
\crcr} % todo: number
@@ -1323,7 +1327,7 @@
\aligntab
\aligntab
\math_matrix_anchor
- \kern.5\d_math_eqalign_distance % hskip
+ \kern.5\d_math_eqalign_distance
\aligncontent
\aligntab
\global\advanceby\c_math_eqalign_column\plusone
@@ -1462,14 +1466,14 @@
\relax
\ifnum#1>\plusone
\localcontrolledloop\plustwo#1\plusone
- {\kern.125\d_math_eqalign_distance % hskip
+ {\kern.125\d_math_eqalign_distance
\hrule
\s!attr \mathalignmentvruleattribute\plusthree
\s!height\scratchdimen
\s!depth \scratchdimen
\relax}%
\kern-2\scratchdimen
- \kern-.125\d_math_eqalign_distance % hskip
+ \kern-.125\d_math_eqalign_distance
\fi
\scratchdistance\mathmatrixparameter\c!boffset\relax
\ifdim\scratchdistance>\zeropoint
@@ -1569,10 +1573,10 @@
% \permanent\tolerant\protected\def\math_matrix_VL[#1]#*%
% {\span\omit
% \ifconditional\c_math_matrix_first\else
-% \kern.5\d_math_eqalign_distance % hskip
+% \kern.5\d_math_eqalign_distance
% \fi
% \math_matrix_vertical_rule_yes{#1}%
-% \kern.5\d_math_eqalign_distance % hskip
+% \kern.5\d_math_eqalign_distance
% \global\setfalse\c_math_matrix_first
% \aligntab
% \boundary\c_math_matrix_vl_boundary
@@ -1582,11 +1586,11 @@
\def\math_matrix_VL_indeed#1#2%%
{\span\omit
\ifconditional\c_math_matrix_first\else
- \kern.5\d_math_eqalign_distance % hskip
+ \kern.5\d_math_eqalign_distance
\fi
\math_matrix_vertical_rule_yes{#2}%
\localcontrolledloop\plustwo#1\plusone
- {\kern.125\d_math_eqalign_distance % hskip
+ {\kern.125\d_math_eqalign_distance
\math_matrix_vertical_rule_yes{#2}}%
\kern.5\d_math_eqalign_distance
\global\setfalse\c_math_matrix_first
@@ -1601,10 +1605,10 @@
\permanent\tolerant\protected\def\math_matrix_NL[#1]#*%
{\span\omit
\ifconditional\c_math_matrix_first\else
- \kern.5\d_math_eqalign_distance % hskip
+ \kern.5\d_math_eqalign_distance
\fi
\math_matrix_vertical_rule_nop{#1}%
- \kern.5\d_math_eqalign_distance % hskip
+ \kern.5\d_math_eqalign_distance
\global\setfalse\c_math_matrix_first
\aligntab
\boundary\c_math_matrix_vl_boundary
@@ -1613,9 +1617,9 @@
\permanent\protected\def\math_matrix_NL_NR
{\ifnum\lastboundary=\c_math_matrix_vl_boundary
\ifconditional \c_math_matrix_sl_seen
- \kern-1.5\d_math_eqalign_distance % hskip
+ \kern-1.5\d_math_eqalign_distance
\else
- \kern-.5\d_math_eqalign_distance % hskip
+ \kern-.5\d_math_eqalign_distance
\fi
\fi
\math_matrix_anchor_last
@@ -2255,7 +2259,10 @@
{\defcsname\??mathinnerstart#1\endcsname{#2}%
\defcsname\??mathinnerstop #1\endcsname{#3}}
-\def\strc_math_flush_number_box{\box\b_strc_formulas_number}
+\def\strc_math_flush_number_box_normal{\box\b_strc_formulas_number}
+\def\strc_math_flush_number_box_visual{\ruledhbox{\box\b_strc_formulas_number}}
+
+\let\strc_math_flush_number_box\strc_math_flush_number_box_normal
% \newdimension \d_strc_math_display_width
% \newdimension \d_strc_math_indent
@@ -2283,7 +2290,7 @@
\def\strc_math_flush_aligned_boxed_direct_yes
{\dontleavehmode
\box\b_strc_math_display
- \llap{\box\b_strc_formulas_number}}
+ \llap{\strc_math_flush_number_box}}
\def\strc_math_flush_aligned_boxed_direct_nop
{\dontleavehmode
@@ -2291,119 +2298,217 @@
\def\strc_math_flush_aligned_left_number_indeed
{\ifvoid\b_strc_formulas_number\else
- \scratchwidth\wd\b_strc_formulas_number
- \setbox\b_strc_formulas_number\hbox to \displaywidth{\hss\hbox{\box\b_strc_formulas_number}}%
+ \setbox\b_strc_formulas_number\hbox to \displaywidth\bgroup
+ \hss
+ \hbox{\strc_math_flush_number_box}%
+ \egroup
\ifcase\c_strc_math_number_location\or
- \boxxoffset\b_strc_formulas_number\dimexpr-\displaywidth+\scratchwidth\relax
+ \boxxoffset\b_strc_formulas_number\dimexpr-\displaywidth+\d_strc_formulas_number+\s_strc_formulas_margin_left\relax % brrrrr
\boxyoffset\b_strc_formulas_number-\d_strc_math_first_height
\htdp\b_strc_formulas_number\zeropoint
- \box\b_strc_formulas_number % left
+ \strc_math_flush_number_box % left
\fi
\fi}
\def\strc_math_flush_aligned_right_number_indeed
{\ifvoid\b_strc_formulas_number\else
- \scratchwidth\wd\b_strc_formulas_number
- \setbox\b_strc_formulas_number\hbox to \displaywidth{\hss\hbox{\box\b_strc_formulas_number}}%
+ \setbox\b_strc_formulas_number\hbox to \displaywidth\bgroup
+ \hss
+ \hbox{\strc_math_flush_number_box}%
+ \egroup
\ifcase\c_strc_math_number_location\or\else
+ \boxxoffset\b_strc_formulas_number\dimexpr-\s_strc_formulas_margin_right\relax % brrrrr
\boxyoffset\b_strc_formulas_number\d_strc_math_last_depth
\htdp\b_strc_formulas_number\zeropoint
- \box\b_strc_formulas_number % right
+ \strc_math_flush_number_box % right
\fi
\fi}
-\protected\def\strc_math_flush_aligned_indeed
- {\ifcase\c_strc_math_ragged_status
- % align: error
- \strc_math_flush_aligned_boxed_direct_yes
- \or
- % align: flushleft, number right
- \strc_math_flush_aligned_boxed_direct_yes
- \or
- % align: middle
- \ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
- \leftskip \zeropoint
- \rightskip\zeropoint
- \strc_math_flush_aligned_boxed_direct_yes
- \orelse\ifnum\c_strc_math_split_mode=\c_strc_math_wrap_mode
- \dontleavehmode
- \vbox\bgroup
- \strc_math_flush_aligned_left_number_indeed
- \unvbox\b_strc_math_display
- \strc_math_flush_aligned_right_number_indeed
- \egroup
- \orelse\ifhmode
- % untested
- \dontleavehmode
- \strc_math_flush_aligned_left_number_indeed
- \box\b_strc_math_display
- \strc_math_flush_aligned_right_number_indeed
- \orelse\ifvbox\b_strc_math_display
+% \settrue\c_strc_math_ignore_number
+
+% cleanup timestamp: tales of time, joe bonamassa (live blu-ray in loop mode, 2023)
+
+\dimensiondef\d_strc_math_number_eps 5\scaledpoint
+
+% line mode
+
+\def\strc_math_flush_line_mode
+ {\ifcase\c_strc_math_ragged_status\or\or\hfill\or\hfill\fi
+ \box\b_strc_math_display
+ \ifcase\c_strc_math_ragged_status\or\hfill\or\hfill\or\fi}
+
+% wrap mode
+
+\def\strc_math_flush_wrap_mode
+ {\strc_math_setup_align_auto
+ \bgroup
+ \leftskip \zeropoint\relax
+ \rightskip\zeropoint\relax
+ \global\c_strc_math_positioning\plustwo
+ \dontleavehmode
+ \vbox\bgroup
\strc_math_flush_aligned_left_number_indeed
\unvbox\b_strc_math_display
\strc_math_flush_aligned_right_number_indeed
- \else
- % untested
- \dontleavehmode
- \strc_math_flush_aligned_left_number_indeed
- \box\b_strc_math_display
- \strc_math_flush_aligned_right_number_indeed
+ \egroup
+ \egroup
+ \ifvmode
+ \nointerlineskip
+ \fi}
+
+% flow mode
+
+\def\strc_math_flush_v_box_bottom
+ {\ifdone
+ \global\c_strc_math_positioning\number\plusfour2\relax
+ \unvbox\b_strc_math_display
+ \strc_math_flush_number_box
+ \else
+ \global\c_strc_math_positioning\number\plusfour3\relax
+ \unvbox\b_strc_math_display
+ \nointerlineskip
+ \ht\b_strc_formulas_number\zeropoint
+ \dp\b_strc_formulas_number\zeropoint
+ \boxyoffset\b_strc_formulas_number\d_strc_math_last_depth
+ \strc_math_flush_number_box % right
+ \prevdepth\d_strc_math_last_depth
+ \fi}
+
+\def\strc_math_flush_v_box_top
+ {\ifdone
+ \global\c_strc_math_positioning\number\plusfour5\relax
+ \dontleavehmode
+ \strc_math_flush_number_box
+ \unvbox\b_strc_math_display
+ \else
+ \scratchdepth\dp\b_strc_formulas_number
+ \global\c_strc_math_positioning\number\plusfour6\relax
+ \ht\b_strc_formulas_number\strutht
+ \dp\b_strc_formulas_number\strutdp
+ \dontleavehmode
+ \strc_math_flush_number_box % left
+ \vkern-\dimexpr\d_strc_math_first_height+\scratchdepth\relax
+ \unvbox\b_strc_math_display
+ \fi}
+
+\def\strc_math_flush_v_box_right
+ {\ifconditional\c_strc_math_ignore_number
+ \d_strc_formulas_number\zeropoint
+ \fi
+ \strc_formulas_start_side_box
+ \ifzeropt\d_strc_formulas_number
+ \global\c_strc_math_positioning\number\plusfour1\relax
+ \unvbox\b_strc_math_display
+ \else
+ % better verbose than compact so some overlap in code here
+ \ifcase\c_strc_math_number_variant\or
+ \s_strc_formulas_margin_right\zeropoint
\fi
- \or
- % align: flushright
- % packaged, number (kind of ugly as we now stick in the margin)
- \ifcase\c_strc_math_n_of_lines\or
- \dontleavehmode
- \kern-\wd\b_strc_formulas_number
- \box\b_strc_math_display
- \ifcase\c_strc_math_n_of_lines\or
- \box\b_strc_formulas_number
+ \setbox\b_strc_formulas_number\hbox to \displaywidth\bgroup
+ \hss
+ \strc_math_flush_number_box
+ \kern\s_strc_formulas_margin_right
+ \egroup
+ \ifcstok{\formulaparameter\c!order}\v!reverse
+ \ifdim\dimexpr\d_strc_math_first_right-\s_strc_formulas_margin_right\relax<\dimexpr\d_strc_formulas_number-\d_strc_math_number_eps\relax
+ \donetrue
\else
- \llap{\box\b_strc_formulas_number}%
+ \donefalse
\fi
- \orelse\iftrue % can become option
- \ifdim\d_strc_math_last_width>\wd\b_strc_formulas_number
- \ifdim\d_strc_math_max_width<\d_strc_math_last_width
- \strc_math_flush_aligned_boxed_direct_yes
- \else
- \dontleavehmode
- \kern-\wd\b_strc_formulas_number
- \box\b_strc_math_display
- \box\b_strc_formulas_number
- \fi
+ \strc_math_flush_v_box_top
+ \else
+ \ifdim\dimexpr\d_strc_math_last_right-\s_strc_formulas_margin_right\relax<\dimexpr\d_strc_formulas_number-\d_strc_math_number_eps\relax
+ \donetrue
+ \else
+ \donefalse
+ \fi
+ \strc_math_flush_v_box_bottom
+ \fi
+ \fi
+ \strc_formulas_stop_side_box}
+
+\def\strc_math_flush_v_box_left
+ {\ifconditional\c_strc_math_ignore_number
+ \d_strc_formulas_number\zeropoint
+ \fi
+ \strc_formulas_start_side_box
+ \ifzeropt\d_strc_formulas_number
+ \global\c_strc_math_positioning\number\plusfour4\relax
+ \unvbox\b_strc_math_display
+ \else
+ % better verbose than compact so some overlap in code here
+ \ifcase\c_strc_math_number_variant\or
+ \s_strc_formulas_margin_left\zeropoint
+ \fi
+ \setbox\b_strc_formulas_number\hbox to \displaywidth\bgroup
+ \kern\s_strc_formulas_margin_left
+ \strc_math_flush_number_box
+ \hss
+ \egroup
+ \ifcstok{\formulaparameter\c!order}\v!reverse
+ \ifdim\dimexpr\d_strc_math_last_left-\s_strc_formulas_margin_left\relax<\dimexpr\d_strc_formulas_number-\d_strc_math_number_eps\relax
+ \donetrue
\else
- % delay number till later
- \strc_math_flush_aligned_boxed_direct_nop
+ \donefalse
\fi
+ \strc_math_flush_v_box_bottom
\else
- % delay number till later
- \strc_math_flush_aligned_boxed_direct_nop
+ \ifdim\dimexpr\d_strc_math_first_left-\s_strc_formulas_margin_left\relax<\dimexpr\d_strc_formulas_number-\d_strc_math_number_eps\relax
+ \donetrue
+ \else
+ \donefalse
+ \fi
+ \strc_math_flush_v_box_top
\fi
\fi
+ \strc_formulas_stop_side_box}
+
+\def\strc_math_flush_h_mode
+ {\global\c_strc_math_positioning\plusthree
+ \dontleavehmode
+ \strc_math_flush_aligned_left_number_indeed
+ \box\b_strc_math_display
+ \strc_math_flush_aligned_right_number_indeed}
+
+\def\strc_math_flush_h_box
+ {\global\c_strc_math_positioning\plusfive
+ \dontleavehmode
+ \strc_math_flush_aligned_left_number_indeed
+ \box\b_strc_math_display
+ \strc_math_flush_aligned_right_number_indeed}
+
+\def\strc_math_flush_text_mode
+ {\strc_math_setup_align_auto
+ \bgroup
+ \leftskip \zeropoint\relax
+ \rightskip\zeropoint\relax
+ \ifhmode
+ % nil the tracing
+ \strc_math_flush_h_mode
+ \orelse\ifvbox\b_strc_math_display
+ \ifnum\c_strc_math_number_location=\plusone
+ \strc_math_flush_v_box_left
+ \else
+ \strc_math_flush_v_box_right
+ \fi
+ \else
+ % nil the tracing, might never happen
+ \strc_math_flush_h_box
+ \fi
+ \egroup
\ifvmode
- \nointerlineskip
+ \nointerlineskip
\fi}
-\protected\def\strc_math_flush_aligned_simple
- {\ifcase\c_strc_math_ragged_status\or\or\hfill\or\hfill\fi
- \box\b_strc_math_display
- \ifcase\c_strc_math_ragged_status\or\hfill\or\hfill\or\fi}
+% all modes:
\protected\def\strc_math_flush_aligned
{\ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
- \strc_math_flush_aligned_simple
- \orelse\ifconditional\c_strc_math_indent
- % in this case the already set text align is overloaded
- \strc_math_setup_align_auto
- \strc_math_flush_aligned_indeed
+ \strc_math_flush_line_mode
+ \orelse\ifnum\c_strc_math_split_mode=\c_strc_math_wrap_mode
+ \strc_math_flush_wrap_mode
\else
- % normally we don't end up here
- \strc_math_setup_spacing_aligned\mathalignmentparameter
- \begingroup
- \forgetall
- \unhbox\b_strc_math_display
- \par
- \endgroup
+ \strc_math_flush_text_mode
\fi}
\def\strc_math_flush_box_normal
@@ -2566,9 +2671,9 @@
\protected\def\d_strc_math_total_display_width
{\dimexpr
- \d_strc_math_display_width+\wd\b_strc_formulas_number
+ \d_strc_math_display_width+\d_strc_formulas_number
\ifconditional\c_strc_formulas_overlay_number
- \ifcase\c_strc_math_ragged_status\or\or+\wd\b_strc_formulas_number\or\fi
+ \ifcase\c_strc_math_ragged_status\or\or+\d_strc_formulas_number\or\fi
\fi
\relax}
@@ -2598,9 +2703,9 @@
\fi
% still ok?
\ifnum\c_strc_math_ragged_status=\plustwo
- \d_strc_math_framed_width\dimexpr\displaywidth-2\wd\b_strc_formulas_number\relax
+ \d_strc_math_framed_width\dimexpr\displaywidth-2\d_strc_formulas_number\relax
\else
- \d_strc_math_framed_width\dimexpr\displaywidth- \wd\b_strc_formulas_number\relax
+ \d_strc_math_framed_width\dimexpr\displaywidth- \d_strc_formulas_number\relax
\fi}
\let\strc_math_number_check_inside\strc_math_number_check_outside
@@ -2638,17 +2743,27 @@
\defcsname\??mathboxlocation\v!left \endcsname
{\c_strc_math_number_location\plusone}
-\defcsname\??mathboxlocation\v!flushright\endcsname
- {\c_strc_math_number_location\plusone}
\defcsname\??mathboxlocation\v!right\endcsname
{\c_strc_math_number_location\plustwo}
-\defcsname\??mathboxlocation\v!flushleft\endcsname
- {\c_strc_math_number_location\plustwo}
+
+\defcsname\??mathboxlocation\v!atleftmargin\endcsname
+ {\c_strc_math_number_location\plusone
+ \ifzeropt\s_strc_formulas_margin_left
+ % this can be a helper as now mixed in math-ali
+ \parinitleftskip\zeropoint
+ \else
+ \c_strc_math_number_variant \plusone
+ \fi}
\defcsname\??mathboxlocation\v!atrightmargin\endcsname
{\c_strc_math_number_location\plustwo
- \c_strc_math_number_variant \plusone}
+ \ifzeropt\s_strc_formulas_margin_right
+ % this can be a helper as now mixed in math-ali
+ \parfillrightskip\zeropoint
+ \else
+ \c_strc_math_number_variant \plusone
+ \fi}
\protected\def\strc_math_box_start#1%
{\c_strc_math_ragged_status#1\relax % already set
@@ -2687,24 +2802,28 @@
\hbox to \displaywidth \bgroup
\else
\bgroup
- \strc_math_show_margins
\fi
\ifcase\c_strc_math_number_location
\strc_math_flush_box
\or % number left
- \ifzeropt\wd\b_strc_formulas_number
+ \ifzeropt\d_strc_formulas_number
\strc_math_flush_number_no
\else
\strc_math_flush_number_left
\fi
\else % number right
- \ifzeropt\wd\b_strc_formulas_number
+ \ifzeropt\d_strc_formulas_number
\strc_math_flush_number_no
\else
\strc_math_flush_number_right
\fi
\fi
- \egroup}
+ \egroup
+ \ifnum\c_strc_math_split_mode=\c_strc_math_flow_mode
+ \ifhmode \else
+ \strc_math_show_margins
+ \fi
+ \fi}
\defineinnermathhandler\v!left {\strc_math_box_start\plusthree}{\strc_math_box_stop}
\defineinnermathhandler\v!flushright{\strc_math_box_start\plusthree}{\strc_math_box_stop}
@@ -2762,7 +2881,7 @@
\fi
\fi
\else
- % \box\b_strc_formulas_number
+ % \strc_math_flush_number_box
% \hfill
\strc_math_flush_aligned % we flush in here, otherwise wrong positioning of number (we need to unvbox)
\fi}
@@ -2789,7 +2908,7 @@
\else
\strc_math_flush_aligned
% \hfill
- % \box\b_strc_formulas_number % we flush in here
+ % \strc_math_flush_number_box % we flush in here
\fi}
%D Some inline math tweak.
@@ -2821,8 +2940,8 @@
\setupmathematics
[\c!textdistance=\zeropoint]
-%D This is an experiment. No fancy spacing and alignments here. If we ever
-%D go that route it might result in incompatible rendering.
+%D This is an experiment. No fancy spacing and alignments here. If we ever go that
+%D route it might result in incompatible rendering.
\permanent\protected\def\startsplitformula
{\ifhmode
@@ -2972,7 +3091,7 @@
\ifzeropt\scratchdimen\else\kern\scratchdimen\fi
\setbox\scratchbox\hbox{\mathsimplealignparameter\c!text}%
\ifvoid\scratchbox\else
- \kern\mathsimplealignparameter\c!textdistance % hskip
+ \kern\mathsimplealignparameter\c!textdistance
\vcenter{\box\scratchbox}%
\fi
\egroup
diff --git a/tex/context/base/mkxl/math-frc.mkxl b/tex/context/base/mkxl/math-frc.mkxl
index 7e6f7c5ce..b7d2e2902 100644
--- a/tex/context/base/mkxl/math-frc.mkxl
+++ b/tex/context/base/mkxl/math-frc.mkxl
@@ -716,12 +716,12 @@
\defcsname\??mathalignsimple\v!split:\v!flushleft\endcsname#1%
{#1%
- \ifchkdim\mathfractionparameter\c!distance\or\hskip\lastchkdim\fi
+ \ifchkdim\mathfractionparameter\c!distance\or\hkern\lastchkdim\fi
\hfill}
\defcsname\??mathalignsimple\v!split:\v!flushright\endcsname#1%
{\hfill
- \ifchkdim\mathfractionparameter\c!distance\or\hskip\lastchkdim\fi
+ \ifchkdim\mathfractionparameter\c!distance\or\hkern\lastchkdim\fi
\mathatom \s!class \mathordcode \s!unroll {}% prevents +/- seen as sign, unroll prevents empty box
#1}
@@ -860,7 +860,7 @@
% \raise
% \Umathskewedfractionvgap\textstyle
% \hbox\bgroup
-% $\scriptstyle#1\hskip\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax$%
+% $\scriptstyle#1\hkern\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax$%
% \egroup
% \hbox to \zeropoint\bgroup
% \hss$\textstyle/$\hss
@@ -868,7 +868,7 @@
% \lower
% \Umathskewedfractionvgap\textstyle
% \hbox\bgroup
-% $\hskip\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax\scriptstyle#2$%
+% $\hkern\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax\scriptstyle#2$%
% \egroup
% }
%
@@ -876,7 +876,7 @@
% \raise
% \Umathskewedfractionvgap\textstyle
% \hbox\bgroup
-% $\scriptstyle#1\hskip\dimexpr\Umathskewedfractionhgap\textstyle/2\relax$%
+% $\scriptstyle#1\hkern\dimexpr\Umathskewedfractionhgap\textstyle/2\relax$%
% \egroup
% \hbox to \zeropoint\bgroup
% \hss$\textstyle/$\hss
@@ -884,7 +884,7 @@
% \lower
% \Umathskewedfractionvgapskewedfractionvgap\textstyle
% \hbox\bgroup
-% $\hskip\dimexpr\Umathskewedfractionhgap\textstyle/2\relax\scriptstyle#2$%
+% $\hkern\dimexpr\Umathskewedfractionhgap\textstyle/2\relax\scriptstyle#2$%
% \egroup
% }
%
diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl
index f9b733d9c..eb3801a9b 100644
--- a/tex/context/base/mkxl/math-ini.mkxl
+++ b/tex/context/base/mkxl/math-ini.mkxl
@@ -55,12 +55,22 @@
\newdimension \mathstrutdp
\newinteger \mathnestinglevel
+\newcount \c_math_strc_hangafter
+\newdimen \d_math_strc_hangindent
+
\newcount \c_strc_math_n_of_lines
-\newdimension \d_strc_math_max_width
-\newdimension \d_strc_math_first_width
-\newdimension \d_strc_math_last_width
+
+\newdimension \d_strc_math_max_right
+\newdimension \d_strc_math_first_right
+\newdimension \d_strc_math_last_right
+
+\newdimension \d_strc_math_max_left
+\newdimension \d_strc_math_first_left
+\newdimension \d_strc_math_last_left
+
\newdimension \d_strc_math_first_height
\newdimension \d_strc_math_last_depth
+
\newdimension \d_strc_math_display_width
\newdimension \d_strc_math_indent
\newconditional\c_strc_math_indent
@@ -519,11 +529,17 @@
% +\preferdelimiterdimensionsclassoptioncode
\relax
+% \showmakeup[penalty]
+%
+% \preinlinepenalty 23 \postinlinepenalty 56 x$xx$x\par x$x$x\par x$x^2$x\par x$!$x\par
+% \preshortinlinepenalty 123 \postshortinlinepenalty456 x$xx$x\par x$x$x\par x$x^2$x\par x$!$x\par
+
\setmathoptions\mathordinarycode\numexpr
\noitaliccorrectionclassoptioncode
% +\checkligatureclassoptioncode
+\checkkernpairclassoptioncode
% +\flattenclassoptioncode
+ +\shortinlineclassoptioncode
\relax
\setmathoptions\mathoperatorcode\numexpr
@@ -671,6 +687,24 @@
+\preferdelimiterdimensionsclassoptioncode
\relax
+% MS will check
+
+\setmathoptions\mathexponentialcode\numexpr
+ \shortinlineclassoptioncode
+\relax
+
+\setmathoptions\mathimaginarycode\numexpr
+ \shortinlineclassoptioncode
+\relax
+
+\setmathoptions\mathdifferentialcode\numexpr
+ \shortinlineclassoptioncode
+\relax
+
+\setmathoptions\mathdigitcode\numexpr
+ \shortinlineclassoptioncode
+\relax
+
% test case for \lefttopkernclassoptioncode and \leftbottomkernclassoptioncode in cambria close:
%
% \setupbodyfont[cambria]
@@ -1990,6 +2024,7 @@
\edef\p_limits{\mathfunctionparameter\c!mathlimits}%
\mathatom
mathfont
+ single % behave like a character
class \mathfunctioncode
\ifx\p_limits\v!no
nolimits
diff --git a/tex/context/base/mkxl/math-map.lmt b/tex/context/base/mkxl/math-map.lmt
index 0bd75d748..8c1459ace 100644
--- a/tex/context/base/mkxl/math-map.lmt
+++ b/tex/context/base/mkxl/math-map.lmt
@@ -10,9 +10,7 @@ if not modules then modules = { } end modules ['math-map'] = {
-- persian: we will also provide mappers for other scripts
-- todo : alphabets namespace
-- maybe : script/scriptscript dynamic,
--- check : (U+2202,U+1D715) : upright
--- (U+2202,U+1D715) : italic
--- (U+2202,U+1D715) : upright
+-- check : (U+2202,U+1D715) : upright / italic
-- add them to the regular vectors below so that they honor \it etc
local type, next = type, next
diff --git a/tex/context/base/mkxl/math-spa.lmt b/tex/context/base/mkxl/math-spa.lmt
index a575b1714..6cd3b467e 100644
--- a/tex/context/base/mkxl/math-spa.lmt
+++ b/tex/context/base/mkxl/math-spa.lmt
@@ -18,8 +18,8 @@ local glue_code = nodes.nodecodes.glue
local line_code = nodes.listcodes.line
local ghost_code = nodes.listcodes.ghost
local middle_code = nodes.listcodes.middle
-local leftskip_code = nodes.gluecodes.leftskip
-local rightskip_code = nodes.gluecodes.rightskip
+----- leftskip_code = nodes.gluecodes.leftskip
+----- rightskip_code = nodes.gluecodes.rightskip
local nuts = nodes.nuts
local tonut = nodes.tonut
@@ -64,16 +64,19 @@ local stages = { }
local initial = { }
local c_strc_math_n_of_lines = texiscount("c_strc_math_n_of_lines")
-local d_strc_math_max_width = texisdimen("d_strc_math_max_width")
-local d_strc_math_first_width = texisdimen("d_strc_math_first_width")
-local d_strc_math_last_width = texisdimen("d_strc_math_last_width")
+local d_strc_math_max_right = texisdimen("d_strc_math_max_right")
+local d_strc_math_first_right = texisdimen("d_strc_math_first_right")
+local d_strc_math_last_right = texisdimen("d_strc_math_last_right")
+local d_strc_math_max_left = texisdimen("d_strc_math_max_left")
+local d_strc_math_first_left = texisdimen("d_strc_math_first_left")
+local d_strc_math_last_left = texisdimen("d_strc_math_last_left")
local d_strc_math_first_height = texisdimen("d_strc_math_first_height")
local d_strc_math_last_depth = texisdimen("d_strc_math_last_depth")
local d_strc_math_indent = texisdimen("d_strc_math_indent")
local report = logs.reporter("mathalign")
-local trace = false trackers.register("mathalign",function(v) trace = v end )
+local trace = false trackers.register("math.align",function(v) trace = v end )
local function moveon(s)
for n, id, subtype in nextnode, getnext(s) do
@@ -134,7 +137,8 @@ stages[1] = function(specification,stage)
local p = n
while p do
if getid(p) == penalty_code and getpenalty(p) == -10000 then
- local d = distance + getdimensions(p,n)
+ local w = getdimensions(p,n)
+ local d = distance + w
f[2] = d
f[3] = p
if d > max then
@@ -150,7 +154,7 @@ stages[1] = function(specification,stage)
local w = f[2]
local d = i == 1 and (max-w) or -w
local k = newkern(d)
- local r = newstrutrule(0,2*65536,2*65536)
+ local r = newstrutrule(0,2*65536,2*65536) -- hm, this adds height and depth !
local s = moveon(f[3])
if trace then
report("row %i, width %p, delta %p",i,w,d)
@@ -185,15 +189,49 @@ end
stages[2] = function(specification,stage)
local head = getlist(getbox(specification.box))
local align = specification.alignstate
- local maxwidth = false
local cnt = 0
- local lastwidth = 0
+local maxwidth = false
+local firstwidth = 0
+local lastwidth = 0
+ local maxright = false
+ local firstright = false
+ local lastright = false
+ local maxleft = false
+ local firstleft = false
+ local lastleft = false
local firstheight = 0
local lastdepth = 0
+ local linenumber = 0
+ local rightmargin = specification.rightmargin
+ if trace then
+ report("stage 2")
+ end
for n, id, subtype, list in nextlist, head do
if subtype == line_code then
local t = getnormalizedline(n)
- local m = t.rightskip + t.parfillrightskip
+ -- local m = t.rightskip + t.parfillrightskip
+ local l = t.leftskip + t.lefthangskip + t.parinitleftskip + t.parfillleftskip + t.indent
+ local r = t.rightskip + t.righthangskip + t.parinitrightskip + t.parfillrightskip
+ local w = getwidth(n)
+ local m = r
+ linenumber = linenumber + 1
+ if trace then
+ report("line %i, width %p, left %p, right %p, used %p",linenumber,w,l,r,w-l-r)
+ end
+ if not maxleft or m > maxleft then
+ maxleft = l
+ end
+ if not maxright or m > maxright then
+ maxright = r
+ end
+ if not firstleft then
+ firstleft = l
+ end
+ if not firstright then
+ firstright = r
+ end
+ lastleft = l
+ lastright = r
if not maxwidth then
maxwidth = m
firstheight = getheight(n)
@@ -206,25 +244,43 @@ stages[2] = function(specification,stage)
lastdepth = getdepth(n)
end
end
- if stage == 2 and (align == 2 or align == 3) then
+ local position = 0
+ if align == 1 then -- flushleft
+ if trace then
+ report("reposition %p, %s",0, "flush left")
+ -- todo
+ end
+ elseif align == 2 then -- middle
+ position = (maxwidth-rightmargin)/2
+ if trace then
+ report("reposition %p, %s",position, "center")
+ end
+ elseif align == 3 then -- flushright
+ position = maxwidth
+ if trace then
+ report("reposition %p, %s",maxwidth, "flush right")
+ end
+ end
+ if stage == 2 and position ~= 0 then
for n, id, subtype, list in nextlist, head do
- if subtype == line_code then
- if align == 1 then -- flushleft
- -- todo
- elseif align == 2 then -- middle
- reposition(n,maxwidth/2)
- elseif align == 3 then -- flushright
- reposition(n,maxwidth)
- end
- end
+ reposition(n,position)
end
+ firstleft = firstleft + position
+ lastleft = lastleft + position
+ maxleft = maxleft + position
+ firstright = firstright - position
+ lastright = lastright - position
+ maxright = maxright - position
end
texsetcount("global",c_strc_math_n_of_lines,cnt)
- texsetdimen("global",d_strc_math_max_width,maxwidth)
- texsetdimen("global",d_strc_math_first_width,firstwidth)
- texsetdimen("global",d_strc_math_last_width,lastwidth)
texsetdimen("global",d_strc_math_first_height,firstheight)
texsetdimen("global",d_strc_math_last_depth,lastdepth)
+ texsetdimen("global",d_strc_math_first_left,firstleft)
+ texsetdimen("global",d_strc_math_first_right,firstright)
+ texsetdimen("global",d_strc_math_last_left,lastleft)
+ texsetdimen("global",d_strc_math_last_right,lastright)
+ texsetdimen("global",d_strc_math_max_left,maxleft)
+ texsetdimen("global",d_strc_math_max_right,maxright)
end
stages[3] = stages[2]
@@ -249,6 +305,8 @@ interfaces.implement {
{ "height", "dimension" },
{ "depth", "dimension" },
{ "splitmethod" },
+ { "leftmargin", "dimension" },
+ { "rightmargin", "dimension" },
}
},
actions = function(specification)
diff --git a/tex/context/base/mkxl/mult-aux.mkxl b/tex/context/base/mkxl/mult-aux.mkxl
index 08d75a5b3..4940aaa04 100644
--- a/tex/context/base/mkxl/mult-aux.mkxl
+++ b/tex/context/base/mkxl/mult-aux.mkxl
@@ -65,10 +65,6 @@
%
% There can be less {} in the following definitions if we assume \??aa and \c!somecs
%
-% todo: \def\detokenized...parameter#1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2\endcsname}} % always root
-%
-% it might be more efficient to do this at the lua and
-%
% watch the push/pop and predefinition of current .. this is needed for nested
% definitions and overloaded defines using the predefined one
@@ -274,14 +270,15 @@
%D pre-expansion can be a bit faster but handly any effect on a normal run so let's
%D go for saving some memory.
-\def\mult_interfaces_detokenize{\expandafter\expandafter\expandafter\detokenize\expandafter\expandafter\expandafter}
+%def\mult_interfaces_detokenize{\expandafter\expandafter\expandafter\detokenize\expandafter\expandafter\expandafter}
\protected\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9%
{\frozen\def#3##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}%
\frozen\def#4##1##2{\ifcsname##1:##2\endcsname##1:##2\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}%
\frozen\edef#5##1##2{\noexpand\ifrelax##1\??empty\noexpand\else\noexpand#4##1{##2}\noexpand\fi}% is {} needed around ##1 ?
\frozen\def#6##1##2{\csname\ifcsname#1##1:##2\endcsname#1##1:##2\else\expandafter#5\csname#1##1:\s!parent\endcsname{##2}\fi\endcsname}%
- \frozen\def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2:##1\endcsname}}% always root, no backtrack
+ %\frozen\def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2:##1\endcsname}}% always root, no backtrack
+ \frozen\def#7##1{\expandafter\detokened\csname#1#2:##1\endcsname}% always root, no backtrack
\frozen\def#8##1{\begincsname#1#2:##1\endcsname}%
% TODO
\frozen\def#9##1##2{\expandafter\let\expandafter##1\csname\ifcsname#1#2:##2\endcsname#1#2:##2\else\expandafter#5\csname#1#2:\s!parent\endcsname{##2}\fi\endcsname}}
@@ -301,7 +298,8 @@
\expandafter\noexpand\csname letfrom#2parameter\endcsname}} % strict#2parameter is gone
\protected\def\mult_interfaces_install_root_parameter_handler#1#2#3%
- {\frozen\def#2##1{\detokenize\expandafter\expandafter\expandafter{\csname#1:##1\endcsname}}% always root
+ %{\frozen\def#2##1{\detokenize\expandafter\expandafter\expandafter{\csname#1:##1\endcsname}}% always root
+ {\frozen\def#2##1{\expandafter\detokened\csname#1:##1\endcsname}% always root
\frozen\def#3##1{\begincsname#1:##1\endcsname}}
\permanent\protected\def\installrootparameterhandler#1#2%
@@ -672,7 +670,8 @@
\protected\def\mult_interfaces_install_direct_parameter_handler#1#2#3#4#5%
{\frozen\def#3##1{\begincsname#1##1\endcsname}%
- \frozen\def#4##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}%
+ %\frozen\def#4##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}%
+ \frozen\def#4##1{\expandafter\detokened\csname#1##1\endcsname}%
\frozen\def#5##1{\begincsname#1##1\endcsname}}
\permanent\protected\def\installdirectparameterhandler#1#2%
diff --git a/tex/context/base/mkxl/mult-sys.mkxl b/tex/context/base/mkxl/mult-sys.mkxl
index b0df8703b..f40282cbd 100644
--- a/tex/context/base/mkxl/mult-sys.mkxl
+++ b/tex/context/base/mkxl/mult-sys.mkxl
@@ -326,6 +326,7 @@
\definesystemconstant {ordinary}
\definesystemconstant {orientation}
\definesystemconstant {otr}
+\definesystemconstant {overlay}
\definesystemconstant {pagefloat}
\definesystemconstant {page}
\definesystemconstant {paragraph}
@@ -625,6 +626,7 @@
\definefileconstant {page_run} {s-layout-show}
\definefileconstant {symb_run} {s-symbols-show}
\definefileconstant {publ_tra} {s-publications-show}
+\definefileconstant {math_run} {s-math-show}
%D For figure inclusion we need(ed):
diff --git a/tex/context/base/mkxl/node-ini.lmt b/tex/context/base/mkxl/node-ini.lmt
index 435f3bf7e..e0f92a930 100644
--- a/tex/context/base/mkxl/node-ini.lmt
+++ b/tex/context/base/mkxl/node-ini.lmt
@@ -53,6 +53,13 @@ local function simplified(t)
return r
end
+-- if environment.initex then
+-- local texintegerdef = tex.integerdef
+-- for i=1,#nodecodes do
+-- texintegerdef(nodecodes[i] .. "nodecode",i,"immutable")
+-- end
+-- end
+
-- local noadoptions = allocate {
-- set = 0x08,
-- unused_1 = 0x00 + 0x08,
diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt
index f17c5ce7a..4f7370e70 100644
--- a/tex/context/base/mkxl/node-nut.lmt
+++ b/tex/context/base/mkxl/node-nut.lmt
@@ -139,6 +139,7 @@ local nuts = {
getrightdelimiter = direct.getrightdelimiter,
getruledata = direct.getdata, -- obsolete when we have the split
getruledimensions = direct.getruledimensions,
+ setruledimensions = direct.setruledimensions,
getscale = direct.getscale,
getscales = direct.getscales,
getscript = direct.getscript,
diff --git a/tex/context/base/mkxl/node-ref.lmt b/tex/context/base/mkxl/node-ref.lmt
index 18bda16e9..0fb7836da 100644
--- a/tex/context/base/mkxl/node-ref.lmt
+++ b/tex/context/base/mkxl/node-ref.lmt
@@ -450,7 +450,7 @@ local colorize, justadd do
local typesetters = nuts.typesetters
if typesetters then
local hashes = fonts.hashes
- local infofont = fonts.infofont()
+ local infofont = fonts.infofont(true) -- small
local emwidth = hashes.emwidths [infofont]
local exheight = hashes.exheights[infofont]
if what == "reference" then
diff --git a/tex/context/base/mkxl/node-res.lmt b/tex/context/base/mkxl/node-res.lmt
index b514a3568..cb60e9915 100644
--- a/tex/context/base/mkxl/node-res.lmt
+++ b/tex/context/base/mkxl/node-res.lmt
@@ -70,11 +70,12 @@ local setwidth = nuts.setwidth
local setsubtype = nuts.setsubtype
local setleader = nuts.setleader
local setclass = nuts.setclass
-
local setdata = nuts.setdata
local setoffsets = nuts.setoffsets
local setvalue = nuts.setvalue
+local setruledimensions = nuts.setruledimensions
+
local copy_nut = nuts.copyonly
local new_nut = nuts.new
local flush_nut = nuts.flush
@@ -356,6 +357,8 @@ function nutpool.emptyrule(width,height,depth) -- w/h/d == nil will let them ada
return n
end
+-- data left right
+
function nutpool.strutrule(width,height,depth) -- w/h/d == nil will let them adapt
local n = copy_nut(strutrule)
if width or height or depth then
@@ -399,11 +402,10 @@ function nutpool.boxrule(width,height,depth) -- w/h/d == nil will let them adapt
return n
end
-function nutpool.virtualrule(width,height,depth) -- w/h/d == nil will let them adapt
+function nutpool.virtualrule(width,height,depth,data)
local n = copy_nut(virtualrule)
- if width or height or depth then
- setdata(n,width)
- setoffsets(n,nil,nil,height,depth)
+ if width or height or depth or data then
+ setruledimensions(n,width,height,depth,data)
end
return n
end
diff --git a/tex/context/base/mkxl/pack-cut.mkxl b/tex/context/base/mkxl/pack-cut.mkxl
index 772b2ba64..02347312e 100644
--- a/tex/context/base/mkxl/pack-cut.mkxl
+++ b/tex/context/base/mkxl/pack-cut.mkxl
@@ -96,11 +96,12 @@
\scratchskip \ifempty\cutmarkhoffset\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi
\vss
\hbox to \d_pack_cutmarks_width
- {\llap{\copy\scratchbox\hskip\scratchskip}%
- \hskip\scratchdimen\hss
+ {\llap{\copy\scratchbox\kern\scratchskip}%
+ \kern\scratchdimen\hss
\infofont#1%
- \hss\hskip\scratchdimen
- \rlap{\hskip\scratchskip\copy\scratchbox}}%
+ \hss
+ \kern\scratchdimen
+ \rlap{\kern\scratchskip\copy\scratchbox}}%
\vss}%
\hss}}
@@ -122,18 +123,18 @@
\hpack to \d_pack_cutmarks_width
{\scratchskip\ifempty\cutmarkhoffset\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi
\setbox\scratchbox\hpack{\verticalcuts}%
- \llap{\copy\scratchbox\hskip\scratchskip}%
+ \llap{\copy\scratchbox\kern\scratchskip}%
\ifzeropt\d_pack_cutmarks_depth
\hfill
\else
\bgroup
\setbox\scratchbox\hpack{\baselinecuts}%
- \llap{\copy\scratchbox\hskip\scratchskip}%
+ \llap{\copy\scratchbox\kern\scratchskip}%
\hfill
- \rlap{\hskip\scratchskip\copy\scratchbox}%
+ \rlap{\kern\scratchskip\copy\scratchbox}%
\egroup
\fi
- \rlap{\hskip\scratchskip\copy\scratchbox}}%
+ \rlap{\kern\scratchskip\copy\scratchbox}}%
\blap{\vskip\scratchskip\copy\scratchbox}}%
\ht\scratchbox\d_pack_cutmarks_height
\dp\scratchbox\d_pack_cutmarks_depth
diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl
index 1daa8bcf7..7ce169f42 100644
--- a/tex/context/base/mkxl/pack-rul.mkxl
+++ b/tex/context/base/mkxl/pack-rul.mkxl
@@ -1982,6 +1982,14 @@
\dp\b_framed_normal\d_framed_locator_dp
\hpack{\box\b_framed_normal}} % why do we pack .. danger of loosing?
+\installframedlocator \v!inline
+ {}
+ {\scratchoffset\dimexpr\strutdp+\d_framed_applied_offset\relax
+ \boxyoffset\b_framed_normal\dimexpr\boxyoffset\b_framed_normal-\scratchoffset\relax
+ \ht\b_framed_normal\dimexpr\ht\b_framed_normal-\scratchoffset\relax
+ \dp\b_framed_normal\dimexpr\strutdp+\d_framed_applied_offset\relax
+ \box\b_framed_normal}
+
% also used in fastlocalframed
\newdimension\d_framed_original_wd
@@ -2759,7 +2767,7 @@
{\setupframedtexts[\currentframedtext][#2]%
\doifsomething{#1}{\setframedtextparameter\c!location{#1}}% does not listen to #3
\setfalse\c_framed_text_location_none
- \csname\??framedtextlocation\framedtextparameter\c!location\endcsname
+ \begincsname\??framedtextlocation\framedtextparameter\c!location\endcsname
\resetframedtextparameter\c!location
\pack_framed_text_check
\setbox\b_framed_normal\vbox % \vpack
diff --git a/tex/context/base/mkxl/page-com.mkxl b/tex/context/base/mkxl/page-com.mkxl
index ae408f384..d492cb054 100644
--- a/tex/context/base/mkxl/page-com.mkxl
+++ b/tex/context/base/mkxl/page-com.mkxl
@@ -84,28 +84,28 @@
\defcsname\??pagecommentlocations\v!bottom\endcsname
{\setuplayout[\c!location=]%
- \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=\vss,\c!left=\hskip\d_page_comments_offset,\c!right=]%
+ \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=\vss,\c!left=\hkern\d_page_comments_offset,\c!right=]%
\d_page_comments_page_height\dimexpr\paperheight+2\d_page_comments_offset+\d_page_comments_distance+\d_page_comments_height\relax
\d_page_comments_page_width \dimexpr\paperwidth +2\d_page_comments_offset\relax
\defineoverlay[\v!pagecomment][\page_comments_top_bottom]}
\defcsname\??pagecommentlocations\v!top\endcsname
{\setuplayout[\c!location=]%
- \setuppapersize[\c!top=\vss,\c!bottom=\vskip\d_page_comments_offset,\c!left=\hskip\d_page_comments_offset,\c!right=]%
+ \setuppapersize[\c!top=\vss,\c!bottom=\vskip\d_page_comments_offset,\c!left=\hkern\d_page_comments_offset,\c!right=]%
\d_page_comments_page_height\dimexpr\paperheight+2\d_page_comments_offset+\d_page_comments_distance+\d_page_comments_height\relax
\d_page_comments_page_width \dimexpr\paperwidth +2\d_page_comments_offset\relax
\defineoverlay[\v!pagecomment][\page_comments_top_bottom]}
\defcsname\??pagecommentlocations\v!left\endcsname
{\setuplayout[\c!location=]%
- \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=,\c!left=\hss,\c!right=\hskip\d_page_comments_offset]%
+ \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=,\c!left=\hss,\c!right=\hkern\d_page_comments_offset]%
\d_page_comments_page_height\dimexpr\paperheight+2\d_page_comments_offset\relax
\d_page_comments_page_width \dimexpr\paperwidth +2\d_page_comments_offset+\d_page_comments_distance+\d_page_comments_width\relax
\defineoverlay[\v!pagecomment][\page_comments_left_right]}
\defcsname\??pagecommentlocations\v!right\endcsname
{\setuplayout[\c!location=]%
- \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=,\c!left=\hskip\d_page_comments_offset,\c!right =\hss]%
+ \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=,\c!left=\hkern\d_page_comments_offset,\c!right =\hss]%
\d_page_comments_page_height\dimexpr\paperheight+2\d_page_comments_offset\relax
\d_page_comments_page_width \dimexpr\paperwidth +2\d_page_comments_offset+\d_page_comments_distance+\d_page_comments_width\relax
\defineoverlay[\v!pagecomment][\page_comments_left_right]}
@@ -123,7 +123,7 @@
\vskip\d_page_comments_offset
\vss
\fi
- \hskip\d_page_comments_offset
+ \hkern\d_page_comments_offset
\vbox to \d_page_comments_height
{%\forgetall
\hsize\paperwidth
@@ -142,9 +142,9 @@
\protected\def\page_comments_left_right
{\hpack to \printpaperwidth
{\ifx\p_page_commands_location\v!right
- \hskip\dimexpr\paperwidth+\d_page_comments_distance+\d_page_comments_offset\relax
+ \hkern\dimexpr\paperwidth+\d_page_comments_distance+\d_page_comments_offset\relax
\else
- \hskip\d_page_comments_offset
+ \hkern\d_page_comments_offset
\hss
\fi
\vbox to \printpaperheight
@@ -158,9 +158,9 @@
\vss}%
\ifx\p_page_commands_location\v!right
\hss
- \hskip\d_page_comments_offset
+ \hkern\d_page_comments_offset
\else
- \hskip\dimexpr\paperwidth+\d_page_comments_distance+\d_page_comments_offset\relax
+ \hkern\dimexpr\paperwidth+\d_page_comments_distance+\d_page_comments_offset\relax
\fi}}
\permanent\protected\defcsname\e!start\v!pagecomment\endcsname
diff --git a/tex/context/base/mkxl/page-imp.mkxl b/tex/context/base/mkxl/page-imp.mkxl
index 4c192c554..e4c7a29ba 100644
--- a/tex/context/base/mkxl/page-imp.mkxl
+++ b/tex/context/base/mkxl/page-imp.mkxl
@@ -459,7 +459,7 @@
{\setbox\scratchbox\vpack to \arrangedpageY\paperheight
{\offinterlineskip
\vskip#4\paperheight
- \hskip#3\paperwidth
+ \hkern#3\paperwidth
\dorotatebox{\ifcase#2 0\else180\fi}\hpack{\box#1}%
\vfill}%
\wd\scratchbox\zeropoint
@@ -1272,10 +1272,10 @@
{\ifvoid\arrangedpageB\else
\unhbox\arrangedpageB
\ifdim\v_page_target_dx>\zeropoint
- \hskip\v_page_target_dx
+ \hkern\v_page_target_dx
\else
\hss
- \hskip\v_page_target_dx
+ \hkern\v_page_target_dx
\hss
\fi
\fi
@@ -1412,7 +1412,7 @@
\setbox#1\vpack
{\offinterlineskip
\vskip\d_page_boxes_v_shifts
- \hskip\d_page_boxes_h_shifts
+ \hkern\d_page_boxes_h_shifts
\box#1}%
\next}
diff --git a/tex/context/base/mkxl/page-mix.mkxl b/tex/context/base/mkxl/page-mix.mkxl
index 3d1179483..3da317956 100644
--- a/tex/context/base/mkxl/page-mix.mkxl
+++ b/tex/context/base/mkxl/page-mix.mkxl
@@ -98,7 +98,7 @@
\c!step=.25\lineheight, % needs some experimenting
%\c!splitmethod=\v!fixed, % will be default
\c!direction=\v!normal, % new (also todo in the new columnsets)
- \c!notes=\v!yes,
+ % \c!notes=\v!yes, % needs an update because now we flush weirdly inside the columns
\c!define=\v!yes,
\c!method=\ifinner\s!box\else\s!otr\fi] % automatic as suggested by WS
@@ -568,6 +568,8 @@
%D The common initialization:
+%D !!! todo: notes \automigrationmode\zerocount as well as notes=yes
+
\def\page_mix_initialize_columns
{\page_mix_enable_grid_snapping
%
@@ -584,7 +586,11 @@
\leftskip \zeropoint
\rightskip\zeropoint
%
- \doifelse{\mixedcolumnsparameter\c!notes}\v!yes\settrue\setfalse\c_page_mix_process_notes
+ \ifcstok{\mixedcolumnsparameter\c!notes}\v!yes
+ \settrue \c_page_mix_process_notes
+ \else
+ \setfalse\c_page_mix_process_notes
+ \fi
\ifconditional\c_page_mix_process_notes \else
\startpostponingnotes
\fi
@@ -606,7 +612,7 @@
\useblankparameter \mixedcolumnsparameter
\useprofileparameter\mixedcolumnsparameter % new
%
- \automigrationmode\zerocount % for now
+ \automigrationmode\zerocount % for now (see notes=yes)
%
\nofcolumns\c_page_mix_n_of_columns} % public
diff --git a/tex/context/base/mkxl/page-mrk.mkxl b/tex/context/base/mkxl/page-mrk.mkxl
index 597cff17d..380bbb980 100644
--- a/tex/context/base/mkxl/page-mrk.mkxl
+++ b/tex/context/base/mkxl/page-mrk.mkxl
@@ -73,7 +73,7 @@
l=\pagecutmarklength,o=\pagecutmarkoffset}%
\egroup
\wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
- \hskip-\scratchwidth\box\scratchbox}
+ \hkern-\scratchwidth\box\scratchbox}
\def\page_marks_add_marking
{\setlayoutcomponentattribute{\v!print:\v!marking}%
@@ -84,7 +84,7 @@
l=\pagecutmarklength,o=\pagecutmarkoffset}%
\egroup
\wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
- \hskip-\scratchwidth\box\scratchbox}
+ \hkern-\scratchwidth\box\scratchbox}
\def\page_marks_add_lines
{\setlayoutcomponentattribute{\v!print:\v!lines}%
@@ -96,7 +96,7 @@
x=\the\c_page_marks_nx,y=\the\c_page_marks_ny}%
\egroup
\wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
- \hskip-\scratchwidth\box\scratchbox}
+ \hkern-\scratchwidth\box\scratchbox}
\def\page_marks_add_number
{\setlayoutcomponentattribute{\v!print:\v!number}%
@@ -108,7 +108,7 @@
n=\number\ifcase\arrangeno\realpageno\else\arrangeno\fi}%
\egroup
\wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
- \hskip-\scratchwidth\box\scratchbox}
+ \hkern-\scratchwidth\box\scratchbox}
\def\page_marks_add_page_indeed#1%
{\setbox#1\hpack\bgroup
diff --git a/tex/context/base/mkxl/page-pcl.mkxl b/tex/context/base/mkxl/page-pcl.mkxl
index d6298982c..040cdb2ec 100644
--- a/tex/context/base/mkxl/page-pcl.mkxl
+++ b/tex/context/base/mkxl/page-pcl.mkxl
@@ -377,7 +377,7 @@
\global\setfalse\c_page_floats_flushing}
\def\page_floats_show_pack_state_indeed#1%
- {\llap{\smash{\backgroundline[black]{\strut\smallinfofont\white#1\space\the\nofcollectedfloats\space of\space\the\savednoffloats:\the\hsize}}\hskip.25\emwidth}}
+ {\llap{\smash{\backgroundline[black]{\strut\smallinfofont\white#1\space\the\nofcollectedfloats\space of\space\the\savednoffloats:\the\hsize}}\hkern.25\emwidth}}
\installtextracker
{floats.collecting}
diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl
index 3ed15ad98..c39dc179c 100644
--- a/tex/context/base/mkxl/publ-ini.mkxl
+++ b/tex/context/base/mkxl/publ-ini.mkxl
@@ -16,8 +16,6 @@
% TODO: s! vs v! for default and neutral key/values
% todo: too many refs in list
-% TODO A.-B. Foo (dash as connector, see JMH)
-
% todo: no need for all these %'s
% todo: tagging
@@ -428,6 +426,7 @@
\permanent\protected\def\btxcommabreak {\removeunwantedspaces,\hskip\zeropoint plus .5\emwidth\relax}
\permanent\protected\def\btxcolon {\removeunwantedspaces:\space}
\permanent\protected\def\btxsemicolon {\removeunwantedspaces;\space}
+\permanent\protected\def\btxhyphen {\removeunwantedspaces-}
\permanent\protected\def\btxlparent {\removeunwantedspaces\space(} % obsolete
\permanent\protected\def\btxrparent {\removeunwantedspaces)\space} % obsolete
\permanent\protected\def\btxleftparenthesis {\removeunwantedspaces\space(}
@@ -438,7 +437,6 @@
\permanent\protected\def\btxrightbracket {\removeunwantedspaces]\space}
\permanent\protected\def\btxrightbracketperiod {\removeunwantedspaces].\space}
\permanent\protected\def\btxrightbracketcomma {\removeunwantedspaces],\space}
-\permanent\protected\def\btxhyphen {\removeunwantedspaces-}
%D Variables:
@@ -1994,7 +1992,7 @@
\c!otherstext={\btxspace et al.},
\c!separator:firstnames={\btxspace},
\c!separator:juniors={\btxspace},
- \c!separator:vons={\btxspace},
+ \c!separator:vons={\btxnobreakspace},
\c!separator:initials={\btxspace},
\c!connector:initials={\btxhyphen},
\c!stopper:initials={.},
diff --git a/tex/context/base/mkxl/spac-ali.mkxl b/tex/context/base/mkxl/spac-ali.mkxl
index 9d9feab9b..ec8bffbc5 100644
--- a/tex/context/base/mkxl/spac-ali.mkxl
+++ b/tex/context/base/mkxl/spac-ali.mkxl
@@ -312,7 +312,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_one_fil % new
+ \parfillrightskip \s_zero_plus_one_fil % new
\setfalse \raggedonelinerstate % now here
\enforced\aliased\let\updateraggedskips\relax} % no need for adaption
@@ -327,7 +327,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -342,7 +342,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -357,7 +357,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_one_fil
+ \parfillrightskip \zeropoint % \s_zero_plus_one_fil
%\parindent \parindent
\relax}
@@ -371,7 +371,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -385,7 +385,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -399,7 +399,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
%\parindent \parindent
\relax}
@@ -414,7 +414,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -428,7 +428,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \zeropoint\s!plus\v_spac_align_fill_amount_double\relax
+ \parfillrightskip \zeropoint\s!plus\v_spac_align_fill_amount_double\relax
\parindent \zeropoint
\relax}
@@ -441,8 +441,8 @@
\xspaceskip \zeropoint
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
- \parfillskip \zeropoint
\parfillleftskip \zeropoint\s!plus\v_spac_align_fill_amount_extreme\relax
+ \parfillrightskip \zeropoint
\parindent \zeropoint
\relax}
@@ -457,7 +457,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \s_zero_plus_zero
%\parindent \parindent
\relax}
@@ -472,7 +472,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint\s!plus\v_spac_align_fill_amount_extreme\relax
\parfillleftskip \zeropoint\s!plus\v_spac_align_fill_amount_extreme\relax
- \parfillskip \zeropoint
+ \parfillrightskip \zeropoint
\parindent \zeropoint
\relax}
@@ -525,7 +525,8 @@
\else
\spac_align_set_horizontal_very_right
\fi
- \parfillskip\zeropoint
+ %\parfillleftskip\zeropoint
+ \parfillrightskip\zeropoint
\or
% 7 centered last line
\spac_align_set_horizontal_centered_last_line
@@ -534,7 +535,8 @@
\spac_align_set_horizontal_flushedright_last_line
\or
% 9 paragraph
- \parfillskip\zeropoint
+ %\parfillleftskip\zeropoint
+ \parfillrightskip\zeropoint
\or
% 10 slanted
\spac_align_set_horizontal_slanted
@@ -610,6 +612,7 @@
\c_spac_align_state_direction \zerocount % what is default ?
\c_spac_align_state_page \zerocount
\c_spac_align_state_par_fill \zerocount
+ \lastlinefit\zerocount
\ifcsname\??aligncommand\m_spac_align_named\endcsname
\lastnamedcs
\else
@@ -815,6 +818,8 @@
\defcsname\??aligncommand 1*\v!more\endcsname{\toksapp\t_spac_align_collected{\looseness\plusone}}
\defcsname\??aligncommand 2*\v!more\endcsname{\toksapp\t_spac_align_collected{\looseness\plustwo}}
+\defcsname\??aligncommand \v!fit\endcsname{\toksapp\t_spac_align_collected{\lastlinefit\plusone}}
+
%defcsname\??aligncommand ...\endcsname{\toksapp\t_spac_align_collected{\nopenalties}}
%defcsname\??aligncommand ...\endcsname{\toksapp\t_spac_align_collected{\setdefaultpenalties}}
@@ -839,7 +844,7 @@
\fi}
\protected\def\spac_align_flush_parfill_indeed#1%
- {\parfillskip
+ {\parfillrightskip
#1\directhspaceamount\v!final
% plus \dimexpr\availablehsize-#1\directhspaceamount\v!final\relax
plus 1fill
@@ -956,8 +961,8 @@
\defcsname\??alignhorizontal\v!flushright\endcsname{\enforced\let\raggedbox\spac_align_horizontal_flushright}
\defcsname\??alignhorizontal\v!center \endcsname{\enforced\let\raggedbox\spac_align_horizontal_center}
-% The next one can be in use so we keep it around but one should
-% be aware of possible interference.
+% The next one can be in use so we keep it around but one should be aware of
+% possible interference. But it will be removed at some point!
\permanent\protected\def\setraggedskips#1#2#3#4#5#6#7% never change this name (todo: inline this one .. less tracingall)
{\enforced\permanent\protected\def\updateraggedskips{\dosetraggedskips{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
@@ -994,7 +999,7 @@
\hsize \vsize
\leftskip \rightskip
\spaceskip \xspaceskip
- \parindent \parfillskip
+ \parindent \parfillrightskip
\hyphenpenalty \exhyphenpenalty \automatichyphenpenalty \explicithyphenpenalty
\displaywidowpenalty \widowpenalty \clubpenalty \brokenpenalty
\doublehyphendemerits \finalhyphendemerits \adjdemerits
@@ -1168,7 +1173,7 @@
% {\registerparwrapper
% {\v!word:\v!right}
% {\begingroup
-% \frozen\parfillskip \zeropoint
+% \frozen\parfillrightskip \zeropoint
% \frozen\finalhyphendemerits\zerocount
% \endgroup}
% {\doifelseparwrapper{\v!word:\v!right}%
@@ -1190,8 +1195,8 @@
{\registerparwrapper
{\v!word:\v!right}
{\begingroup
- \frozen\parfillskip \zeropoint
- \frozen\finalhyphendemerits\zerocount
+ \frozen\parfillrightskip \zeropoint % frozen ?
+ \frozen\finalhyphendemerits\zerocount % frozen ?
\endgroup}
{\doifelseparwrapper{\v!word:\v!right}{\unregisterparwrapper{\v!word:\v!right}}\donothing
\removeunwantedspaces
diff --git a/tex/context/base/mkxl/spac-hor.mkxl b/tex/context/base/mkxl/spac-hor.mkxl
index ab15e7a6e..853f4c902 100644
--- a/tex/context/base/mkxl/spac-hor.mkxl
+++ b/tex/context/base/mkxl/spac-hor.mkxl
@@ -19,7 +19,7 @@
\registerctxluafile{spac-hor}{autosuffix}
-\aliased\let\parfillrightskip\parfillskip
+\ifdefined\parfillrightskip\else \aliased\let\parfillrightskip\parfillskip \fi
\bitwiseflip \normalizelinemode \normalizelinenormalizecode
\bitwiseflip \normalizelinemode \parindentskipnormalizecode
diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl
index 640d493b9..79718cfb2 100644
--- a/tex/context/base/mkxl/spac-ver.mkxl
+++ b/tex/context/base/mkxl/spac-ver.mkxl
@@ -1782,12 +1782,12 @@
\hskip-.5\lineheight\relax
\ifcase\gridboxlinenomode\or
\rlap
- {\hskip\dimexpr.2\bodyfontsize+\scratchdimen\relax
+ {\kern\dimexpr.2\bodyfontsize+\scratchdimen\relax
\infofont\hbox to \emwidth{\hss\recurselevel}}%
\or
\llap
{\infofont\hbox to \emwidth{\hss\recurselevel}%
- \hskip.2\bodyfontsize}%
+ \kern.2\bodyfontsize}%
\fi
\vrule
\s!height \gridboxwidth
@@ -2225,10 +2225,10 @@
\scratchwidth\dimexpr\wd\nextbox+\scratchdistance\relax
\ifx\m_spac_hanging_location\v!right
\frozen\hangindent\ifconditional\displaylefttoright-\fi\scratchwidth
- \rlap{\hskip\dimexpr\hsize-\leftskip-\wd\nextbox\relax\box\nextbox}% \leftskip is new
+ \rlap{\kern\dimexpr\hsize-\leftskip-\wd\nextbox\relax\box\nextbox}% \leftskip is new
\else
\frozen\hangindent\ifconditional\displaylefttoright\else-\fi\scratchwidth
- \llap{\box\nextbox\hskip\scratchdistance}%
+ \llap{\box\nextbox\kern\scratchdistance}%
\fi
\ignorespaces}
diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl
index 3c6772dc0..b8d05fb33 100644
--- a/tex/context/base/mkxl/strc-mat.mkxl
+++ b/tex/context/base/mkxl/strc-mat.mkxl
@@ -29,7 +29,6 @@
%\c!numberstyle=,
%\c!numbercolor=,
%\c!numbercommand=,
- %\c!margin=,
%\c!align=,
%\c!separator=,
% \c!splitmethod=\v!both, % first|last|both|<empty>
@@ -44,12 +43,16 @@
\c!spaceafter=\formulaparameter\c!spacebefore,
\c!spaceinbetween=\v!quarterline,
\c!width=\hsize,
- \c!leftmargin=\zeropoint,
- \c!rightmargin=\zeropoint,
+ \c!margin=\zeropoint,
+ \c!leftmargin=\formulaparameter\c!margin,
+ \c!rightmargin=\formulaparameter\c!margin,
\c!indentnext=\v!no,
\c!alternative=\s!default,
\c!strut=\v!yes, % per 2022-04, was \v!no
\c!numberstrut=\v!yes, % \v!no \v!yes \v!always
+ \c!margindistance=\zeropoint,
+ \c!leftmargindistance=\formulaparameter\c!margindistance,
+ \c!rightmargindistance=\formulaparameter\c!margindistance,
\c!numberthreshold=\emwidth,
\c!numberdistance=2\emwidth]
@@ -341,6 +344,15 @@
{\begingroup
\rm % determines the distance and main font
\edef\p_location{\formulaparameter\c!location}%
+ \ifx\p_location\v!atrightmargin
+ \ifzeropt\s_strc_formulas_margin_right
+ \let\p_location\v!right
+ \fi
+ \orelse\ifx\p_location\v!atleftmargin
+ \ifzeropt\s_strc_formulas_margin_left
+ \let\p_location\v!left
+ \fi
+ \fi
\strc_formulas_show_references
\ifx\p_location\v!right
\strc_formulas_add_distance\plusone\v!left\formulaparameter
@@ -485,26 +497,6 @@
\theformuladestinationattribute\currentnestedformulaattribute
\fi}
-% \def\strc_formulas_handle_numbering_indeed
-% {\ifempty\namedformulaentry
-% \doifelsetext\currentnestedformulasuffix
-% {\strc_counters_increment\v!formula
-% \ifcstok{+}\currentnestedformulasuffix
-% \strc_counters_increment_sub\v!formula\plustwo
-% \else
-% \strc_counters_setown_sub\v!formula\plustwo\currentnestedformulasuffix
-% \fi}%
-% {\ifempty\currentplaceformulasuffix\else
-% \let\currentnestedformulasuffix \currentplaceformulasuffix
-% \let\currentnestedformulareference\currentplaceformulareference
-% \strc_formulas_place_number_nested_check
-% \fi
-% \strc_counters_increment\v!formula}%
-% \fi
-% \glettonothing\currentplaceformulasuffix
-% \glettonothing\currentnestedformulasuffix
-% \placecurrentformulanumber}
-
\def\strc_formulas_handle_numbering_indeed
{\ifempty\namedformulaentry
\doifelsetext\currentnestedformulasuffix
@@ -701,6 +693,7 @@
\newconditional\c_strc_formulas_packed
\newconditional\c_strc_formulas_depth
\newbox \b_strc_formulas_number
+\newdimen \d_strc_formulas_number
\def\strc_formulas_display_space_before_normal
{% not ok, try \stopformula\par\startformula vs \stopformula\startformula
@@ -857,7 +850,7 @@
\scratchdimentwo \ifconditional\c_strc_formulas_tight\formulaparameter\c!numberthreshold\else\zeropoint\fi\relax
\scratchdimenthree.5\exheight
\ifcase\scratchdimentwo\else\ifx#2\v!left
- \middlered
+ \darkred
\kern-\scratchdimentwo
\vrule
\s!height\scratchdimenthree
@@ -865,14 +858,14 @@
\s!width \scratchdimentwo
\fi\fi
\ifcase\scratchdimenone\else
- \ifcase#1\or\middlegreen\else\middleblue\fi
+ \ifcase#1\or\darkgreen\else\darkblue\fi
\vrule
\s!height\scratchdimenthree
\s!depth \scratchdimenthree
\s!width \scratchdimenone
\fi
\ifcase\scratchdimentwo\else\ifx#2\v!right
- \middlered
+ \darkred
\vrule
\s!height\scratchdimenthree
\s!depth \scratchdimenthree
@@ -960,11 +953,6 @@
\global\c_strc_math_split_mode\c_strc_math_flow_mode
\fi
\mathpenaltiesmode\plusone
- \ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
- \global\setfalse\c_strc_math_indent
- \else
- \global\settrue\c_strc_math_indent % otherwise no breaks
- \fi
\global\d_strc_math_indent\zeropoint}
\def\strc_math_set_number_location
@@ -1035,26 +1023,6 @@
\boundary\c_bndr_mathalign
\fi}
-% \tolerant\protected\def\strc_math_skip_here[#1]%
-% {% no strut as it will influence fences
-% \ifconditional\c_strc_math_trace_hang
-% \strc_math_trace_okay{darkblue}{S #1}%
-% \fi
-% \scratchdimen\dimexpr\formulaparameter\c!textmargin\relax
-% \ifchkdim#1\or
-% \d_strc_math_hang_state#1%
-% \orelse\ifchknum#1\or
-% \d_strc_math_hang_state#1\scratchdimen
-% \orelse\iftok{#1}{+}%
-% \advanceby\d_strc_math_hang_state\scratchdimen
-% \orelse\iftok{#1}{-}%
-% \advanceby\d_strc_math_hang_state-\scratchdimen
-% \else
-% \d_strc_math_hang_state\scratchdimen
-% \fi
-% \kern\d_strc_math_hang_state
-% \strc_math_pickup_again}
-
\newboundary\c_bndr_skiphere
\tolerant\protected\def\strc_math_skip_here[#1]%
@@ -1091,49 +1059,6 @@
%
% \blank[line] \ruledhbox{zzzz} \blank[line]
-% \tolerant\protected\def\strc_math_text_here[#1]#:#*#=%
-% {\ifparameter#2\or
-% \ifnum\lastboundary=\c_math_begin_boundary\else
-% \ifcstok{#1}\v!right\else
-% \strc_math_break_here
-% \fi
-% \fi
-% \vadjust
-% \ifcstok{#1}\v!before
-% pre
-% \orelse\ifcstok{#1}\v!left
-% pre
-% baseline
-% depth before -\thousandpoint
-% \orelse\ifcstok{#1}\v!right
-% post
-% baseline
-% \fi
-% \bgroup
-% \hbox to \displaywidth \bgroup
-% \strut
-% \ifcstok{#1}\v!right
-% \hfill#2%
-% \else
-% #2\hss
-% \fi
-% \strut
-% \egroup
-% \egroup
-% \ifcstok{#1}\v!right
-% \strc_math_break_here
-% \else
-% % \mathatom class \mathexplicitcode{}%
-% \strc_math_pickup_again
-% \fi
-% \orelse\ifcstok{#1}\v!page
-% \strc_math_page_here
-% \orelse\ifcstok{#1}\v!samepage
-% \strc_math_same_here
-% \else
-% \strc_math_break_here
-% \fi}
-
\definelocalboxes
[\v!lefttext]
[\c!command=\localmarginlefttext\zeropoint,
@@ -1152,10 +1077,10 @@
\installcorenamespace{mathbreakhere}
\def\strc_math_text_here_right#1%
- {\localbox[\v!righttext]{\llap{#1\kern\leftskip}}}
+ {\localbox[\v!righttext]{\llap{#1\kern\rightskip}}}
\def\strc_math_text_here_left#1%
- {\localbox[\v!lefttext]{\rlap{\kern\rightskip#1}}}
+ {\localbox[\v!lefttext]{\rlap{\kern\leftskip#1}}}
\def\strc_math_text_here_before#1%
{\vadjust pre \bgroup
@@ -1285,7 +1210,7 @@
\newconstant\c_strc_math_split_status
\prependtoks
- \c_strc_math_ragged_status\plustwo
+ \c_strc_math_ragged_status\plustwo % middle
\c_strc_math_split_status \zerocount
\to \everymathematics
@@ -1298,29 +1223,31 @@
{\raggedright
\mathgluemode\plustwo
\c_strc_math_ragged_status\plusone
+ \setfalse\c_strc_math_number_swapped
\updateparagraphproperties} % not needed
\defcsname\??mathtextalign\v!middle\endcsname
{\raggedcenter
\mathgluemode\plustwo
\c_strc_math_ragged_status\plustwo
+ \setfalse\c_strc_math_number_swapped
\updateparagraphproperties} % not needed
\defcsname\??mathtextalign\v!flushright\endcsname
{\raggedleft
\mathgluemode\plustwo
\c_strc_math_ragged_status\plusthree
+ \setfalse\c_strc_math_number_swapped
\updateparagraphproperties} % not needed
-\defcsname\??mathtextalign\v!slanted\endcsname
+\defcsname\??mathtextalign\v!slanted\endcsname % maybe move bottom to number location
{\raggedslanted
%\mathgluemode\plustwo
\c_strc_math_ragged_status\plustwo
- \ifcase\c_strc_math_number_location\or
- \parinitleftskip\wd\b_strc_formulas_number % should normally fit
- \else
- \parfillrightskip\wd\b_strc_formulas_number % should normally fit
- \fi
+ \edef\p_distance{\formulaparameter\c!leftmargindistance}%
+ \parinitleftskip \ifx\p_distance\v!number \wd\b_strc_formulas_number \else \p_distance \fi
+ \edef\p_distance{\formulaparameter\c!rightmargindistance}%
+ \parfillrightskip\ifx\p_distance\v!number \wd\b_strc_formulas_number \else \p_distance \fi
\updateparagraphproperties} % not needed
\def\strc_math_setup_align
@@ -1328,6 +1255,8 @@
\lastnamedcs\else\begincsname\??mathtextalign\v!middle\endcsname
\fi}
+% split : wrap (box) and flow (yes)
+
\defcsname\??mathtextalign\v!flushleft:\v!auto\endcsname
{\raggedright
\mathgluemode\plustwo
@@ -1335,14 +1264,14 @@
\strc_math_analyze_box}
\defcsname\??mathtextalign\v!middle:\v!auto\endcsname
- {\raggedright
- \mathgluemode\plustwo
- \c_strc_math_ragged_status\plustwo
- \strc_math_analyze_box}
+ {\raggedright % needed for the lua magick (stage 1)
+ \mathgluemode\plustwo % only shrink (otherwise inconsistent)
+ \c_strc_math_ragged_status\plustwo % needed for the lua magick (stage 2)
+ \strc_math_analyze_box} % lua magick
\defcsname\??mathtextalign\v!flushright:\v!auto\endcsname
{\raggedright
- \mathgluemode\plustwo
+ \mathgluemode\plustwo % only shrink
\c_strc_math_ragged_status\plusthree
\strc_math_analyze_box}
@@ -1391,25 +1320,30 @@
\appendtoks
\global\d_strc_math_indent \zeropoint
\global\c_strc_math_n_of_lines \zerocount
- \global\d_strc_math_max_width \zeropoint
- \global\d_strc_math_first_width \zeropoint
\global\d_strc_math_first_height\zeropoint
- \global\d_strc_math_last_width \zeropoint
+ \global\d_strc_math_first_left \zeropoint
+ \global\d_strc_math_first_right \zeropoint
+ \global\d_strc_math_last_left \zeropoint
+ \global\d_strc_math_last_right \zeropoint
\global\d_strc_math_last_depth \zeropoint
+ \global\d_strc_math_max_right \zeropoint
+ \global\d_strc_math_max_left \zeropoint
+ \global\d_math_strc_hangindent \zeropoint
+ \global\c_math_strc_hangafter \zeropoint
\to \everyresetformulas
\newbox\b_strc_math_display % most code is in math-ali (for historical reasons)
-\newgluespec\s_strc_formulas_margin_left
-\newgluespec\s_strc_formulas_margin_right
+\newgluespec\s_strc_formulas_margin_left % maybe just dimen
+\newgluespec\s_strc_formulas_margin_right % idem
\def\strc_formulas_set_paragraph
{%\setlocalhsize
%\hsize\localhsize
%
\d_strc_formulas_display_width\formulaparameter\c!width\relax
- \s_strc_formulas_margin_left \leftskip
- \s_strc_formulas_margin_right\rightskip
+% \s_strc_formulas_margin_left \leftskip
+% \s_strc_formulas_margin_right\rightskip
\edef\p_margin{\formulaparameter\c!leftmargin}%
\ifempty\p_margin \else
\doadaptleftskip\p_margin
@@ -1418,85 +1352,39 @@
\ifempty\p_margin \else
\doadaptrightskip\p_margin
\fi
- \edef\p_margin{\formulaparameter\c!margin}%
- \ifempty\p_margin \else
- \doadaptleftskip\p_margin
- \doadaptrightskip\p_margin
- \fi
- % this was lost
+% \edef\p_margin{\formulaparameter\c!margin}%
+% \ifempty\p_margin \else
+% \doadaptleftskip\p_margin
+% \doadaptrightskip\p_margin
+% \fi
+ \s_strc_formulas_margin_left \leftskip
+ \s_strc_formulas_margin_right\rightskip
\edef\p_interlinespace{\formulaparameter\c!interlinespace}%
\ifempty\p_interlinespace\else\baselineskip\p_interlinespace\fi
- % and is now back
\global\setfalse\c_strc_math_aligned_here
\hsize\d_strc_formulas_display_width
\displaywidth\hsize
\displayindent\zeropoint}
-% \def\strc_math_analyze_box
-% {\clf_handlemathhang
-% stage \plusone
-% alignstate \c_strc_math_ragged_status
-% box \b_strc_math_display
-% distance \formulaparameter\c!textdistance
-% \relax
-% %\holdingmigrations\zerocount
-% \setbox\b_strc_math_display\vbox\bgroup % \vtop
-% \ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
-% % we can't end up here
-% \orelse\ifconditional\c_strc_math_aligned_here
-% \ifzeropt\d_strc_math_indent\else
-% \hangafter\plusone
-% \hangindent\d_strc_math_indent
-% \fi
-% % \strc_math_setup_align % _inner
-% \else
-% \strc_math_setup_align
-% \fi
-% % \strc_math_setup_spacing\formulaparameter
-% \strc_math_setup_penalties
-% \unhbox\b_strc_math_display
-% \egroup
-% \clf_handlemathhang
-% stage \ifconditional\c_strc_math_aligned_here \plustwo \else \plusthree \fi
-% % alignstate \c_strc_math_ragged_status
-% % box \b_strc_math_display
-% % distance \formulaparameter\c!textdistance
-% \relax
-% %
-% \begingroup
-% \edef\v_spac_whitespace_current{\formulaparameter\c!spaceinbetween}%
-% \spac_whitespace_setup
-% \clf_handlemathhang
-% stage \plusfour
-% inbetween 1\parskip
-% height \strutht
-% depth \strutdp
-% \relax
-% \endgroup}
-
\def\strc_math_analyze_box
{\clf_handlemathhang
stage \plusone
alignstate \c_strc_math_ragged_status
box \b_strc_math_display
distance \formulaparameter\c!textdistance
+ leftmargin \the\dimexpr\s_strc_formulas_margin_left\relax
+ rightmargin \the\dimexpr\s_strc_formulas_margin_right\relax
\relax
%\holdingmigrations\zerocount
\setbox\b_strc_math_display\vbox\bgroup % \vtop
- \ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
- % we can't end up here
- \orelse\ifconditional\c_strc_math_aligned_here
+ % beware: everypar is doing sidefloats here so we then have hang values set
+ % but we have no local leftskip and rightskip as they are reflected in hsize
+ \strc_formulas_trigger_side_box
+ \ifconditional\c_strc_math_aligned_here
\ifzeropt\d_strc_math_indent\else
-% \ifnum\c_page_sides_hangafter=\zerocount
-% \hangafter\plusone
-% \hangindent\d_strc_math_indent
-% \else
- % this might become the default anyway:
- \advanceby\leftskip\d_strc_math_indent
- \hskip-\d_strc_math_indent
-% \fi
+ \advanceby\leftskip\d_strc_math_indent % which is why we see a leftskip reported !
+ \hskip-\d_strc_math_indent
\fi
- % \strc_math_setup_align % _inner
\else
\strc_math_setup_align
\fi
@@ -1523,49 +1411,34 @@
\relax
\endgroup}
-\def\strc_math_show_margins_there
- {\vadjust pre \bgroup
- \c_attr_visual\attributeunsetvalue
- \hbox to \hsize \bgroup
- \setbox\scratchbox\hbox to \hsize\bgroup
- \bgroup\darkred \vrule \s!width\leftskip \egroup\hss
- \bgroup\darkgray\leaders\vrule\hfill \egroup\hss
- \bgroup\white \vrule \s!width\emwidth \egroup\hss
- \bgroup\darkgray\leaders\vrule\hfill \egroup\hss
- \bgroup\darkblue\vrule \s!width\rightskip\egroup
- \egroup
- \ht\scratchbox1.2\exheight
- \dp\scratchbox0.4\exheight
- \strut
- \box\scratchbox
- \hskip-\hsize
- \hbox to \hsize \bgroup
- \white
- \infofont
- \hskip1\leftskip
- \quad
- \formulaparameter\c!split
- \quad
- \formulaparameter\c!align
- \egroup
- \egroup
- \egroup}
-
\let\strc_math_inject_show_margins_here\relax
-\def\strc_math_show_margins_indeed
- {\gdef\strc_math_inject_show_margins_here
- {\strc_math_show_margins_there
- \glet\strc_math_inject_show_margins_here\relax}%
- \appendtoks\strc_math_inject_show_margins_here\to\everypar}
+\integerdef\c_strc_math_positioning\zerocount
+
+%D For practical reasons this one is kept extern:
+
+\newconditional\c_strc_math_ignore_number % for testing space compatibility
+
+\fetchmodulecommand \showmathmargins \f!math_run
\installtextracker
{math.showmargins}
- {\let\strc_math_show_margins\strc_math_show_margins_indeed}
- {\let\strc_math_show_margins\relax}
+ {\def\strc_math_show_margins{\showmathmargins[\v!all]}%
+ \let\strc_math_flush_number_box\strc_math_flush_number_box_visual}
+ {\let\strc_math_show_margins\relax
+ \let\strc_math_flush_number_box\strc_math_flush_number_box_normal}
+
+\installtextracker
+ {math.showmargins.less}
+ {\def\strc_math_show_margins{\showmathmargins}%
+ \let\strc_math_flush_number_box\strc_math_flush_number_box_visual}
+ {\let\strc_math_show_margins\relax
+ \let\strc_math_flush_number_box\strc_math_flush_number_box_normal}
\let\strc_math_show_margins\relax
+%D Till here.
+
\def\strc_math_set_options#1%
{\setfalse\c_strc_formulas_tight
\setfalse\c_strc_formulas_packed
@@ -1583,8 +1456,46 @@
\rawprocesscommacommand[\p_option]\strc_formulas_option
\fi}
+% This is an experiment!
+
+% \lettonothing\strc_formulas_start_side_box
+% \lettonothing\strc_formulas_stop_side_box
+% \lettonothing\strc_formulas_check_side_box
+% \lettonothing\strc_formulas_trigger_side_box
+
+\newdimen\d_strc_math_side_width
+
+\def\strc_formulas_check_side_box
+ {\doifelsesidefloat
+ {\d_strc_math_side_width\d_page_sides_width}%
+ {\d_strc_math_side_width\zeropoint}}
+
+\def\strc_formulas_start_side_box
+ {\ifzeropt\d_strc_math_side_width\else
+ \advance\displaywidth-\d_strc_math_side_width
+ \ifnum\c_page_sides_checks_done<\plustwo
+ % see \strc_formulas_display_space_before_normal
+ \vkern-\strutht % quite a hack
+ \fi
+ \dontleavehmode\dbox
+ \fi
+ \bgroup}
+
+\def\strc_formulas_stop_side_box
+ {\egroup}
+
+\def\strc_formulas_trigger_side_box
+ {\ifzeropt\d_strc_math_side_width\else
+ \advance\hsize-\d_strc_math_side_width
+ \forgeteverypar
+ \dontleavehmode
+ \fi}
+
+% End of experiment.
+
\tolerant\protected\def\strc_formulas_start_formula#1#:#*[#2]% setting leftskip adaption is slow !
- {\ifhmode
+ {\strc_formulas_check_side_box
+ \ifhmode
\par
\fi
\bgroup % HERE
@@ -1853,15 +1764,20 @@
{\xdef\currentplaceformulasuffix{#1}%
\strc_formulas_place_nop}
-\protected\def\strc_formulas_place_nop
- {\doifelsenextchar$\strc_formulas_place_pickup\strc_formulas_place_indeed} % [ref]$$ [ref]\start
+%D We no longer picku p $$ as this is now equivalent to inline:
-\protected\def\strc_formulas_place_indeed
- {\strc_formulas_place_numbering}
+% \protected\def\strc_formulas_place_nop
+% {\doifelsenextchar$\strc_formulas_place_pickup\strc_formulas_place_indeed} % [ref]$$ [ref]\start
+%
+% \protected\def\strc_formulas_place_indeed
+% {\strc_formulas_place_numbering}
+%
+% \protected\def\strc_formulas_place_pickup$$#1$$%
+% {\strc_formulas_place_numbering
+% \strc_formulas_start_formula{}#1\strc_formulas_stop_formula}
-\protected\def\strc_formulas_place_pickup$$#1$$%
- {\strc_formulas_place_numbering
- \strc_formulas_start_formula{}#1\strc_formulas_stop_formula}
+\protected\def\strc_formulas_place_nop
+ {\strc_formulas_place_numbering}
% \let\startplaceformula\placeformula
% \let\stopplaceformula \relax
@@ -1984,15 +1900,15 @@
% \stopplaceformula
% \stoptext
+% Relaxing in the macro is really needed because otherwise we get spurious
+% numbers probably due to some % interference with other local variables
+
\def\strc_formulas_place_number_in_box
{\dostarttagged\t!formulacaption\empty
- % this is really needed, otherwise we get spurious numbers probably due to some
- % interference with other local variables .. also keep an eye on eqtest in the
- % MS tests
- \glet\strc_formulas_place_number \relax
- %\glet\strc_formulas_place_number_nested\gobbletwoarguments
- %
+ \glet\strc_formulas_place_number \relax
+ %\glet\strc_formulas_place_number_nested\gobbletwoarguments
\global\setbox\b_strc_formulas_number\naturalhbox{\strc_formulas_number_indeed}%
+ \global\d_strc_formulas_number\wd\b_strc_formulas_number
\dostoptagged}
\let\strc_formulas_flush_number\relax
diff --git a/tex/context/base/mkxl/strc-ref.lmt b/tex/context/base/mkxl/strc-ref.lmt
index 272e7e992..45177c5db 100644
--- a/tex/context/base/mkxl/strc-ref.lmt
+++ b/tex/context/base/mkxl/strc-ref.lmt
@@ -1654,6 +1654,9 @@ local function identify_inner(set,var,prefix,collected,derived)
end
--
local n, list = resolvers.jobs.currentstructure()
+-- print(prefix)
+-- inspect(set)
+-- inspect(list)
if list then
for i=#list,1,-1 do
local l = list[i]
@@ -1661,8 +1664,9 @@ local function identify_inner(set,var,prefix,collected,derived)
if i then
i = i[inner]
if i then
- -- return finish_inner(set,var,"",i)
- return finish_inner(set,var,l,i)
+local p = i.references.prefix or l -- which is what we use in the destination
+-- return finish_inner(set,var,l,i)
+ return finish_inner(set,var,p,i)
end
end
end
diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl
index db100f0dd..09d742e56 100644
--- a/tex/context/base/mkxl/strc-sec.mkxl
+++ b/tex/context/base/mkxl/strc-sec.mkxl
@@ -225,6 +225,12 @@
titledata {
label {\detokenize\expandafter{\currentstructurelabel}}
title {\detokenize\expandafter{\currentstructuretitle}}
+% alternative 1:
+% label {\detokened\currentstructurelabel}
+% title {\detokened\currentstructuretitle}
+% alternative 2, detokened scanner:
+% label \currentstructurelabel
+% title \currentstructuretitle
\ifx\currentstructurebookmark\currentstructuretitle \else
bookmark {\detokenize\expandafter{\currentstructurebookmark}}
\fi
diff --git a/tex/context/base/mkxl/syst-con.lmt b/tex/context/base/mkxl/syst-con.lmt
new file mode 100644
index 000000000..a429b4d92
--- /dev/null
+++ b/tex/context/base/mkxl/syst-con.lmt
@@ -0,0 +1,113 @@
+if not modules then modules = { } end modules ['syst-con'] = {
+ version = 1.001,
+ comment = "companion to syst-con.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local tonumber = tonumber
+local math = math
+local utfchar = utf.char
+local gsub = string.gsub
+local concat, reverse = table.concat, table.reverse
+
+converters = converters or { }
+local converters = converters
+
+local context = context
+local commands = commands
+local implement = interfaces.implement
+
+local formatters = string.formatters
+
+function converters.hexstringtonumber(n) tonumber(n,16) end
+function converters.octstringtonumber(n) tonumber(n, 8) end
+
+local f_lchexnumber = formatters["%x"]
+local f_uchexnumber = formatters["%X"]
+local f_lchexnumbers = formatters["%02x"]
+local f_uchexnumbers = formatters["%02X"]
+local f_octnumber = formatters["%03o"]
+local nicenumber = formatters["%0.6F"] -- or N
+
+local lchexnumber = function(n) if n < 0 then n = 0x100000000 + n end return f_lchexnumber (n) end
+local uchexnumber = function(n) if n < 0 then n = 0x100000000 + n end return f_uchexnumber (n) end
+local lchexnumbers = function(n) if n < 0 then n = 0x100000000 + n end return f_lchexnumbers(n) end
+local uchexnumbers = function(n) if n < 0 then n = 0x100000000 + n end return f_uchexnumbers(n) end
+local octnumber = function(n) if n < 0 then n = 0x100000000 + n end return f_octnumber (n) end
+
+converters.lchexnumber = lchexnumber
+converters.uchexnumber = uchexnumber
+converters.lchexnumbers = lchexnumbers
+converters.uchexnumbers = uchexnumbers
+converters.octnumber = octnumber
+converters.nicenumber = nicenumber
+
+implement { name = "hexstringtonumber", actions = { tonumber, context }, arguments = { "integer", 16 } }
+implement { name = "octstringtonumber", actions = { tonumber, context }, arguments = { "integer", 8 } }
+
+implement { name = "rawcharacter", actions = function(n) context(utfchar(0x110000+n)) end, arguments = "integer" }
+
+implement { name = "lchexnumber", actions = { lchexnumber, context }, arguments = "integer" }
+implement { name = "uchexnumber", actions = { uchexnumber, context }, arguments = "integer" }
+implement { name = "lchexnumbers", actions = { lchexnumbers, context }, arguments = "integer" }
+implement { name = "uchexnumbers", actions = { uchexnumbers, context }, arguments = "integer" }
+implement { name = "octnumber", actions = { octnumber, context }, arguments = "integer" }
+
+-- replaced by posits
+
+implement { name = "sin", actions = { math.sin, nicenumber, context }, arguments = "number" }
+implement { name = "cos", actions = { math.cos, nicenumber, context }, arguments = "number" }
+implement { name = "tan", actions = { math.tan, nicenumber, context }, arguments = "number" }
+
+implement { name = "sind", actions = { math.sind, nicenumber, context }, arguments = "number" }
+implement { name = "cosd", actions = { math.cosd, nicenumber, context }, arguments = "number" }
+implement { name = "tand", actions = { math.tand, nicenumber, context }, arguments = "number" }
+
+-- only as commands
+
+function commands.format(fmt,...) context((gsub(fmt,"@","%%")),...) end
+
+implement {
+ name = "formatone", -- used as such so no name change here
+ public = true,
+ protected = true,
+ arguments = "2 strings",
+ actions = function(f,s) context((gsub(f,"@","%%")),s) end,
+}
+
+local function tobits(b,w,d)
+ local t = { }
+ if not w then
+ w = 32
+ end
+ local m = d
+ local k = 0
+ for i=1,w do
+ k = k + 1 ; t[k] = (b & 0x1) == 1 and "1" or "0"
+ if m then
+ m = m - 1
+ if m == 0 then
+ k = k + 1 ; t[k] = " "
+ m = d
+ end
+ end
+ b = b >> 1
+ end
+ return concat(reverse(t))
+end
+
+implement {
+ name = "tobits",
+ public = true,
+ arguments = "3 integers",
+ actions = function(w,d,n) context(tobits(n,w,d)) end, -- fast enough
+}
+
+implement {
+ name = "tohexa",
+ public = true,
+ arguments = "2 integers",
+ actions = function(w,n) context("0x%0"..w.."X",n) end, -- somewhat slow
+}
diff --git a/tex/context/base/mkxl/syst-con.mkxl b/tex/context/base/mkxl/syst-con.mkxl
index ed4a4f3c5..0b88f8ddf 100644
--- a/tex/context/base/mkxl/syst-con.mkxl
+++ b/tex/context/base/mkxl/syst-con.mkxl
@@ -41,13 +41,6 @@
\permanent\def\hexstringtonumber#1{\clf_hexstringtonumber\numexpr#1\relax}
\permanent\def\octstringtonumber#1{\clf_octstringtonumber\numexpr#1\relax}
-%D \macros{rawcharacter}
-%D
-%D This macro can be used to produce proper 8 bit characters that we sometimes need
-%D in backends and round||trips.
-
-\permanent\def\rawcharacter#1{\clf_rawcharacter\numexpr#1\relax}
-
%D \macros{twodigits, threedigits}
%D
%D These macros provides two or three digits always:
@@ -85,4 +78,12 @@
%D The \type {\modulatednumber} and \type {\realnumber} macros have been removed.
+%D \macros{tobits}
+%D
+%D Thso macro expects a number of bits, chunk size and the number.
+%D
+%D \starttyping
+%D \tobits 32 4 "00000003
+%D \stoptyping
+
\protect \endinput
diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl
index 039e9456b..bcf2bfc69 100644
--- a/tex/context/base/mkxl/syst-ini.mkxl
+++ b/tex/context/base/mkxl/syst-ini.mkxl
@@ -1169,11 +1169,11 @@
%D Sometimes kerns make more sense than glue but we need to be in the right mode:
-\permanent\protected\def\vkern {\ifhmode\par \fi\kern}
-\permanent\protected\def\hkern {\ifvmode\dontleavehmode\fi\kern}
+\ifdefined\vkern \else \permanent\protected\def\vkern {\ifhmode\par \fi\kern} \fi
+\ifdefined\hkern \else \permanent\protected\def\hkern {\ifvmode\dontleavehmode\fi\kern} \fi
-\permanent\protected\def\vpenalty{\ifhmode\par \fi\penalty}
-\permanent\protected\def\hpenalty{\ifvmode\dontleavehmode\fi\penalty}
+\ifdefined\vpenalty \else \permanent\protected\def\vpenalty{\ifhmode\par \fi\penalty} \fi
+\ifdefined\hpenalty \else \permanent\protected\def\hpenalty{\ifvmode\dontleavehmode\fi\penalty} \fi
%D Again a few kind-of-extensions the core. These come from plain \TEX\ but are
%D probably not used in \CONTEXT.
diff --git a/tex/context/base/mkxl/tabl-ltb.mkxl b/tex/context/base/mkxl/tabl-ltb.mkxl
index 7fcdba6f2..f060c5e12 100644
--- a/tex/context/base/mkxl/tabl-ltb.mkxl
+++ b/tex/context/base/mkxl/tabl-ltb.mkxl
@@ -301,7 +301,7 @@
\c!height=\ifempty\p_height\ht\scratchbox\else\p_height\fi,
\c!depth=\ifempty\p_depth \dp\scratchbox\else\p_depth \fi,
\c!width=\wd\scratchbox]%
- \hskip-\wd\scratchbox\box\scratchbox}}
+ \hkern-\wd\scratchbox\box\scratchbox}}
\def\tabl_lines_wrap_up_auto_r
{\hpack
@@ -313,7 +313,7 @@
\c!height=\ht\scratchbox,
\c!depth=\dp\scratchbox,
\c!width=\wd\scratchbox]%
- \hskip-\wd\scratchbox\box\scratchbox}}
+ \hkern-\wd\scratchbox\box\scratchbox}}
\def\tabl_lines_wrap_up_line
{\backgroundline[\linetablecparameter\c!backgroundcolor]{\box\scratchbox}}
diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl
index b82dcb585..fd51541af 100644
--- a/tex/context/base/mkxl/tabl-ntb.mkxl
+++ b/tex/context/base/mkxl/tabl-ntb.mkxl
@@ -1478,9 +1478,9 @@
\dostoptagged}
\protected\def\tabl_ntb_span#1%
- {\hskip\tabl_ntb_get_dis\c_tabl_ntb_col
+ {\hkern\tabl_ntb_get_dis\c_tabl_ntb_col
\localcontrolledloop\plusone#1\plusone
- {\hskip\tabl_ntb_get_wid\c_tabl_ntb_col\relax
+ {\hkern\tabl_ntb_get_wid\c_tabl_ntb_col\relax
\global\advanceby\c_tabl_ntb_col\plusone}}
\protected\def\tabl_ntb_skip#1%
@@ -2168,7 +2168,7 @@
\tabl_ntb_anchor_start{#1}{#2}%
\inheritednaturaltablelocalframed{\tabl_ntb_cell_start\tabl_ntb_char_align{#1}{#2}#4\tabl_ntb_cell_stop}%
\tabl_ntb_anchor_stop
- \hskip\tabl_ntb_get_dis{#2}%
+ \hkern\tabl_ntb_get_dis{#2}%
\endgroup}
\newtoks\everyresetTABLEyes
diff --git a/tex/context/base/mkxl/toks-aux.lmt b/tex/context/base/mkxl/toks-aux.lmt
index 2027ed78e..d9adb1d67 100644
--- a/tex/context/base/mkxl/toks-aux.lmt
+++ b/tex/context/base/mkxl/toks-aux.lmt
@@ -192,6 +192,7 @@ tex.normalizeparcodes = getthem(tex.getnormalizeparvalues, "normalizepar
tex.automigrationcodes = getthem(tex.getautomigrationvalues, "automigrationcode")
tex.parcontextcodes = getthem(tex.getparcontextvalues, "parcontextcode")
tex.textcontrolcodes = getthem(tex.gettextcontrolvalues ) -- only at lua end
+tex.fitnesscodes = getthem(tex.getfitnessvalues ) -- only at lua end
tex.listanchorcodes = getthem(tex.getlistanchorvalues, "listanchorcode")
tex.listsigncodes = getthem(tex.getlistsignvalues, "listsigncode")
tex.classoptioncodes = getthem(tex.getmathclassoptionvalues, "classoptioncode")
diff --git a/tex/context/base/mkxl/toks-ini.lmt b/tex/context/base/mkxl/toks-ini.lmt
index d45e3ae1c..e232fae0d 100644
--- a/tex/context/base/mkxl/toks-ini.lmt
+++ b/tex/context/base/mkxl/toks-ini.lmt
@@ -56,6 +56,7 @@ local scanluainteger = token.scanluainteger
local scanluacardinal = token.scanluacardinal
local scanintegerargument = token.scanintegerargument
local scandimenargument = token.scandimenargument
+local scandetokened = token.scandetokened
local scannumber = token.scannumber
local scanboolean = token.scanboolean
@@ -186,6 +187,7 @@ tokens.scanners = { -- these expand
keywordcs = scankeywordcs,
csname = scancsname,
nextchar = scannextchar,
+ detokened = scandetokened,
next = token.scannext,
nextexpanded = token.scannextexpanded,
diff --git a/tex/context/base/mkxl/toks-scn.lmt b/tex/context/base/mkxl/toks-scn.lmt
index 855bca6ad..5e6a5e8ad 100644
--- a/tex/context/base/mkxl/toks-scn.lmt
+++ b/tex/context/base/mkxl/toks-scn.lmt
@@ -44,6 +44,7 @@ local scangluespec = scanners.gluespec
local scancsname = scanners.csname
local scanintegerargument = scanners.integerargument
local scandimenargument = scanners.dimenargument
+local scandetokened = scanners.detokened
local todimen = number.todimen
local toboolean = toboolean
@@ -258,6 +259,7 @@ local shortcuts = {
scanargumentasis = scanargumentasis,
scanintegerargument = scanintegerargument,
scandimenargument = scandimenargument,
+ scandetokened = scandetokened,
todimen = todimen,
tonumber = tonumber,
tostring = tostring,
diff --git a/tex/context/base/mkxl/trac-tex.lmt b/tex/context/base/mkxl/trac-tex.lmt
new file mode 100644
index 000000000..df125cb12
--- /dev/null
+++ b/tex/context/base/mkxl/trac-tex.lmt
@@ -0,0 +1,113 @@
+if not modules then modules = { } end modules ['trac-tex'] = {
+ version = 1.001,
+ comment = "companion to trac-deb.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local texhashtokens = tex.hashtokens
+
+local trackers = trackers
+local token = token
+local saved = { }
+local create = token.create
+local undefined = create("undefined").command
+
+function trackers.savehash()
+ saved = texhashtokens()
+ return saved
+end
+
+function trackers.dumphashtofile(filename,delta)
+ local list = { }
+ local hash = texhashtokens()
+ local create = token.create
+ for i=1,#hash do
+ local name = hash[i]
+ if not delta or not saved[name] then
+ local token = create(name)
+ if token.command ~= undefined then
+ local category = token.cmdname
+ local dk = list[category]
+ if not dk then
+ dk = {
+ names = { },
+ found = 0,
+ -- code = token[1],
+ }
+ list[category] = dk
+ end
+ if token.protected then
+ if token.expandable then
+ dk.names[name] = "ep"
+ else
+ dk.names[name] = "-p"
+ end
+ else
+ if token.expandable then
+ dk.names[name] = "ep"
+ else
+ dk.names[name] = "--"
+ end
+ end
+ dk.found = dk.found + 1
+ end
+ end
+ end
+ table.save(filename or tex.jobname .. "-hash.log",list)
+end
+
+local delta = nil
+
+local function dump_hash(wanteddelta)
+ if delta == nil then
+ saved = saved or trackers.savehash()
+ luatex.registerstopactions(1,function() dump_hash(nil,wanteddelta) end) -- at front
+ end
+ delta = wanteddelta
+end
+
+directives.register("system.dumphash", function() dump_hash(false) end)
+directives.register("system.dumpdelta", function() dump_hash(true ) end)
+
+local function saveusedfilesintrees(format)
+ local data = {
+ jobname = environment.jobname or "?",
+ version = environment.version or "?",
+ kind = environment.kind or "?",
+ files = resolvers.foundintrees()
+ }
+ local filename = file.replacesuffix(environment.jobname or "context-job",'jlg')
+ if format == "lua" then
+ io.savedata(filename,table.serialize(data,true))
+ else
+ io.savedata(filename,table.toxml(data,"job"))
+ end
+end
+
+directives.register("system.dumpfiles", function(v)
+ luatex.registerstopactions(function() saveusedfilesintrees(v) end)
+end)
+
+local profiled = table.setmetatableindex("number")
+
+interfaces.implement {
+ name = "profilemacro",
+ arguments = "csname",
+ actions = function(cs)
+ profiled[cs] = profiled[cs] + 1
+ end,
+}
+
+interfaces.implement {
+ name = "showprofiledmacros",
+ public = true,
+ protected = true,
+ actions = function(cs)
+ for k, v in table.sortedhash(profiled) do
+ logs.report("profiled", "%s : %i",k,v)
+ end
+ end,
+}
+
diff --git a/tex/context/base/mkxl/trac-tex.mkxl b/tex/context/base/mkxl/trac-tex.mkxl
index cf46bed26..2926a90b2 100644
--- a/tex/context/base/mkxl/trac-tex.mkxl
+++ b/tex/context/base/mkxl/trac-tex.mkxl
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Tracking Macros / TeX}
-\registerctxluafile{trac-tex}{}
+\registerctxluafile{trac-tex}{autosuffix}
%D All tracing flags at the \TEX\ end will be redone this way so
%D that we have a similar mechanism for \TEX\ and \LUA. Also, the
@@ -40,31 +40,26 @@
\permanent\protected\def\nomkivstatistics{\enabledirectives[system.nostatistics]}
-%D This is not really a tracker but for decades it lived in my \type {cont-loc}
-%D file. I moved it here because I wanted someone else to use it. This macro is not
-%D really useful for users. I kept the \LUA\ variant in \type {cont-loc.mkiv}.
+%D Finally this one got moved from cont-exp to here (replacing the old one):
-\installcorenamespace{profilemacrocount}
-\installcorenamespace{profilemacromacro}
-
-\newtoks\t_syst_profile
-
-\appendtoks
- \the\t_syst_profile
-\to \everystoptext
+\installcorenamespace{profilemacro}
\permanent\protected\def\profilemacro#1% an oldie, but modernized a bit
{\edef\p_name{\csstring#1}%
- \ifcsname\??profilemacrocount\p_name\endcsname \else
- \expandafter\newinteger\csname\??profilemacrocount\p_name\endcsname
- \letcsname\??profilemacromacro\p_name\endcsname#1%
- \xtoksapp\t_syst_profile
- {\writestatus
- {profile}%
- {\string#1: \noexpand\the\csname\??profilemacrocount\p_name\endcsname}}%
- \enforced\protected\xdef#1%
- {\global\advanceby\csname\??profilemacrocount\p_name\endcsname\plusone
- \expandafter\noexpand\csname\??profilemacromacro\p_name\endcsname}%
+ \ifcsname\??profilemacro\p_name\endcsname \else
+ \aliased\letcsname\??profilemacro\p_name\endcsname#1%
+ % \enforced\protected\xdef#1%
+ \untraced\enforced\ifflags#1\protected\protected\fi\xdef#1%
+ {\noexpand\clf_profilemacro\noexpand#1%
+ \expandafter\noexpand\csname\??profilemacro\p_name\endcsname}%
\fi}
+% \appendtoks
+% {\appendtoks\showprofiledmacros\to\everystoptext}%
+% \to \everydump
+
+\appendtoks
+ \showprofiledmacros
+\to \everystoptext
+
\protect \endinput
diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt
index 9b467de29..b97a8d7d1 100644
--- a/tex/context/base/mkxl/trac-vis.lmt
+++ b/tex/context/base/mkxl/trac-vis.lmt
@@ -180,12 +180,21 @@ local userrule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule")
local outlinerule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule")
local emptyrule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule")
-local function initialize()
- --
+local function getusedfont()
if not usedfont then
-- we use a narrow monospaced font -- infofont ?
visualizers.setfont(fonts.definers.define { name = "lmmonoltcond10regular", size = tex.sp("4pt") })
end
+ return usedfont
+end
+
+visualizers.getusedfont = getusedfont
+
+local function initialize()
+ --
+ if not usedfont then
+ getusedfont()
+ end
--
for mode, value in next, modes do
local tag = formatters["v_%s"](mode)
@@ -903,11 +912,8 @@ end
rest = emptyrule(wd,ht,dp) -- we accept some overhead
elseif what == "_D_" then
-- also the other line
- local up = nil
local list = getlist(current)
- if list then
- up = getheight(list)
- end
+ local up = list and getheight(list) or 0
rest = userrule {
width = wd,
height = ht,
@@ -1861,6 +1867,8 @@ do
local saved = current
if trace_math then
head, current = ruledmath(head,current)
+ elseif trace_penalty then
+ head, current = ruledpenalty(head,current,false,true)
end
elseif id == dir_code then
if trace_dir then
diff --git a/tex/context/base/mkxl/typo-brk.lmt b/tex/context/base/mkxl/typo-brk.lmt
index 3a7b69db9..c5532c291 100644
--- a/tex/context/base/mkxl/typo-brk.lmt
+++ b/tex/context/base/mkxl/typo-brk.lmt
@@ -406,7 +406,7 @@ local enabled = false
function breakpoints.define(name)
local data = numbers[name]
if data then
- -- error
+ report_breakpoints("there is already a breakpoints class %a",name)
else
local number = #mapping + 1
local data = {
@@ -439,6 +439,8 @@ function breakpoints.setreplacement(name,char,language,settings)
middle = middle ~= "" and middle or nil,
skip = settings.range == v_yes,
} -- was { type or 1, before or 1, after or 1 }
+ else
+ report_breakpoints("there is no breakpoints class %a",name)
end
end
diff --git a/tex/context/base/mkxl/typo-brk.mkxl b/tex/context/base/mkxl/typo-brk.mkxl
index 0988e3a6b..3e386de20 100644
--- a/tex/context/base/mkxl/typo-brk.mkxl
+++ b/tex/context/base/mkxl/typo-brk.mkxl
@@ -27,6 +27,14 @@
% see below: \exhyphenchar \minusone % we use a different order than base tex, so we really need this
+% \definebreakpoints [test]
+%
+% \definebreakpoint [test][:][nleft=3,nright=3,type=1]
+% \definebreakpoint [test][/][nleft=3,nright=3,type=1]
+%
+% {\setbreakpoints[test]\hsize1mm\nohyphens x boundary:boundary/boundary\par}
+% {\setbreakpoints[test]\hsize1mm x boundary:boundary/boundary\par} % still hyphenated
+
\permanent\tolerant\protected\def\definebreakpoints[#1]%
{\clf_definebreakpoints{#1}} % todo: public implementor
@@ -82,7 +90,7 @@
% \stop
% \mainlanguage[czech]
-% \definebreakpoint [compound] [\number`-] [language=cs,nleft=3,nright=3,type=4]
+% \definebreakpoint [compound] [-] [language=cs,nleft=3,nright=3,type=4]
% \setbreakpoints[compound]
% \start \hsize 1mm test-test \par \stop
diff --git a/tex/context/base/mkxl/typo-del.mkxl b/tex/context/base/mkxl/typo-del.mkxl
index bd427b954..025d6ffcf 100644
--- a/tex/context/base/mkxl/typo-del.mkxl
+++ b/tex/context/base/mkxl/typo-del.mkxl
@@ -655,7 +655,7 @@
\dontleavehmode
\edef\p_delimited_margin{\delimitedtextparameter\c!location}%
\ifx\p_delimited_margin\v!margin
- \hskip-\wd\scratchbox
+ \kern-\wd\scratchbox
\fi
\box\scratchbox
\dostoptagged}
diff --git a/tex/context/base/mkxl/typo-itm.mkxl b/tex/context/base/mkxl/typo-itm.mkxl
index 5a10cfc9d..46d46dfb3 100644
--- a/tex/context/base/mkxl/typo-itm.mkxl
+++ b/tex/context/base/mkxl/typo-itm.mkxl
@@ -235,7 +235,7 @@
\typo_items_construct_items_boxes{#1}%
\noindent\hbox\bgroup
\ifvoid\b_typo_items_symbols \else
- \llap{\box\b_typo_items_symbols\hskip\d_typo_items_distance}%
+ \llap{\box\b_typo_items_symbols\kern\d_typo_items_distance}%
\fi
\box\b_typo_items_texts
\egroup}
diff --git a/tex/context/base/mkxl/typo-mar.mkxl b/tex/context/base/mkxl/typo-mar.mkxl
index 85161c942..395406f42 100644
--- a/tex/context/base/mkxl/typo-mar.mkxl
+++ b/tex/context/base/mkxl/typo-mar.mkxl
@@ -469,7 +469,7 @@
\executeifdefined{\headalternativeparameter\c!margintext}\margintext {
\ifconditional\headshownumber
\headnumbercontent
- \hskip\headnumberdistance
+ \hkern\headnumberdistance
\fi
\headtextcontent
}
diff --git a/tex/context/fonts/mkiv/modern-math.lfg b/tex/context/fonts/mkiv/modern-math.lfg
index ef99513b9..c52b7a70b 100644
--- a/tex/context/fonts/mkiv/modern-math.lfg
+++ b/tex/context/fonts/mkiv/modern-math.lfg
@@ -28,7 +28,7 @@ return {
-- SuperscriptBottomMaxWithSubscript = 344, -- 344 in font .8 exheight
-- SuperscriptBottomMin = 108, -- 108 in font .25 exheight
SuperscriptShiftUp = 413, -- 363 in font (multiplied with 4.9547/4.3536, got 413)
- SuperscriptShiftUpCramped = 413, -- 289 in font (no distinction, old TeX)
+ SuperscriptShiftUpCramped = 329, -- 289 in font (no distinction, old TeX)
PrimeShiftUp = "1.1*SuperscriptShiftUp",
PrimeShiftUpCramped = "1.1*SuperscriptShiftUp",
-- PrimeRaisePercent = 0, -- set to 0 in math-act
diff --git a/tex/context/fonts/mkiv/newcomputermodern-math.lfg b/tex/context/fonts/mkiv/newcomputermodern-math.lfg
index 12c6e8b23..7b505c91f 100644
--- a/tex/context/fonts/mkiv/newcomputermodern-math.lfg
+++ b/tex/context/fonts/mkiv/newcomputermodern-math.lfg
@@ -79,7 +79,7 @@ return {
SubscriptShiftDownWithSuperscript = 247, -- relates to the previous one (see math-act)
SuperscriptBaselineDropMax = 386, -- 250 in font (multiplied by 4.6333/2.99 (values in cm/values in lm))
SuperscriptShiftUp = 413, -- 363 in font (multiplied with 4.9547/4.3536, got 413)
- SuperscriptShiftUpCramped = 413, -- 289 in font (no distinction, old TeX)
+ SuperscriptShiftUpCramped = 329, -- 289 in font (same factor as uncramped one (no distinction, old TeX)
PrimeShiftUp = "1.1*SuperscriptShiftUp",
PrimeShiftUpCramped = "1.1*SuperscriptShiftUp",
},
diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml
index 996ca4f05..7062012f5 100644
--- a/tex/context/interface/mkiv/context-en.xml
+++ b/tex/context/interface/mkiv/context-en.xml
@@ -257,6 +257,8 @@
<cd:constant type="more"/>
<cd:constant type="1*more"/>
<cd:constant type="2*more"/>
+ <cd:constant type="fit"/>
+ <cd:constant type="profile"/>
</cd:keywords>
</cd:arguments>
</cd:command>
diff --git a/tex/context/interface/mkiv/i-align.xml b/tex/context/interface/mkiv/i-align.xml
index 46afca897..67b708281 100644
--- a/tex/context/interface/mkiv/i-align.xml
+++ b/tex/context/interface/mkiv/i-align.xml
@@ -61,6 +61,8 @@
<cd:constant type="more"/>
<cd:constant type="1*more"/>
<cd:constant type="2*more"/>
+ <cd:constant type="fit"/>
+ <cd:constant type="profile"/>
<!--
<cd:constant type="cd:name"/>
-->
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index ee5d4853c..0a88e801a 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 1160ae482..788e6ace3 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/mkxl/s-math-show.mkxl b/tex/context/modules/mkxl/s-math-show.mkxl
new file mode 100644
index 000000000..456ecc60b
--- /dev/null
+++ b/tex/context/modules/mkxl/s-math-show.mkxl
@@ -0,0 +1,138 @@
+%D \module
+%D [ file=math-run,
+%D version=2023.05.18,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Runtime loaded commands,
+%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.
+
+\unprotect
+
+\permanent\tolerant\protected\gdef\showmathmargins[#1]%
+ {\bgroup
+ \par
+ \c_attr_visual\attributeunsetvalue
+ \ruledhbox to \hsize \bgroup
+ \setbox\scratchbox\hbox to \hsize\bgroup
+ \scratchheight2\lineheight
+ \scratchwidth \onepoint
+ \infofont
+ \ifcstok{#1}\v!all
+ \llap\bgroup
+ \setupinterlinespace
+ \vbox yoffset -\lineheight\bgroup
+ \forgetall
+ \setstrut
+ % \llap{\the \c_strc_math_n_of_lines \enspace \#l}\par
+ \llap{\withoutpt\d_strc_math_first_left \enspace fl}\par
+ \llap{\withoutpt\d_strc_math_last_left \enspace ll}\par
+ \llap{\withoutpt\d_strc_math_max_left \enspace ml}\par
+ \llap{\withoutpt\d_strc_formulas_number \enspace wd}\par
+ \egroup
+ \quad
+ \egroup
+ \fi
+ \ifzeropt\s_strc_formulas_margin_left\else
+ \bgroup\darkred
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \kern-\scratchwidth
+ \vrule \s!width \s_strc_formulas_margin_left
+ \kern-\scratchwidth
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \egroup
+ \fi
+ \ifdim\d_math_strc_hangindent>\zeropoint
+ \bgroup\darkred
+ \vrule \s!width \d_math_strc_hangindent \s!depth 2\exheight \s!height-\exheight
+ \kern-\d_math_strc_hangindent
+ \egroup
+ \fi
+ \bgroup\darkgray
+ \leaders\vrule\hfill
+ \egroup
+ \bgroup\darkgreen
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \egroup
+ \bgroup\darkgray
+ \leaders\vrule\hfill
+ \egroup
+ \ifdim\d_math_strc_hangindent<\zeropoint
+ \bgroup\darkblue
+ \kern\d_math_strc_hangindent
+ \vrule \s!width -\d_math_strc_hangindent \s!depth 2\exheight \s!height-\exheight
+ \egroup
+ \fi
+ \ifzeropt\s_strc_formulas_margin_right\else
+ \bgroup\darkblue
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \kern-\scratchwidth
+ \vrule \s!width \s_strc_formulas_margin_right
+ \kern-\scratchwidth
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \egroup
+ \fi
+ \ifcstok{#1}\v!all
+ \rlap\bgroup
+ \setupinterlinespace
+ \quad
+ \vbox yoffset -\lineheight\bgroup
+ \forgetall
+ \setstrut
+ \rlap{fr\enspace\withoutpt\d_strc_math_first_right}\par
+ \rlap{lr\enspace\withoutpt\d_strc_math_last_right }\par
+ \rlap{mr\enspace\withoutpt\d_strc_math_max_right }\par
+ \rlap
+ {\formulaparameter\c!location:\enspace
+ p=\the\c_strc_math_positioning\enspace
+ a=\the\c_strc_math_ragged_status\enspace
+ l=\the\c_strc_math_number_location\enspace
+ v=\the\c_strc_math_number_variant}\par
+ \egroup
+ \egroup
+ \fi
+ \global\c_strc_math_positioning\zerocount
+ \egroup
+ \ht\scratchbox1.2\exheight
+ \dp\scratchbox0.4\exheight
+ \strut
+ \box\scratchbox
+ \kern-\hsize
+ \hbox to \hsize \bgroup
+ \white
+ \infofont
+ \kern\s_strc_formulas_margin_left
+ \quad
+ [\the\s_strc_formulas_margin_left]%
+ \hss
+ [\c!split=\iftok{\formulaparameter\c!split}\emptytoks\v!yes \else\formulaparameter\c!split\fi]%
+ \quad
+ [\c!align=\iftok{\formulaparameter\c!align}\emptytoks\v!middle\else\formulaparameter\c!align\fi]%
+ \ifcstok{#1}\v!all\else
+ \quad
+ [\c!location=\formulaparameter\c!location]%
+ \fi
+ \hss
+ [\the\s_strc_formulas_margin_right]%
+ \quad
+ \kern\s_strc_formulas_margin_right
+ \egroup
+ \egroup
+ \par
+ \egroup}
+
+\protect
+
+\continueifinputfile{s-math-show.mkxl}
+
+\starttext
+
+\startformula
+ a + b = c
+\stopformula
+
+\stoptext
diff --git a/tex/context/modules/mkxl/s-text-tests.mkxl b/tex/context/modules/mkxl/s-text-tests.mkxl
index 6766a7a09..e21c3a5b3 100644
--- a/tex/context/modules/mkxl/s-text-tests.mkxl
+++ b/tex/context/modules/mkxl/s-text-tests.mkxl
@@ -15,6 +15,28 @@
%D Here we collect some tests that later will become proper macros.
+\starttext
+ \setuppapersize[S4]
+ \showmakeup[line]
+ \def\Test#1{\start\setupheadertexts[\string#1]#1\samplefile{ward}\page\stop}
+
+ \Test\notragged
+ \Test\raggedleft
+ \Test\raggedcenter
+ \Test\raggedright
+ \Test\veryraggedleft
+ \Test\veryraggedcenter
+ \Test\veryraggedright
+ \Test\raggedwidecenter
+ \Test\centeredlastline
+ \Test\flushedrightlastline
+ \Test\ttraggedright
+ \Test\forgetragged
+ \Test\raggedslanted
+\stoptext
+
+% fonts
+
\usebodyfont[bonum]
\usebodyfont[cambria]
\usebodyfont[concrete]
diff --git a/tex/context/modules/third/mtx-install-imp-modules.lua b/tex/context/modules/third/mtx-install-imp-modules.lua
index 66e986a87..bb9b661df 100644
--- a/tex/context/modules/third/mtx-install-imp-modules.lua
+++ b/tex/context/modules/third/mtx-install-imp-modules.lua
@@ -1,5 +1,7 @@
-- from the context garden
+-- incorrectly packaged: metaducks, sudoku, aquamints
+
return {
name = "mtx-install-imp-modules",
version = "1.00",
@@ -7,19 +9,19 @@ return {
author = "Hans Hagen & others",
copyright = "ConTeXt development team",
lists = {
- ["pocketdiary"] = { url = "modules", zips = { "Collection-of-calendars-based-on-PocketDiary-module.zip" } },
+ ["pocketdiary"] = { url = "modules", zips = { "PocketDiary-V2.zip", "Environment-for-collating-marks.zip", "Collection-of-calendars-based-on-PocketDiary-module.zip" } },
["collating"] = { url = "modules", zips = { "Environment-for-collating-marks.zip" } },
["account"] = { url = "modules", zips = { "t-account.zip" } },
["algorithmic"] = { url = "modules", zips = { "t-algorithmic.zip" } },
["animation"] = { url = "modules", zips = { "t-animation.zip" } },
["annotation"] = { url = "modules", zips = { "t-annotation.zip" } },
- ["aquamints"] = { url = "modules", zips = { "aquamints.zip" } },
+ -- ["aquamints"] = { url = "modules", zips = { "aquamints.zip" } }, -- has top level files
["bibmod-doc"] = { url = "modules", zips = { "bibmod-doc.zip" } },
-- ["bnf-0.3"] = { url = "modules", zips = { "t-bnf-0.3.zip" } },
["bnf"] = { url = "modules", zips = { "t-bnf.zip" } },
["chromato"] = { url = "modules", zips = { "t-chromato.zip" } },
- ["cmscbf"] = { url = "modules", zips = { "t-cmscbf.zip" } },
- ["cmttbf"] = { url = "modules", zips = { "t-cmttbf.zip" } },
+ -- ["cmscbf"] = { url = "modules", zips = { "t-cmscbf.zip" } }, -- obsolete
+ -- ["cmttbf"] = { url = "modules", zips = { "t-cmttbf.zip" } }, -- obsolete
["crossref"] = { url = "modules", zips = { "t-crossref.zip" } },
["cyrillicnumbers"] = { url = "modules", zips = { "t-cyrillicnumbers.zip" } },
["degrade"] = { url = "modules", zips = { "t-degrade.zip" } },
@@ -42,9 +44,9 @@ return {
["letter"] = { url = "modules", zips = { "t-letter.zip" } },
["letterspace"] = { url = "modules", zips = { "t-letterspace.mkiv.zip" } },
["lettrine"] = { url = "modules", zips = { "t-lettrine.zip" } },
- ["lua-widow-control"] = { url = "modules", zips = { "lua-widow-control.zip" } },
+ ["lua-widow-control"] = { url = "modules", zips = { "lua-widow-control.zip" } }, -- we wipe the non context stuff
["mathsets"] = { url = "modules", zips = { "t-mathsets.zip" } },
- ["metaducks"] = { url = "modules", zips = { "metaducks.zip" } },
+ -- ["metaducks"] = { url = "modules", zips = { "metaducks.zip" } }, -- has top level files
["pret-c.lua"] = { url = "modules", zips = { "pret-c.lua.zip" } },
["rst"] = { url = "modules", zips = { "t-rst.zip" } },
["rsteps"] = { url = "modules", zips = { "t-rsteps.zip" } },
@@ -52,9 +54,9 @@ return {
["simplefonts"] = { url = "modules", zips = { "t-simplefonts.zip" } },
["simpleslides"] = { url = "modules", zips = { "t-simpleslides.zip" } },
["stormfontsupport"] = { url = "modules", zips = { "stormfontsupport.zip" } },
- ["sudoku"] = { url = "modules", zips = { "sudoku.zip" } },
+ -- ["sudoku"] = { url = "modules", zips = { "sudoku.zip" } }, -- has top level files
["taspresent"] = { url = "modules", zips = { "t-taspresent.zip" } },
- ["texshow"] = { url = "modules", zips = { "u-texshow.zip" } },
+ -- ["texshow"] = { url = "modules", zips = { "u-texshow.zip" } },
["title"] = { url = "modules", zips = { "t-title.zip" } },
["transliterator"] = { url = "modules", zips = { "t-transliterator.zip" } },
["typearea"] = { url = "modules", zips = { "t-typearea.zip" } },
diff --git a/tex/context/sample/common/knuthmath.tex b/tex/context/sample/common/knuthmath.tex
new file mode 100644
index 000000000..9890bb2ba
--- /dev/null
+++ b/tex/context/sample/common/knuthmath.tex
@@ -0,0 +1,3 @@
+Many readers will skim over formulas on their first reading of your exposition.
+Therefore, your sentences should flow smoothly when all but the simplest formulas
+are replaced by \quotation {blah} or some other grunting noise.
diff --git a/tex/context/sample/common/samples.tex b/tex/context/sample/common/samples.tex
index df5b38211..d9a39b3e6 100644
--- a/tex/context/sample/common/samples.tex
+++ b/tex/context/sample/common/samples.tex
@@ -13,6 +13,7 @@ used in testing bibliographic references and citations.
\HL
\NC stork.tex \NC David F. Stork \NC Hal's Legacy\NC \NR
\NC knuth.tex \NC Donald E. Knuth \NC \NC \NR
+\NC knuthmath.tex \NC Donald E. Knuth \NC Mathematical Writing (1987), §1 item 13, p.3 \NC \NR
\NC tufte.tex \NC Edward R. Tufte \NC \NC \NR
\NC reich.tex \NC Steve Reich \NC City Life (1995) \NC \NR
\NC materie.tex \NC Louis Andriessen \NC De Materie \NC \NR
@@ -44,10 +45,10 @@ used in testing bibliographic references and citations.
Quercus, London, 2006 \NC \NR
%NC schwarzenegger.tex \NC Arnold Schwarzenegger \NC Several places on the World Wide Web. \NC \NR
\NC carey.tex \NC Nessa Carey \NC The Epigenetics Revolution,
- Columbia University Press, 2012, p. 195 \NC \NR
+ Columbia University Press, 2012, p.195 \NC \NR
\NC waltham.tex \NC David Waltham \NC Lucky Planet, why earth is exceptional and what that
means for life in the universe,
- Icon Books Ltd, London, 2014, p. 168 \NC \NR
+ Icon Books Ltd, London, 2014, p.168 \NC \NR
\NC sapolsky.tex \NC Robert M. Sapolsky \NC Why Zebras Don't Have Ulsters,
St Martin's Press, 2004 \NC \NR
\NC mcnish.tex \NC Hollie McNish \NC Poetry versus Orchestra, Hollie McNish and Metropole
@@ -91,4 +92,6 @@ used in testing bibliographic references and citations.
% The Schwarzenegger letter was originally typeset at a width equivalent to 16.1cm in
% a default ConTeXt setup.
+% math-kontinuitet-sv.tex : persson|--|sundqvist.tex (infinitesimalkalkyl)
+
\stoptext
diff --git a/tex/context/sample/math/math-knuth-dt.tex b/tex/context/sample/math/math-knuth-dt.tex
new file mode 100644
index 000000000..e32681437
--- /dev/null
+++ b/tex/context/sample/math/math-knuth-dt.tex
@@ -0,0 +1,13 @@
+{\bf 15.} (This procedure maintains four integers $(A, B, C, D)$ with the invariant meaning
+that \quotation{our remaining job is to output the continued fraction for $(Ay + B)/(Cy + D)$,
+where $y$ is the input yet to come.}) Initially set $j \leftarrow k \leftarrow 0$, $(A, B, C, D) \leftarrow (a, b, c, d)$;
+then input $x_j$ and set $(A, B, C, D) \leftarrow (Ax_j + B, A, Cx_j + D, C)$, $j \leftarrow j + 1$, one or
+more times until $C + D$ has the same sign as $C$. (When $j > 1$ and the input has not
+terminated, we know that $1 < y < \infty$; and when $C + D$ has the same sign as $C$ we
+know therefore that $(Ay + B)/(Cy + D)$ lies between $(A + B)/(C + D)$ and $A/C$.)
+Now comes the general step: If no integer lies strictly between $(A + B)/(C + D)$
+and $A/C$, output $X_k \leftarrow \lfloor A/C \rfloor$, and set $(A, B, C, D) \leftarrow (C, D, A - X_ k C, B - X_k D)$,
+$k \leftarrow k + 1$; otherwise input $x_j$ and set $(A, B,C, D) \leftarrow (Ax_j + B, A, Cx_j + D,C)$,
+$j \leftarrow j + 1$. The general step is repeated ad infinitum. However, if at any time the
+\emph{final} $x_j$ is input, the algorithm immediately switches gears: It outputs the continued
+fraction for $(Ax_j + B)/(Cx_j + D)$, using Euclid's algorithm, and terminates.
diff --git a/tex/context/sample/math/math-kontinuitet-sv.tex b/tex/context/sample/math/math-kontinuitet-sv.tex
new file mode 100644
index 000000000..0e633d6f2
--- /dev/null
+++ b/tex/context/sample/math/math-kontinuitet-sv.tex
@@ -0,0 +1,8 @@
+Ett alternativt sätt att uttrycka att $f$ är kontinuerlig i $a$ är att $a\in D_f$
+och att det givet $\epsilon>0$ existerar $\delta>0$ sådant att
+$\fenced[bar][size=0]{f(a+h) - f(a)} < \epsilon$ så snart
+$\fenced[bar][size=0]{h} < \delta$ och $a+h$ tillhör definitionsmängden för $f$.
+Ytterligare ett sätt att uttrycka att $f$ är kontinuerlig i $a$ är att det för
+varje $\epsilon$-omgivning $B(f(a),\epsilon)$ av $f(a)$ finns en
+$\delta$-omgivning $B(a,\delta)$ av $a$ så att $f$ avbildar $B(a,\delta)\cap D_f$
+in i $B(f(a),\epsilon)$, dvs.\ $f(B(a,\delta)) \subset B(f(a),\epsilon)$.
diff --git a/tex/context/sample/third/alfredsson-sv.tex b/tex/context/sample/third/alfredsson-sv.tex
new file mode 100644
index 000000000..e31e26270
--- /dev/null
+++ b/tex/context/sample/third/alfredsson-sv.tex
@@ -0,0 +1,6 @@
+Det var så förbannat kallt ute att det blev isbildning i näshåren på mig och så
+småning om långt ut i mustascherna, som sakta styvnade. Någon ordentlig pälsmössa
+hade jag inte, bara min engelska tyghatt, som jag drog ner så långt jag kunde och
+till slut gav jag fan i hur det såg ut och knöt halsduken om. Halvspringande
+knarrade jag fram över snön i allén för att hinna tillbaks till hotellet innan
+jag helt koagulerade till en isstod.
diff --git a/tex/context/sample/third/falstaff-sv.tex b/tex/context/sample/third/falstaff-sv.tex
new file mode 100644
index 000000000..94bee1532
--- /dev/null
+++ b/tex/context/sample/third/falstaff-sv.tex
@@ -0,0 +1,5 @@
+För att stafva flerstafviga ord kräfvas ord med flera stafvelser. Sådana ord
+kunna mot ringa kostnad anskaffas genom kommissionärer i landsorten eller också
+genom att slå upp någon bok. Ett godt exempel på flerstafviga ord är
+riksdagsmannautskottssuppleantbostadsstäderskevikariebarnbarnsbyxor. Detta ord är
+dock ett af de lättare. Ett svårare ord är deremot lejon.
diff --git a/tex/context/sample/third/lansburgh-letterspacing-sv.tex b/tex/context/sample/third/lansburgh-letterspacing-sv.tex
new file mode 100644
index 000000000..c62367aeb
--- /dev/null
+++ b/tex/context/sample/third/lansburgh-letterspacing-sv.tex
@@ -0,0 +1,6 @@
+Spärrning av betonade (ej av filologiska eller andra skäl urskilda) ord eller
+meningar inom löpande text är typografiskt störande i alla språk och bör undvikas
+så mycket som möjligt. I engelskan är en sådan spärrning okänd och bör
+automatiskt ersättas med kursiv, om detta kan ske utan principiella ingripanden i
+manuskriptets disposition i övrigt. Samma gäller för franskan. Spärrning måste i
+tyskan tolereras mera än i något annat språk. Svenskan intar en medelställning.
diff --git a/tex/context/sample/third/readme.txt b/tex/context/sample/third/readme.txt
index 24fc809e4..6a5ccc06e 100644
--- a/tex/context/sample/third/readme.txt
+++ b/tex/context/sample/third/readme.txt
@@ -126,3 +126,26 @@ vallejo-trilce-es.tex
------------------------------------------------------------------------------------
Poema XXXIII
+
+------------------------------------------------------------------------------------
+alfredsson-sv.tex
+------------------------------------------------------------------------------------
+
+Hans Alfredsson - En ond man
+
+------------------------------------------------------------------------------------
+falstaff-sv.tex
+------------------------------------------------------------------------------------
+
+En hvar sin egen professor eller Allt menskligt vetande i sammandrag. Kortfattad
+encyklopedi af Falstaff Fakir
+
+------------------------------------------------------------------------------------
+lansburgh-letterspacing-sv
+------------------------------------------------------------------------------------
+
+% Lansburgh - Sättningsregler
+% A paragraph on letterspacing
+
+
+
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index e3a64d42f..29ab7c585 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 : 2023-05-08 17:36
+-- merge date : 2023-05-27 12:11
do -- begin closure to overcome local limits and interference
@@ -24852,7 +24852,9 @@ local function unifyglyphs(fontdata,usenames)
if colors then
for i=1,#colors do
local c=colors[i]
- c.slot=indices[c.slot]
+ if c then
+ c.slot=indices[c.slot]
+ end
end
end
end