summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-08-06 17:11:19 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-08-06 17:11:19 +0200
commit5c6090af6fb0808017d6f2fe263b90e2efa0ae5e (patch)
tree84f61dc4994ba9c2376d829b6b71bb3b7e0bb9a5 /tex
parent817e18d3f6969b1b50b4883ec4d5bb05c985db88 (diff)
downloadcontext-5c6090af6fb0808017d6f2fe263b90e2efa0ae5e.tar.gz
2017-08-06 16:19:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/char-def.lua31
-rw-r--r--tex/context/base/mkiv/char-ini.lua14
-rw-r--r--tex/context/base/mkiv/char-prv.lua209
-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-lib.mkvi16
-rw-r--r--tex/context/base/mkiv/font-otj.lua109
-rw-r--r--tex/context/base/mkiv/font-ots.lua763
-rw-r--r--tex/context/base/mkiv/font-oup.lua9
-rw-r--r--tex/context/base/mkiv/font-tra.mkiv4
-rw-r--r--tex/context/base/mkiv/math-def.mkiv6
-rw-r--r--tex/context/base/mkiv/math-ext.lua130
-rw-r--r--tex/context/base/mkiv/math-fbk.lua104
-rw-r--r--tex/context/base/mkiv/math-noa.lua86
-rw-r--r--tex/context/base/mkiv/page-ini.lua51
-rw-r--r--tex/context/base/mkiv/page-ini.mkiv22
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25783 -> 25760 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin426325 -> 427538 bytes
-rw-r--r--tex/context/interface/mkiv/context-en.xml1
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin848192 -> 848075 bytes
-rw-r--r--tex/context/interface/mkiv/i-context.xml1
-rw-r--r--tex/context/interface/mkiv/i-pagemarks.xml10
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60775 -> 60774 bytes
-rw-r--r--tex/context/modules/mkiv/s-fnt-20.mkiv1
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua284
27 files changed, 822 insertions, 1037 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 92f84faee..80ba013ae 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.08.04 09:40}
+\newcontextversion{2017.08.06 16:12}
%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 1b97ea1b6..c375eefaf 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.08.04 09:40}
+\edef\contextversion{2017.08.06 16:12}
%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 13fe01320..93928e548 100644
--- a/tex/context/base/mkiv/char-def.lua
+++ b/tex/context/base/mkiv/char-def.lua
@@ -59359,6 +59359,7 @@ characters.data={
description="DOUBLE VERTICAL LINE",
direction="on",
linebreak="ai",
+ mathpair={ 0x7C, 0x7C },
mathspec={
{
class="delimiter",
@@ -59693,6 +59694,7 @@ characters.data={
linebreak="po",
mathclass="nothing",
mathname="doubleprime",
+ mathpair={ 0x2032, 0x2032 },
specials={ "compat", 0x2032, 0x2032 },
synonyms={ "inches", "seconds" },
unicodeslot=0x2033,
@@ -59704,6 +59706,7 @@ characters.data={
linebreak="po",
mathclass="nothing",
mathname="tripleprime",
+ mathpair={ 0x2033, 0x2032 },
specials={ "compat", 0x2032, 0x2032, 0x2032 },
unicodeslot=0x2034,
},
@@ -59725,6 +59728,7 @@ characters.data={
linebreak="po",
mathclass="nothing",
mathname="reverseddoubleprime",
+ mathpair={ 0x2035, 0x2035 },
specials={ "compat", 0x2035, 0x2035 },
unicodeslot=0x2036,
},
@@ -59735,6 +59739,7 @@ characters.data={
linebreak="po",
mathclass="nothing",
mathname="reversedtripleprime",
+ mathpair={ 0x2036, 0x2035 },
specials={ "compat", 0x2035, 0x2035, 0x2035 },
unicodeslot=0x2037,
},
@@ -60020,6 +60025,7 @@ characters.data={
linebreak="al",
mathclass="nothing",
mathname="quadrupleprime",
+ mathpair={ 0x2034, 0x2032 },
specials={ "compat", 0x2032, 0x2032, 0x2032, 0x2032 },
unicodeslot=0x2057,
},
@@ -62503,6 +62509,7 @@ characters.data={
linebreak="ai",
mathextensible="l",
mathfiller="leftarrowfill",
+ mathpair={ 0x3C, 0x2212 },
mathspec={
{
class="relation",
@@ -62546,6 +62553,7 @@ characters.data={
linebreak="ai",
mathextensible="r",
mathfiller="rightarrowfill",
+ mathpair={ 0x2212, 0x3E },
mathspec={
{
class="relation",
@@ -62591,6 +62599,7 @@ characters.data={
mathclass="relation",
mathextensible="h",
mathname="leftrightarrow",
+ mathpair={ 0x2190, 0x3E },
synonyms={ "relation" },
unicodeslot=0x2194,
variants=variants_emoji,
@@ -63263,6 +63272,7 @@ characters.data={
mathclass="relation",
mathextensible="l",
mathname="Leftarrow",
+ mathpair={ 0x2264, 0x3D },
unicodeslot=0x21D0,
},
[0x21D1]={
@@ -63284,6 +63294,7 @@ characters.data={
direction="on",
linebreak="ai",
mathextensible="r",
+ mathpair={ 0x2261, 0x3E },
mathspec={
{
class="relation",
@@ -63317,6 +63328,7 @@ characters.data={
mathclass="relation",
mathextensible="h",
mathname="Leftrightarrow",
+ mathpair={ 0x2264, 0x3E },
unicodeslot=0x21D4,
},
[0x21D5]={
@@ -64329,6 +64341,7 @@ characters.data={
direction="on",
linebreak="ai",
mathclass="limop",
+ mathpair={ 0x222B, 0x222B },
mathspec={
{
class="limop",
@@ -64348,6 +64361,7 @@ characters.data={
direction="on",
linebreak="al",
mathclass="limop",
+ mathpair={ 0x222C, 0x222B },
mathspec={
{
class="limop",
@@ -64878,6 +64892,7 @@ characters.data={
description="NOT EQUAL TO",
direction="on",
linebreak="ai",
+ mathpair={ 0x21, 0x3D },
mathspec={
{
class="relation",
@@ -64901,6 +64916,7 @@ characters.data={
mathclass="relation",
mathextensible="h",
mathname="equiv",
+ mathpair={ 0x3D, 0x3D },
unicodeslot=0x2261,
},
[0x2262]={
@@ -65026,6 +65042,7 @@ characters.data={
linebreak="ai",
mathclass="relation",
mathname="ll",
+ mathpair={ 0x3C, 0x3C },
mirror=0x226B,
unicodeslot=0x226A,
},
@@ -65038,6 +65055,7 @@ characters.data={
linebreak="ai",
mathclass="relation",
mathname="gg",
+ mathpair={ 0x3E, 0x3E },
mirror=0x226A,
unicodeslot=0x226B,
},
@@ -66193,6 +66211,7 @@ characters.data={
description="VERY MUCH LESS-THAN",
direction="on",
linebreak="al",
+ mathpair={ 0x226A, 0x3C },
mathspec={
{
class="relation",
@@ -66211,6 +66230,7 @@ characters.data={
description="VERY MUCH GREATER-THAN",
direction="on",
linebreak="al",
+ mathpair={ 0x226B, 0x3E },
mathspec={
{
class="relation",
@@ -76581,17 +76601,21 @@ characters.data={
mathextensible="l",
mathfiller="Leftarrowfill",
mathname="Longleftarrow",
+ mathpair={ 0x21D0, 0x3D },
unicodeslot=0x27F8,
},
[0x27F9]={
category="sm",
+ comment="watch the virtual mathpair",
description="LONG RIGHTWARDS DOUBLE ARROW",
direction="on",
linebreak="al",
mathclass="relation",
mathextensible="r",
+ mathextensible="r",
mathfiller="Rightarrowfill",
mathname="Longrightarrow",
+ mathpair={ 0xFE941, 0x3E },
unicodeslot=0x27F9,
},
[0x27FA]={
@@ -76603,6 +76627,7 @@ characters.data={
mathextensible="h",
mathfiller="Leftrightarrowfill",
mathname="Longleftrightarrow",
+ mathpair={ 0x21D0, 0x3E },
unicodeslot=0x27FA,
},
[0x27FB]={
@@ -79434,6 +79459,7 @@ characters.data={
description="TRIPLE VERTICAL BAR DELIMITER",
direction="on",
linebreak="al",
+ mathpair={ 0x2016, 0x7C },
mathspec={
{
class="delimiter",
@@ -80529,6 +80555,7 @@ characters.data={
direction="on",
linebreak="al",
mathclass="limop",
+ mathpair={ 0x222D, 0x222B },
mathspec={
{
class="limop",
@@ -81305,6 +81332,8 @@ characters.data={
description="TWO CONSECUTIVE EQUALS SIGNS",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="eqeq",
specials={ "compat", 0x3D, 0x3D },
unicodeslot=0x2A75,
},
@@ -81313,6 +81342,8 @@ characters.data={
description="THREE CONSECUTIVE EQUALS SIGNS",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="eqeqeq",
specials={ "compat", 0x3D, 0x3D, 0x3D },
unicodeslot=0x2A76,
},
diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua
index 07fb604c1..1dcb62fb3 100644
--- a/tex/context/base/mkiv/char-ini.lua
+++ b/tex/context/base/mkiv/char-ini.lua
@@ -63,6 +63,20 @@ else
end
--[[ldx--
+Extending the table.
+--ldx]]--
+
+if context and not characters.private then
+
+ require("char-prv")
+
+ for unicode, d in next, characters.private do
+ data[unicode] = d
+ end
+
+end
+
+--[[ldx--
<p>This converts a string (if given) into a number.</p>
--ldx]]--
diff --git a/tex/context/base/mkiv/char-prv.lua b/tex/context/base/mkiv/char-prv.lua
new file mode 100644
index 000000000..4d54d038f
--- /dev/null
+++ b/tex/context/base/mkiv/char-prv.lua
@@ -0,0 +1,209 @@
+if not modules then modules = { } end modules ['char-prv'] = {
+ version = 1.001,
+ comment = "companion to char-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files",
+ dataonly = true,
+}
+
+characters = characters or { }
+
+-- 0xFE302 -- 0xFE320 for accents (gone with new lm/gyre)
+-- 0xFE321 -- 0xFE340 for missing characters
+
+-- [0xFE302] = {
+-- category = "mn",
+-- description = "WIDE MATHEMATICAL HAT",
+-- direction = "nsm",
+-- linebreak = "cm",
+-- mathclass = "topaccent",
+-- mathname = "widehat",
+-- mathstretch = "h",
+-- unicodeslot = 0xFE302,
+-- nextinsize = { 0x00302, 0x0005E },
+-- },
+-- [0xFE303] = {
+-- category = "mn",
+-- cjkwd = "a",
+-- description = "WIDE MATHEMATICAL TILDE",
+-- direction = "nsm",
+-- linebreak = "cm",
+-- mathclass = "topaccent",
+-- mathname = "widetilde",
+-- mathstretch = "h",
+-- unicodeslot = 0xFE303,
+-- nextinsize = { 0x00303, 0x0007E },
+-- },
+-- [0xFE304] = {
+-- category = "sm",
+-- description = "TOP AND BOTTOM PARENTHESES",
+-- direction = "on",
+-- linebreak = "al",
+-- mathclass = "doubleaccent",
+-- mathname = "doubleparent",
+-- unicodeslot = 0xFE304,
+-- accents = { 0x023DC, 0x023DD },
+-- },
+-- [0xFE305] = {
+-- category = "sm",
+-- description = "TOP AND BOTTOM BRACES",
+-- direction = "on",
+-- linebreak = "al",
+-- mathclass = "doubleaccent",
+-- mathname = "doublebrace",
+-- unicodeslot = 0xFE305,
+-- accents = { 0x023DE, 0x023DF },
+-- },
+
+characters.private={
+ [0xFE302]={
+ description="EXTENSIBLE OF 0x0302",
+ mathclass="topaccent",
+ mathstretch="h",
+ unicodeslot=0xFE302,
+ },
+ [0xFE303]={
+ description="EXTENSIBLE OF 0x0303",
+ mathclass="topaccent",
+ mathstretch="h",
+ unicodeslot=0xFE303,
+ },
+ [0xFE321]={
+ category="sm",
+ description="MATHEMATICAL SHORT BAR",
+ mathclass="relation",
+ mathname="mapstochar",
+ unicodeslot=0xFE321,
+ },
+ [0xFE322]={
+ category="sm",
+ description="MATHEMATICAL LEFT HOOK",
+ mathclass="relation",
+ mathname="lhook",
+ unicodeslot=0xFE322,
+ },
+ [0xFE323]={
+ category="sm",
+ description="MATHEMATICAL RIGHT HOOK",
+ mathclass="relation",
+ mathname="rhook",
+ unicodeslot=0xFE323,
+ },
+ [0xFE324]={
+ category="sm",
+ description="MATHEMATICAL SHORT BAR MIRRORED",
+ mathclass="relation",
+ mathname="mapsfromchar",
+ unicodeslot=0xFE324,
+ },
+ [0xFE350]={
+ category="sm",
+ description="MATHEMATICAL DOUBLE ARROW LEFT END",
+ mathclass="relation",
+ mathname="ctxdoublearrowfillleftend",
+ unicodeslot=0xFE350,
+ },
+ [0xFE351]={
+ category="sm",
+ description="MATHEMATICAL DOUBLE ARROW MIDDLE PART",
+ mathclass="relation",
+ mathname="ctxdoublearrowfillmiddlepart",
+ unicodeslot=0xFE351,
+ },
+ [0xFE352]={
+ category="sm",
+ description="MATHEMATICAL DOUBLE ARROW RIGHT END",
+ mathclass="relation",
+ mathname="ctxdoublearrowfillrightend",
+ unicodeslot=0xFE352,
+ },
+ [0xFE3B4]={
+ description="EXTENSIBLE OF 0x03B4",
+ mathclass="topaccent",
+ mathextensible="r",
+ mathstretch="h",
+ unicodeslot=0xFE3B4,
+ },
+ [0xFE3B5]={
+ description="EXTENSIBLE OF 0x03B5",
+ mathclass="botaccent",
+ mathextensible="r",
+ mathstretch="h",
+ unicodeslot=0xFE3B5,
+ },
+ [0xFE3DC]={
+ description="EXTENSIBLE OF 0x03DC",
+ mathclass="topaccent",
+ mathextensible="r",
+ mathstretch="h",
+ unicodeslot=0xFE3DC,
+ },
+ [0xFE3DD]={
+ description="EXTENSIBLE OF 0x03DD",
+ mathclass="botaccent",
+ mathextensible="r",
+ mathstretch="h",
+ unicodeslot=0xFE3DD,
+ },
+ [0xFE3DE]={
+ description="EXTENSIBLE OF 0x03DE",
+ mathclass="topaccent",
+ mathextensible="r",
+ mathstretch="h",
+ unicodeslot=0xFE3DE,
+ },
+ [0xFE3DF]={
+ description="EXTENSIBLE OF 0x03DF",
+ mathclass="botaccent",
+ mathextensible="r",
+ mathstretch="h",
+ unicodeslot=0xFE3DF,
+ },
+ [0xFE932]={
+ description="SMASHED PRIME 0x02032",
+ unicodeslot=0xFE932,
+ },
+ [0xFE933]={
+ description="SMASHED PRIME 0x02033",
+ unicodeslot=0xFE933,
+ },
+ [0xFE934]={
+ description="SMASHED PRIME 0x02034",
+ unicodeslot=0xFE934,
+ },
+ [0xFE935]={
+ description="SMASHED BACKWARD PRIME 0x02035",
+ unicodeslot=0xFE935,
+ },
+ [0xFE936]={
+ description="SMASHED BACKWARD PRIME 0x02036",
+ unicodeslot=0xFE936,
+ },
+ [0xFE937]={
+ description="SMASHED BACKWARD PRIME 0x02037",
+ unicodeslot=0xFE937,
+ },
+ [0xFE940]={
+ category="mn",
+ description="SMALL ANNUITY SYMBOL",
+ mathclass="topaccent",
+ mathname="smallactuarial",
+ unicodeslot=0xFE940,
+ },
+ [0xFE941]={
+ category="sm",
+ description="EXTREMELY IDENTICAL TO",
+ mathclass="relation",
+ mathextensible="h",
+ mathname="eqequiv",
+ mathpair={ 0x2261, 0x3D },
+ unicodeslot=0xFE941,
+ },
+ [0xFE957]={
+ description="SMASHED PRIME 0x02057",
+ unicodeslot=0xFE957,
+ },
+}
+
+-- print(table.serialize(characters.private,"characters.private", { hexify = true, noquotes = true }))
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 9af4f2fd3..2d7cdfad4 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.08.04 09:40}
+\newcontextversion{2017.08.06 16:12}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 0a6301ff1..4c6c971b3 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.08.04 09:40}
+\edef\contextversion{2017.08.06 16:12}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-lib.mkvi b/tex/context/base/mkiv/font-lib.mkvi
index 0dfdf0842..2e8d7aa06 100644
--- a/tex/context/base/mkiv/font-lib.mkvi
+++ b/tex/context/base/mkiv/font-lib.mkvi
@@ -44,19 +44,19 @@
\registerctxluafile{font-oto}{1.001}
\registerctxluafile{font-otj}{1.001}
-\doifelsefile{font-oup-new.lua} {
- \registerctxluafile{font-oup-new}{1.001}
-} {
+% \doifelsefile{font-oup-new.lua} {
+% \registerctxluafile{font-oup-new}{1.001}
+% } {
\registerctxluafile{font-oup}{1.001}
-}
+% }
\registerctxluafile{font-ota}{1.001}
-\doifelsefile{font-ots-new.lua} {
- \registerctxluafile{font-ots-new}{1.001}
-} {
+% \doifelsefile{font-ots-new.lua} {
+% \registerctxluafile{font-ots-new}{1.001}
+% } {
\registerctxluafile{font-ots}{1.001}
-}
+% }
\registerctxluafile{font-otd}{1.001}
\registerctxluafile{font-otc}{1.001}
diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua
index 580a65dde..1fbf61197 100644
--- a/tex/context/base/mkiv/font-otj.lua
+++ b/tex/context/base/mkiv/font-otj.lua
@@ -164,7 +164,6 @@ function injections.copy(target,source)
local sp = rawget(properties,source)
if sp then
local tp = rawget(properties,target)
- -- local si = rawget(sp,"injections")
local si = sp.injections
if si then
si = fastcopy(si)
@@ -193,7 +192,6 @@ end
function injections.setligaindex(n,index)
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections")
local i = p.injections
if i then
i.ligaindex = index
@@ -214,7 +212,6 @@ end
function injections.getligaindex(n,default)
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections")
local i = p.injections
if i then
return i.ligaindex or default
@@ -241,7 +238,6 @@ function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmne
--
local p = rawget(properties,start)
if p then
- -- local i = rawget(p,"injections")
local i = p.injections
if i then
i.cursiveanchor = true
@@ -259,7 +255,6 @@ function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmne
end
local p = rawget(properties,nxt)
if p then
- -- local i = rawget(p,"injections")
local i = p.injections
if i then
i.cursivex = dx
@@ -300,8 +295,7 @@ function injections.setposition(current,factor,rlmode,r2lflag,spec,injection) --
end
local p = rawget(properties,current)
if p then
- -- local i = p[injection]
- local i = rawget(p,injection)
+ local i = p[injection]
if i then
if leftkern ~= 0 then
i.leftkern = (i.leftkern or 0) + leftkern
@@ -357,7 +351,7 @@ function injections.setkern(current,factor,rlmode,x,injection)
injection = "injections"
end
if p then
- local i = rawget(p,injection)
+ local i = p[injection]
if i then
i.leftkern = dx + (i.leftkern or 0)
else
@@ -391,7 +385,7 @@ function injections.setmove(current,factor,rlmode,x,injection)
injection = "injections"
end
if p then
- local i = rawget(p,injection)
+ local i = p[injection]
if i then
i.leftkern = dx + (i.leftkern or 0)
else
@@ -421,7 +415,6 @@ function injections.setmark(start,base,factor,rlmode,ba,ma,tfmbase,mkmk,checkmar
local p = rawget(properties,start)
-- hm, dejavu serif does a sloppy mark2mark before mark2base
if p then
- -- local i = rawget(p,"injections")
local i = p.injections
if i then
if i.markmark then
@@ -475,7 +468,7 @@ local function show(n,what,nested,symbol)
if n then
local p = rawget(properties,n)
if p then
- local i = rawget(p,what)
+ local i = p[what]
if i then
local leftkern = i.leftkern or 0
local rightkern = i.rightkern or 0
@@ -608,7 +601,6 @@ local function inject_kerns_only(head,where)
if char then
local p = rawget(properties,current)
if p then
- -- local i = rawget(p,"injections")
local i = p.injections
if i then
-- left|glyph|right
@@ -620,7 +612,6 @@ local function inject_kerns_only(head,where)
if prevdisc then
local done = false
if post then
- -- local i = rawget(p,"postinjections")
local i = p.postinjections
if i then
local leftkern = i.leftkern
@@ -631,7 +622,6 @@ local function inject_kerns_only(head,where)
end
end
if replace then
- -- local i = rawget(p,"replaceinjections")
local i = p.replaceinjections
if i then
local leftkern = i.leftkern
@@ -641,7 +631,6 @@ local function inject_kerns_only(head,where)
end
end
else
- -- local i = rawget(p,"emptyinjections")
local i = p.emptyinjections
if i then
-- glyph|disc|glyph (special case)
@@ -670,7 +659,6 @@ local function inject_kerns_only(head,where)
for n in traverse_char(pre) do
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections") or rawget(p,"preinjections")
local i = p.injections or p.preinjections
if i then
local leftkern = i.leftkern
@@ -687,7 +675,6 @@ local function inject_kerns_only(head,where)
for n in traverse_char(post) do
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections") or rawget(p,"postinjections")
local i = p.injections or p.postinjections
if i then
local leftkern = i.leftkern
@@ -704,7 +691,6 @@ local function inject_kerns_only(head,where)
for n in traverse_char(replace) do
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections") or rawget(p,"replaceinjections")
local i = p.injections or p.replaceinjections
if i then
local leftkern = i.leftkern
@@ -762,7 +748,6 @@ local function inject_positions_only(head,where)
if char then
local p = rawget(properties,current)
if p then
- -- local i = rawget(p,"injections")
local i = p.injections
if i then
-- left|glyph|right
@@ -779,11 +764,9 @@ local function inject_positions_only(head,where)
insert_node_after(head,current,fontkern(rightkern))
end
else
- -- local i = rawget(p,"emptyinjections")
local i = p.emptyinjections
if i then
-- glyph|disc|glyph (special case)
--- is this okay?
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
if next and getid(next) == disc_code then
@@ -799,7 +782,6 @@ local function inject_positions_only(head,where)
if prevdisc then
local done = false
if post then
- -- local i = rawget(p,"postinjections")
local i = p.postinjections
if i then
local leftkern = i.leftkern
@@ -810,7 +792,6 @@ local function inject_positions_only(head,where)
end
end
if replace then
- -- local i = rawget(p,"replaceinjections")
local i = p.replaceinjections
if i then
local leftkern = i.leftkern
@@ -847,7 +828,6 @@ local function inject_positions_only(head,where)
for n in traverse_char(pre) do
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections") or rawget(p,"preinjections")
local i = p.injections or p.preinjections
if i then
local yoffset = i.yoffset
@@ -873,7 +853,6 @@ local function inject_positions_only(head,where)
for n in traverse_char(post) do
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections") or rawget(p,"postinjections")
local i = p.injections or p.postinjections
if i then
local yoffset = i.yoffset
@@ -899,7 +878,6 @@ local function inject_positions_only(head,where)
for n in traverse_char(replace) do
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections") or rawget(p,"replaceinjections")
local i = p.injections or p.replaceinjections
if i then
local yoffset = i.yoffset
@@ -924,7 +902,6 @@ local function inject_positions_only(head,where)
if pre then
local p = rawget(properties,prevglyph)
if p then
- -- local i = rawget(p,"preinjections")
local i = p.preinjections
if i then
-- glyph|pre glyphs
@@ -939,7 +916,6 @@ local function inject_positions_only(head,where)
if replace then
local p = rawget(properties,prevglyph)
if p then
- -- local i = rawget(p,"replaceinjections")
local i = p.replaceinjections
if i then
-- glyph|replace glyphs
@@ -976,15 +952,6 @@ local function inject_positions_only(head,where)
return tonode(head), true
end
--- local function showoffset(n,flag)
--- local x, y = getoffsets(n)
--- if x ~= 0 or y ~= 0 then
--- setcolor(n,flag and "darkred" or "darkgreen") -- maybe better grays
--- else
--- resetcolor(n)
--- end
--- end
-
local function showoffset(n,flag)
local x, y = getoffsets(n)
if x ~= 0 or y ~= 0 then
@@ -1031,7 +998,6 @@ local function inject_everything(head,where)
local rightkern = nil
local pp = rawget(properties,p)
if pp then
- -- pp = rawget(pp,"injections")
pp = pp.injections
if pp then
rightkern = pp.rightkern
@@ -1041,10 +1007,9 @@ local function inject_everything(head,where)
if pn.markdir < 0 then
-- kern(w-x) glyph(p) kern(x) mark(n)
ox = px - pn.markx - rightkern
- -- report_injections("r2l case 1: %p",ox)
-if not pn.markmark then -- check or not (no longer needed)
- ox = ox + (pn.leftkern or 0)
-end
+ if not pn.markmark then
+ ox = ox + (pn.leftkern or 0)
+ end
else
-- kern(x) glyph(p) kern(w-x) mark(n)
-- ox = px - getwidth(p) + pn.markx - pp.leftkern
@@ -1053,31 +1018,28 @@ end
-- pretty sure I've run into a case where it was needed so maybe
-- some day we need something more clever here.
--
+ -- maybe we need to apply both then
+ --
+ ox = px - pn.markx - rightkern -- seguiemj needs the rightkern
if false then
- -- a mark with kerning
+ -- a mark with kerning (maybe husayni needs it )
local leftkern = pp.leftkern
if leftkern then
- ox = px - pn.markx - leftkern
- else
- ox = px - pn.markx
+ ox = ox - leftkern
end
- else
- ox = px - pn.markx - rightkern -- seguiemj needs the rightkern
end
end
else
if pn.markdir < 0 then
ox = px - pn.markx
--- pair stuff: husayni needs it
-if not pn.markmark then -- check or not (no longer needed)
- ox = ox + (pn.leftkern or 0)
-end
---
- -- report_injections("r2l case 3: %p",ox)
+ if not pn.markmark then
+ local leftkern = pn.leftkern
+ if leftkern then
+ ox = ox + leftkern -- husayni needs it
+ end
+ end
else
- -- ox = px - getwidth(p) + pn.markx
ox = px - pn.markx
- -- report_injections("l2r case 3: %p",ox)
end
if pn.checkmark then
local wn = getwidth(n) -- in arial marks have widths
@@ -1087,23 +1049,28 @@ end
report_injections("correcting non zero width mark %C",getchar(n))
end
-- -- bad: we should center
+ --
-- pn.leftkern = -wn
-- pn.rightkern = -wn
- -- -- we're too late anyway as kerns are already injected so
- -- -- we do it the ugly way (no checking if the previous is
- -- -- already a kern) .. maybe we should fix the font instead
- -- hm, no head ?
+ --
+ -- -- we're too late anyway as kerns are already injected so we do it the
+ -- -- ugly way (no checking if the previous is already a kern) .. maybe we
+ -- -- should fix the font instead
+ --
+ -- todo: head and check for prev / next kern
+ --
insert_node_before(n,n,fontkern(-wn))
insert_node_after(n,n,fontkern(-wn))
end
end
end
local oy = ny + py + pn.marky
--- pair stuff: husayni needs it
-if not pn.markmark then
- oy = oy + (pn.yoffset or 0)
-end
---
+ if not pn.markmark then
+ local yoffset = pn.yoffset
+ if yoffset then
+ oy = oy + yoffset -- husayni needs it
+ end
+ end
setoffsets(n,ox,oy)
if trace_marks then
showoffset(n,true)
@@ -1115,7 +1082,6 @@ end
if char then
local p = rawget(properties,current)
if p then
- -- local i = rawget(p,"injections")
local i = p.injections
if i then
local pm = i.markbasenode
@@ -1189,11 +1155,9 @@ end
end
end
else
- -- local i = rawget(p,"emptyinjections")
local i = p.emptyinjections
if i then
-- glyph|disc|glyph (special case)
- -- okay?
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
if next and getid(next) == disc_code then
@@ -1210,7 +1174,6 @@ end
if p then
local done = false
if post then
- -- local i = rawget(p,"postinjections")
local i = p.postinjections
if i then
local leftkern = i.leftkern
@@ -1221,7 +1184,6 @@ end
end
end
if replace then
- -- local i = rawget(p,"replaceinjections")
local i = p.replaceinjections
if i then
local leftkern = i.leftkern
@@ -1231,7 +1193,6 @@ end
end
end
else
- -- local i = rawget(p,"emptyinjections")
local i = p.emptyinjections
if i then
local leftkern = i.leftkern
@@ -1272,7 +1233,6 @@ end
for n in traverse_char(pre) do
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections") or rawget(p,"preinjections")
local i = p.injections or p.preinjections
if i then
local yoffset = i.yoffset
@@ -1304,7 +1264,6 @@ end
for n in traverse_char(post) do
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections") or rawget(p,"postinjections")
local i = p.injections or p.postinjections
if i then
local yoffset = i.yoffset
@@ -1336,7 +1295,6 @@ end
for n in traverse_char(replace) do
local p = rawget(properties,n)
if p then
- -- local i = rawget(p,"injections") or rawget(p,"replaceinjections")
local i = p.injections or p.replaceinjections
if i then
local yoffset = i.yoffset
@@ -1367,7 +1325,6 @@ end
if pre then
local p = rawget(properties,prevglyph)
if p then
- -- local i = rawget(p,"preinjections")
local i = p.preinjections
if i then
-- glyph|pre glyphs
@@ -1382,7 +1339,6 @@ end
if replace then
local p = rawget(properties,prevglyph)
if p then
- -- local i = rawget(p,"replaceinjections")
local i = p.replaceinjections
if i then
-- glyph|replace glyphs
@@ -1424,7 +1380,6 @@ end
for i=1,nofmarks do
local m = marks[i]
local p = rawget(properties,m)
- -- local i = rawget(p,"injections")
local i = p.injections
local b = i.markbasenode
processmark(b,m,i)
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 7194109a1..43585552b 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -169,6 +169,7 @@ registertracker("otf.substitutions", "otf.singles","otf.multiples","otf.alternat
registertracker("otf.positions", "otf.marks","otf.kerns","otf.cursive")
registertracker("otf.actions", "otf.substitutions","otf.positions")
registertracker("otf.sample", "otf.steps","otf.substitutions","otf.positions","otf.analyzing")
+registertracker("otf.sample.silent", "otf.steps=silent","otf.substitutions","otf.positions","otf.analyzing")
local nuts = nodes.nuts
local tonode = nuts.tonode
@@ -305,6 +306,9 @@ local registermessage = (tracers and tracers.steppers.message) or function()
local function logprocess(...)
if trace_steps then
registermessage(...)
+ if trace_steps == "silent" then
+ return
+ end
end
report_direct(...)
end
@@ -490,7 +494,7 @@ local function markstoligature(head,start,stop,char)
end
end
-local function toligature(head,start,stop,char,dataset,sequence,markflag,discfound) -- brr head
+local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfound) -- brr head
if getattr(start,a_noligature) == 1 then
-- so we can do: e\noligature{ff}e e\noligature{f}fie (we only look at the first)
return head, start
@@ -515,7 +519,7 @@ local function toligature(head,start,stop,char,dataset,sequence,markflag,discfou
set_components(base,comp)
setlink(prev,base,next)
if not discfound then
- local deletemarks = markflag ~= "mark"
+ local deletemarks = not skiphash
local components = start
local baseindex = 0
local componentindex = 0
@@ -600,7 +604,7 @@ local function toligature(head,start,stop,char,dataset,sequence,markflag,discfou
return head, base
end
-local function multiple_glyphs(head,start,multiple,ignoremarks,what)
+local function multiple_glyphs(head,start,multiple,skiphash,what) -- what to do with skiphash matches here
local nofmultiples = #multiple
if nofmultiples > 0 then
resetinjection(start)
@@ -693,7 +697,7 @@ function handlers.gsub_single(head,start,dataset,sequence,replacement)
return head, start, true
end
-function handlers.gsub_alternate(head,start,dataset,sequence,alternative,rlmode,skiphash)
+function handlers.gsub_alternate(head,start,dataset,sequence,alternative)
local kind = dataset[4]
local what = dataset[1]
local value = what == true and tfmdata.shared.features[kind] or what
@@ -716,7 +720,7 @@ function handlers.gsub_multiple(head,start,dataset,sequence,multiple,rlmode,skip
if trace_multiples then
logprocess("%s: replacing %s by multiple %s",pref(dataset,sequence),gref(getchar(start)),gref(multiple))
end
- return multiple_glyphs(head,start,multiple,sequence.flags[1],dataset[1])
+ return multiple_glyphs(head,start,multiple,skiphash,dataset[1])
end
-- Don't we deal with disc otherwise now? I need to check if the next one can be
@@ -729,7 +733,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
end
local stop = nil
local startchar = getchar(start)
- if marks[startchar] then
+ if skiphash and skiphash[startchar] then
while current do
local char = ischar(current,currentfont)
if char then
@@ -761,13 +765,12 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
end
end
else
- local skipmark = sequence.flags[1]
local discfound = false
local lastdisc = nil
while current do
local char, id = ischar(current,currentfont)
if char then
- if skipmark and marks[char] then
+ if skiphash and skiphash[char] then
current = getnext(current)
else -- ligature is a tree
local lg = ligature[char] -- can there be multiple in a row? maybe in a bad font
@@ -820,10 +823,10 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
if stop then
if trace_ligatures then
local stopchar = getchar(stop)
- head, start = toligature(head,start,stop,lig,dataset,sequence,skipmark,discfound)
+ head, start = toligature(head,start,stop,lig,dataset,sequence,skiphash,discfound)
logprocess("%s: replacing %s upto %s by ligature %s case 2",pref(dataset,sequence),gref(startchar),gref(stopchar),gref(lig))
else
- head, start = toligature(head,start,stop,lig,dataset,sequence,skipmark,discfound)
+ head, start = toligature(head,start,stop,lig,dataset,sequence,skiphash,discfound)
end
else
-- weird but happens (in some arabic font)
@@ -867,12 +870,9 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st
while snext do
local nextchar = ischar(snext,currentfont)
if nextchar then
- if marks[nextchar] and sequence.flags[1] then
+ if skiphash and skiphash[nextchar] then -- includes marks too when flag
prev = snext
snext = getnext(snext)
--- if skiphash and skiphash[nextchar] then -- includes marks too when flag
--- prev = snext
--- snext = getnext(snext)
else
local krn = kerns[nextchar]
if not krn then
@@ -1129,6 +1129,9 @@ local chainprocs = { }
local function logprocess(...)
if trace_steps then
registermessage(...)
+ if trace_steps == "silent" then
+ return
+ end
end
report_subchain(...)
end
@@ -1138,6 +1141,9 @@ local logwarning = report_subchain
local function logprocess(...)
if trace_steps then
registermessage(...)
+ if trace_steps == "silent" then
+ return
+ end
end
report_chain(...)
end
@@ -1205,17 +1211,31 @@ end
-- logwarning("%s: bad step, no proper return values",cref(dataset,sequence))
-- end
-function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+local function getmapping(dataset,sequence,currentlookup)
local steps = currentlookup.steps
local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
- end
if nofsteps == 0 then
reportzerosteps(dataset,sequence)
+ currentlookup.mapping = false
+ return false
else
- local current = start
+ if nofsteps > 1 then
+ reportmoresteps(dataset,sequence)
+ end
local mapping = steps[1].coverage
+ currentlookup.mapping = mapping
+ currentlookup.format = steps[1].format
+ return mapping
+ end
+end
+
+function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
+ end
+ if mapping then
+ local current = start
while current do
local currentchar = ischar(current)
if currentchar then
@@ -1246,35 +1266,6 @@ function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,r
end
--[[ldx--
-<p>Here we replace start by a sequence of new glyphs.</p>
---ldx]]--
-
-function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup)
- local steps = currentlookup.steps
- local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
- end
- if nofsteps == 0 then
- reportzerosteps(dataset,sequence)
- else
- local startchar = getchar(start)
- local replacement = steps[1].coverage[startchar]
- if not replacement or replacement == "" then
- if trace_bugs then
- logwarning("%s: no multiple for %s",cref(dataset,sequence),gref(startchar))
- end
- else
- if trace_multiples then
- logprocess("%s: replacing %s by multiple characters %s",cref(dataset,sequence),gref(startchar),gref(replacement))
- end
- return multiple_glyphs(head,start,replacement,sequence.flags[1],dataset[1])
- end
- end
- return head, start, false
-end
-
---[[ldx--
<p>Here we replace start by new glyph. First we delete the rest of the match.</p>
--ldx]]--
@@ -1286,20 +1277,16 @@ end
-- marks come last anyway
-- are there cases where we need to delete the mark
-function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlookup)
- local steps = currentlookup.steps
- local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
end
- if nofsteps == 0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local kind = dataset[4]
local what = dataset[1]
local value = what == true and tfmdata.shared.features[kind] or what -- todo: optimize in ctx
local current = start
- local mapping = steps[1].coverage
while current do
local currentchar = ischar(current)
if currentchar then
@@ -1333,22 +1320,45 @@ function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlooku
end
--[[ldx--
+<p>Here we replace start by a sequence of new glyphs.</p>
+--ldx]]--
+
+function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
+ end
+ if mapping then
+ local startchar = getchar(start)
+ local replacement = mapping[startchar]
+ if not replacement or replacement == "" then
+ if trace_bugs then
+ logwarning("%s: no multiple for %s",cref(dataset,sequence),gref(startchar))
+ end
+ else
+ if trace_multiples then
+ logprocess("%s: replacing %s by multiple characters %s",cref(dataset,sequence),gref(startchar),gref(replacement))
+ end
+ return multiple_glyphs(head,start,replacement,skiphash,dataset[1])
+ end
+ end
+ return head, start, false
+end
+
+--[[ldx--
<p>When we replace ligatures we use a helper that handles the marks. I might change
this function (move code inline and handle the marks by a separate function). We
assume rather stupid ligatures (no complex disc nodes).</p>
--ldx]]--
-function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup,chainindex)
- local steps = currentlookup.steps
- local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
end
- if nofsteps == 0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local startchar = getchar(start)
- local ligatures = steps[1].coverage[startchar]
+ local ligatures = mapping[startchar]
if not ligatures then
if trace_bugs then
logwarning("%s: no ligatures starting with %s",cref(dataset,sequence,chainindex),gref(startchar))
@@ -1358,7 +1368,6 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
local discfound = false
local last = stop
local nofreplacements = 1
- local skipmark = currentlookup.flags[1] -- sequence.flags?
while current do
-- todo: ischar ... can there really be disc nodes here?
local id = getid(current)
@@ -1373,7 +1382,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
end
else
local schar = getchar(current)
- if skipmark and marks[schar] then -- marks
+ if skiphash and skiphash[schar] then -- marks
-- if current == stop then -- maybe add this
-- break
-- else
@@ -1408,7 +1417,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
logprocess("%s: replacing character %s upto %s by ligature %s case 4",cref(dataset,sequence,chainindex),gref(startchar),gref(getchar(stop)),gref(ligature))
end
end
- head, start = toligature(head,start,stop,ligature,dataset,sequence,skipmark,discfound)
+ head, start = toligature(head,start,stop,ligature,dataset,sequence,skiphash,discfound)
return head, start, true, nofreplacements, discfound
elseif trace_bugs then
if start == stop then
@@ -1423,21 +1432,15 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
end
function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
- local steps = currentlookup.steps
- local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
end
- if nofsteps == 0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local startchar = getchar(start)
- local step = steps[1]
- local kerns = step.coverage[startchar]
- if not kerns then
- -- skip
- else
- local format = step.format
+ local kerns = mapping[startchar]
+ if kerns then
+ local format = currentlookup.format
if format == "single" then
local dx, dy, w, h = setposition(start,factor,rlmode,sequence.flags[4],kerns) -- currentlookup.flags ?
if trace_kerns then
@@ -1455,19 +1458,15 @@ function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,r
end
function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) -- todo: injections ?
- local steps = currentlookup.steps
- local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
end
- if nofsteps == 0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local snext = getnext(start)
if snext then
local startchar = getchar(start)
- local step = steps[1]
- local kerns = step.coverage[startchar] -- always 1 step
+ local kerns = mapping[startchar] -- always 1 step
if kerns then
local prev = start
while snext do
@@ -1475,18 +1474,15 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm
if not nextchar then
break
end
- if marks[nextchar] and sequence.flags[1] then
+ if skiphash and skiphash[nextchar] then
prev = snext
snext = getnext(snext)
--- if skiphash and skiphash[nextchar] then
--- prev = snext
--- snext = getnext(snext)
else
local krn = kerns[nextchar]
if not krn then
break
end
- local format = step.format
+ local format = currentlookup.format
if format == "pair" then
local a, b = krn[1], krn[2]
if a == true then
@@ -1529,18 +1525,15 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm
return head, start, false
end
-function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash)
- local steps = currentlookup.steps
- local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
end
- if nofsteps == 0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local markchar = getchar(start)
if marks[markchar] then
- local markanchors = steps[1].coverage[markchar] -- always 1 step
+ local markanchors = mapping[markchar] -- always 1 step
if markanchors then
local base = getprev(start) -- [glyph] [start=mark]
if base then
@@ -1597,18 +1590,15 @@ function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlooku
return head, start, false
end
-function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash)
- local steps = currentlookup.steps
- local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
end
- if nofsteps == 0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local markchar = getchar(start)
if marks[markchar] then
- local markanchors = steps[1].coverage[markchar] -- always 1 step
+ local markanchors = mapping[markchar] -- always 1 step
if markanchors then
local base = getprev(start) -- [glyph] [optional marks] [start=mark]
if base then
@@ -1669,18 +1659,15 @@ function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentl
return head, start, false
end
-function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash)
- local steps = currentlookup.steps
- local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
end
- if nofsteps == 0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local markchar = getchar(start)
if marks[markchar] then
- local markanchors = steps[1].coverage[markchar] -- always 1 step
+ local markanchors = mapping[markchar] -- always 1 step
if markanchors then
local base = getprev(start) -- [glyph] [basemark] [start=mark]
local slc = getligaindex(start)
@@ -1725,17 +1712,14 @@ function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlooku
return head, start, false
end
-function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash)
- local steps = currentlookup.steps
- local nofsteps = currentlookup.nofsteps
- if nofsteps > 1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping = currentlookup.mapping
+ if mapping == nil then
+ mapping = getmapping(dataset,sequence,currentlookup)
end
- if nofsteps == 0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local startchar = getchar(start)
- local exitanchors = steps[1].coverage[startchar] -- always 1 step
+ local exitanchors = mapping[startchar] -- always 1 step
if exitanchors then
if marks[startchar] then
if trace_cursive then
@@ -1789,28 +1773,29 @@ end
-- A previous version had disc collapsing code in the (single sub) handler plus some
-- checking in the main loop, but that left the pre/post sequences undone. The best
-- solution is to add some checking there and backtrack when a replace/post matches
--- but it takes a bit of work to figure out an efficient way (this is what the sweep*
--- names refer to). I might look into that variant one day again as it can replace
--- some other code too. In that approach we can have a special version for gub and pos
--- which gains some speed. This method does the test and passes info to the handlers.
--- Here collapsing is handled in the main loop which also makes code elsewhere simpler
--- (i.e. no need for the other special runners and disc code in ligature building). I
--- also experimented with pushing preceding glyphs sequences in the replace/pre fields
--- beforehand which saves checking afterwards but at the cost of duplicate glyphs
--- (memory) but it's too much overhead (runtime).
+-- but it takes a bit of work to figure out an efficient way (this is what the
+-- sweep* names refer to). I might look into that variant one day again as it can
+-- replace some other code too. In that approach we can have a special version for
+-- gub and pos which gains some speed. This method does the test and passes info to
+-- the handlers. Here collapsing is handled in the main loop which also makes code
+-- elsewhere simpler (i.e. no need for the other special runners and disc code in
+-- ligature building). I also experimented with pushing preceding glyphs sequences
+-- in the replace/pre fields beforehand which saves checking afterwards but at the
+-- cost of duplicate glyphs (memory) but it's too much overhead (runtime).
--
--- In the meantime Kai had moved the code from the single chain into a more general handler
--- and this one (renamed to chaindisk) is used now. I optimized the code a bit and brought
--- it in sycn with the other code. Hopefully I didn't introduce errors. Note: this somewhat
--- complex approach is meant for fonts that implement (for instance) ligatures by character
--- replacement which to some extend is not that suitable for hyphenation. I also use some
--- helpers. This method passes some states but reparses the list. There is room for a bit of
--- speed up but that will be done in the context version. (In fact a partial rewrite of all
--- code can bring some more efficientry.)
+-- In the meantime Kai had moved the code from the single chain into a more general
+-- handler and this one (renamed to chaindisk) is used now. I optimized the code a
+-- bit and brought it in sycn with the other code. Hopefully I didn't introduce
+-- errors. Note: this somewhat complex approach is meant for fonts that implement
+-- (for instance) ligatures by character replacement which to some extend is not
+-- that suitable for hyphenation. I also use some helpers. This method passes some
+-- states but reparses the list. There is room for a bit of speed up but that will
+-- be done in the context version. (In fact a partial rewrite of all code can bring
+-- some more efficiency.)
--
--- I didn't test it with extremes but successive disc nodes still can give issues but in
--- order to handle that we need more complex code which also slows down even more. The main
--- loop variant could deal with that: test, collapse, backtrack.
+-- I didn't test it with extremes but successive disc nodes still can give issues
+-- but in order to handle that we need more complex code which also slows down even
+-- more. The main loop variant could deal with that: test, collapse, backtrack.
local userkern = nuts.pool and nuts.pool.newkern -- context
@@ -1937,7 +1922,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck)
local chainproc = chainprocs[chainkind]
if chainproc then
local ok, n
- head, start, ok, n = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash)
+ head, start, ok, n = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,i)
-- messy since last can be changed !
if ok then
done = true
@@ -2319,452 +2304,16 @@ local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match)
local last = ck[5]
local char = getchar(start)
logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a",
- cref(dataset,sequence),rule,match and "matches" or "nomatch",gref(char),first-1,last-first+1,nofseq-last,lookuptype)
+ cref(dataset,sequence),rule,match and "matches" or "nomatch",
+ gref(char),first-1,last-first+1,nofseq-last,lookuptype)
end
--- The next one is quite optimized but still somewhat slow, fonts like ebgaramond are real torture
--- tests because they have many steps with one context (having multiple contexts makes more sense)
--- also because we (can) reduce them.
-
--- local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash)
--- local sweepnode = sweepnode
--- local sweeptype = sweeptype
--- local currentfont = currentfont
--- local diskseen = false
--- local checkdisc = sweeptype and getprev(head)
--- local flags = sequence.flags or noflags
--- local done = false
--- local skipped = false
--- local startprev,
--- startnext = getboth(start)
---
--- for k=1,#contexts do -- i've only seen ccmp having > 1 (e.g. dejavu)
--- local match = true
--- local current = start
--- local last = start
--- local ck = contexts[k]
--- local seq = ck[3]
--- local s = #seq
--- -- f..l = mid string
--- if s == 1 then
--- -- this seldom happens as it makes no sense (bril, ebgaramond, husayni, minion)
--- local char = ischar(current,currentfont)
--- if char and not seq[1][char] then
--- match = false
--- end
--- else
--- -- maybe we need a better space check (maybe check for glue or category or combination)
--- -- we cannot optimize for n=2 because there can be disc nodes
--- local f = ck[4]
--- local l = ck[5]
--- -- current match
--- -- seq[f][ischar(current,currentfont)] is not nil
--- if l > f then
--- -- before/current/after | before/current | current/after
--- local discfound -- = nil
--- local n = f + 1
--- last = startnext -- the second in current (first already matched)
--- while n <= l do
--- if not last and (sweeptype == "post" or sweeptype == "replace") then
--- last = getnext(sweepnode)
--- sweeptype = nil
--- end
--- if last then
--- local char, id = ischar(last,currentfont)
--- if char then
--- if skiphash and skiphash[char] then
--- skipped = true
--- if trace_skips then
--- show_skip(dataset,sequence,char,ck,classes[char])
--- end
--- last = getnext(last)
--- else
--- if seq[n][char] then
--- if n < l then
--- last = getnext(last)
--- end
--- n = n + 1
--- else
--- if discfound then
--- notmatchreplace[discfound] = true
--- if notmatchpre[discfound] then
--- match = false
--- end
--- else
--- match = false
--- end
--- break
--- end
--- end
--- elseif char == false then
--- if discfound then
--- notmatchreplace[discfound] = true
--- if notmatchpre[discfound] then
--- match = false
--- end
--- else
--- match = false
--- end
--- break
--- elseif id == disc_code then
--- diskseen = true
--- discfound = last
--- notmatchpre[last] = nil
--- notmatchpost[last] = true
--- notmatchreplace[last] = nil
--- local pre, post, replace = getdisc(last)
--- if pre then
--- local n = n
--- while pre do
--- if seq[n][getchar(pre)] then
--- n = n + 1
--- if n > l then
--- break
--- end
--- pre = getnext(pre)
--- else
--- notmatchpre[last] = true
--- break
--- end
--- end
--- if n <= l then
--- notmatchpre[last] = true
--- end
--- else
--- notmatchpre[last] = true
--- end
--- if replace then
--- -- so far we never entered this branch
--- while replace do
--- if seq[n][getchar(replace)] then
--- n = n + 1
--- if n > l then
--- break
--- end
--- replace = getnext(replace)
--- else
--- notmatchreplace[last] = true
--- if notmatchpre[last] then
--- match = false
--- end
--- break
--- end
--- end
--- -- why here again
--- if notmatchpre[last] then
--- match = false
--- end
--- end
--- -- maybe only if match
--- last = getnext(last)
--- else
--- match = false
--- break
--- end
--- else
--- match = false
--- break
--- end
--- end
--- end
--- -- before
--- if match and f > 1 then
--- if startprev then
--- local prev = startprev
--- if prev == checkdisc and (sweeptype == "pre" or sweeptype == "replace") then
--- prev = getprev(sweepnode)
--- end
--- if prev then
--- local discfound -- = nil
--- local n = f - 1
--- while n >= 1 do
--- if prev then
--- local char, id = ischar(prev,currentfont)
--- if char then
--- if skiphash and skiphash[char] then
--- skipped = true
--- if trace_skips then
--- show_skip(dataset,sequence,char,ck,classes[char])
--- end
--- prev = getprev(prev)
--- else
--- if seq[n][char] then
--- if n > 1 then
--- prev = getprev(prev)
--- end
--- n = n - 1
--- else
--- if discfound then
--- notmatchreplace[discfound] = true
--- if notmatchpost[discfound] then
--- match = false
--- end
--- else
--- match = false
--- end
--- break
--- end
--- end
--- elseif char == false then
--- if discfound then
--- notmatchreplace[discfound] = true
--- if notmatchpost[discfound] then
--- match = false
--- end
--- else
--- match = false
--- end
--- break
--- elseif id == disc_code then
--- -- the special case: f i where i becomes dottless i ..
--- diskseen = true
--- discfound = prev
--- notmatchpre[prev] = true
--- notmatchpost[prev] = nil
--- notmatchreplace[prev] = nil
--- local pre, post, replace, pretail, posttail, replacetail = getdisc(prev,true)
--- if pre ~= start and post ~= start and replace ~= start then
--- if post then
--- local n = n
--- while posttail do
--- if seq[n][getchar(posttail)] then
--- n = n - 1
--- if posttail == post then
--- break
--- else
--- if n < 1 then
--- break
--- end
--- posttail = getprev(posttail)
--- end
--- else
--- notmatchpost[prev] = true
--- break
--- end
--- end
--- if n >= 1 then
--- notmatchpost[prev] = true
--- end
--- else
--- notmatchpost[prev] = true
--- end
--- if replace then
--- -- we seldom enter this branch (e.g. on brill efficient)
--- while replacetail do
--- if seq[n][getchar(replacetail)] then
--- n = n - 1
--- if replacetail == replace then
--- break
--- else
--- if n < 1 then
--- break
--- end
--- replacetail = getprev(replacetail)
--- end
--- else
--- notmatchreplace[prev] = true
--- if notmatchpost[prev] then
--- match = false
--- end
--- break
--- end
--- end
--- if not match then
--- break
--- end
--- end
--- end
--- -- maybe only if match
--- prev = getprev(prev)
--- -- elseif id == glue_code and seq[n][32] and isspace(prev,threshold,id) then
--- -- n = n - 1
--- -- prev = getprev(prev)
--- elseif id == glue_code then
--- local sn = seq[n]
--- if (sn[32] and spaces[prev]) or sn[0xFFFC] then
--- n = n - 1
--- prev = getprev(prev)
--- else
--- match = false
--- break
--- end
--- elseif seq[n][0xFFFC] then
--- n = n - 1
--- prev = getprev(prev)
--- else
--- match = false
--- break
--- end
--- else
--- match = false
--- break
--- end
--- end
--- else
--- match = false
--- end
--- else
--- match = false
--- end
--- end
--- -- after
--- if match and s > l then
--- local current = last and getnext(last)
--- if not current and (sweeptype == "post" or sweeptype == "replace") then
--- current = getnext(sweepnode)
--- end
--- if current then
--- local discfound -- = nil
--- -- removed optimization for s-l == 1, we have to deal with marks anyway
--- local n = l + 1
--- while n <= s do
--- if current then
--- local char, id = ischar(current,currentfont)
--- if char then
--- if skiphash and skiphash[char] then
--- skipped = true
--- if trace_skips then
--- show_skip(dataset,sequence,char,ck,classes[char])
--- end
--- current = getnext(current) -- was absent
--- else
--- if seq[n][char] then
--- if n < s then -- new test
--- current = getnext(current) -- was absent
--- end
--- n = n + 1
--- else
--- if discfound then
--- notmatchreplace[discfound] = true
--- if notmatchpre[discfound] then
--- match = false
--- end
--- else
--- match = false
--- end
--- break
--- end
--- end
--- elseif char == false then
--- if discfound then
--- notmatchreplace[discfound] = true
--- if notmatchpre[discfound] then
--- match = false
--- end
--- else
--- match = false
--- end
--- break
--- elseif id == disc_code then
--- diskseen = true
--- discfound = current
--- notmatchpre[current] = nil
--- notmatchpost[current] = true
--- notmatchreplace[current] = nil
--- local pre, post, replace = getdisc(current)
--- if pre then
--- local n = n
--- while pre do
--- if seq[n][getchar(pre)] then
--- n = n + 1
--- if n > s then
--- break
--- end
--- pre = getnext(pre)
--- else
--- notmatchpre[current] = true
--- break
--- end
--- end
--- if n <= s then
--- notmatchpre[current] = true
--- end
--- else
--- notmatchpre[current] = true
--- end
--- if replace then
--- -- so far we never entered this branch
--- while replace do
--- if seq[n][getchar(replace)] then
--- n = n + 1
--- if n > s then
--- break
--- end
--- replace = getnext(replace)
--- else
--- notmatchreplace[current] = true
--- -- different than others, needs checking if "not" is okay
--- if not notmatchpre[current] then
--- match = false
--- end
--- break
--- end
--- end
--- if not match then
--- break
--- end
--- else
--- -- skip 'm
--- end
--- current = getnext(current)
--- -- elseif id == glue_code and seq[n][32] and isspace(current,threshold,id) then
--- -- n = n + 1
--- -- current = getnext(current)
--- elseif id == glue_code then
--- local sn = seq[n]
--- if (sn[32] and spaces[current]) or sn[0xFFFC] then
--- n = n + 1
--- current = getnext(current)
--- else
--- match = false
--- break
--- end
--- elseif seq[n][0xFFFC] then
--- n = n + 1
--- current = getnext(current)
--- else
--- match = false
--- break
--- end
--- else
--- match = false
--- break
--- end
--- end
--- else
--- match = false
--- end
--- end
--- end
--- if match then
--- if trace_contexts then
--- chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,true)
--- end
--- if diskseen or sweepnode then
--- head, start, done = chaindisk(head,start,dataset,sequence,rlmode,skipped and skiphash,ck)
--- else
--- head, start, done = chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck)
--- end
--- if done then
--- break
--- else
--- -- next context
--- end
--- -- elseif trace_chains then
--- -- chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,match)
--- end
--- end
--- if diskseen then
--- notmatchpre = { }
--- notmatchpost = { }
--- notmatchreplace = { }
--- end
--- return head, start, done
--- end
-
--- Instead of a "match" boolean variable and check for that I decided to use a "goto" with
--- "labels" instead. This is one of the cases where it makes th ecode more readable and we might
--- even gain a bit performance.
+-- The next one is quite optimized but still somewhat slow, fonts like ebgaramond
+-- are real torture tests because they have many steps with one context (having
+-- multiple contexts makes more sense) also because we (can) reduce them. Instead of
+-- a match boolean variable and check for that I decided to use a goto with labels
+-- instead. This is one of the cases where it makes th ecode more readable and we
+-- might even gain a bit performance.
local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash)
-- optimizing for rlmode gains nothing
@@ -3246,6 +2795,9 @@ local resolved = { } -- we only resolve a font,script,language pair once
local function logprocess(...)
if trace_steps then
registermessage(...)
+ if trace_steps == "silent" then
+ return
+ end
end
report_process(...)
end
@@ -4495,15 +4047,10 @@ registerotffeature {
}
}
--- This can be used for extra handlers, but should be used with care!
-
-otf.handlers = handlers -- used in devanagari
-
--- We implement one here:
-
-local setspacekerns = nodes.injections.setspacekerns if not setspacekerns then os.exit() end
-
--- This pseudo feature has no steps, so it gets called as:
+-- This can be used for extra handlers, but should be used with care! We implement one
+-- here but some more can be found in the osd (script devanagary) file. Now watch out:
+-- when a handlers has steps, it is called as the other ones, but when we have no steps,
+-- we use a different call:
--
-- function(head,dataset,sequence,initialrl,font,attr)
-- return head, done
@@ -4511,6 +4058,10 @@ local setspacekerns = nodes.injections.setspacekerns if not setspacekerns then o
--
-- Also see (!!).
+otf.handlers = handlers
+
+local setspacekerns = nodes.injections.setspacekerns if not setspacekerns then os.exit() end
+
if fontfeatures then
function handlers.trigger_space_kerns(head,dataset,sequence,initialrl,font,attr)
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index c67662844..ea66e141c 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -2553,11 +2553,10 @@ local function checkflags(sequence,resources)
if skipsome then
sequence.skiphash = setmetatableindex(function(t,k)
local c = resources.classes[k] -- delayed table
- local v = c == skipmark or (markclass and c == "mark" and not markclass[k]) or c == skipligature or c == skipbase
--- local v = (skipmark and c == "mark")
--- or (markclass and c == "mark" and not markclass[k])
--- or (skipligature and c == "ligature")
--- or (skipbase and c == "base")
+ local v = c == skipmark
+ or (markclass and c == "mark" and not markclass[k])
+ or c == skipligature
+ or c == skipbase
t[k] = v or false
return v
end)
diff --git a/tex/context/base/mkiv/font-tra.mkiv b/tex/context/base/mkiv/font-tra.mkiv
index 07a28b7ab..dfde72c63 100644
--- a/tex/context/base/mkiv/font-tra.mkiv
+++ b/tex/context/base/mkiv/font-tra.mkiv
@@ -282,7 +282,7 @@
\endgroup}
\unexpanded\def\startotfsample
- {\enabletrackers[*otf.sample]% beware, kind of global
+ {\enabletrackers[otf.sample.silent]% beware, kind of global
\startotfcollecting
\begingroup
\veryraggedright
@@ -292,7 +292,7 @@
\unexpanded\def\stopotfsample
{\endgroup
\stopotfcollecting
- \disabletrackers[*otf.sample]% beware, kind of global: otf.sample
+ \disabletrackers[otf.sample]% beware, kind of global: otf.sample
\showotfsteps
\resetotfcollecting}
diff --git a/tex/context/base/mkiv/math-def.mkiv b/tex/context/base/mkiv/math-def.mkiv
index a8af5af5c..097d70e1e 100644
--- a/tex/context/base/mkiv/math-def.mkiv
+++ b/tex/context/base/mkiv/math-def.mkiv
@@ -133,9 +133,9 @@
\definemathcommand [centercolon] [rel] {\mathstylevcenteredhbox\colon}
\definemathcommand [colonminus] [rel] {\centercolon\colonsep\mathrel{-}}
-\definemathcommand [minuscolon] [rel] {\mathrel{-}\colonsep\centercolon} % native char
-\definemathcommand [colonequals] [rel] {\centercolon\colonsep=} % native char
-\definemathcommand [equalscolon] [rel] {=\centercolon\colonsep} % native char
+%definemathcommand [minuscolon] [rel] {\mathrel{-}\colonsep\centercolon} % native char
+%definemathcommand [colonequals] [rel] {\centercolon\colonsep=} % native char
+%definemathcommand [equalscolon] [rel] {=\centercolon\colonsep} % native char
\definemathcommand [colonapprox] [rel] {\centercolon\colonsep\approx}
\definemathcommand [approxcolon] [rel] {\approx\centercolon\colonsep}
\definemathcommand [colonsim] [rel] {\centercolon\colonsep\sim}
diff --git a/tex/context/base/mkiv/math-ext.lua b/tex/context/base/mkiv/math-ext.lua
index b00d6cde2..a4b865713 100644
--- a/tex/context/base/mkiv/math-ext.lua
+++ b/tex/context/base/mkiv/math-ext.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['math-ext'] = {
license = "see context related readme files"
}
+local rawget = rawget
+
local trace_virtual = false trackers.register("math.virtual", function(v) trace_virtual = v end)
local basename = file.basename
@@ -18,33 +20,40 @@ local report_math = logs.reporter("mathematics")
mathematics.extras = mathematics.extras or { }
local extras = mathematics.extras
-characters.math = characters.math or { }
-local mathdata = characters.math
+local mathplus = { }
local chardata = characters.data
+local mathpairs = characters.mathpairs
+
+-- todo: store them and skip storage if already stored
+-- todo: make a char-ctx.lua (or is this already side effect of save in format)
-function extras.add(unicode,t) -- todo: if already stored ...
- local min, max = mathematics.extrabase, mathematics.privatebase - 1
- -- if mathdata[unicode] or chardata[unicode] then
- -- report_math("extra %U overloads existing character",unicode)
- -- end
+local function addextra(unicode)
+ local min = mathematics.extrabase
+ local max = mathematics.privatebase - 1
if unicode >= min and unicode <= max then
- mathdata[unicode], chardata[unicode] = t, t
+ if chardata[unicode] then
+ mathplus[unicode] = true
+ else
+ report_math("extra %U is not a registered code point",unicode)
+ end
else
report_math("extra %U should be in range %U - %U",unicode,min,max)
end
end
+extras.add = addextra
+
function extras.copy(target,original)
local characters = target.characters
local properties = target.properties
local parameters = target.parameters
- for unicode, extradesc in next, mathdata do
- -- always, because in an intermediate step we can have a non math font
- local extrachar = characters[unicode]
+ for unicode in table.sortedhash(mathplus) do
+ local extradesc = chardata[unicode]
local nextinsize = extradesc.nextinsize
if nextinsize then
- local first = 1
- local charused = unicode
+ local extrachar = characters[unicode]
+ local first = 1
+ local charused = unicode
if not extrachar then
for i=1,#nextinsize do
local slot = nextinsize[i]
@@ -104,94 +113,7 @@ end
utilities.sequencers.appendaction(mathactions,"system","mathematics.extras.copy")
--- 0xFE302 -- 0xFE320 for accents (gone with new lm/gyre)
---
--- extras.add(0xFE302, {
--- category="mn",
--- description="WIDE MATHEMATICAL HAT",
--- direction="nsm",
--- linebreak="cm",
--- mathclass="topaccent",
--- mathname="widehat",
--- mathstretch="h",
--- unicodeslot=0xFE302,
--- nextinsize={ 0x00302, 0x0005E },
--- } )
---
--- extras.add(0xFE303, {
--- category="mn",
--- cjkwd="a",
--- description="WIDE MATHEMATICAL TILDE",
--- direction="nsm",
--- linebreak="cm",
--- mathclass="topaccent",
--- mathname="widetilde",
--- mathstretch="h",
--- unicodeslot=0xFE303,
--- nextinsize={ 0x00303, 0x0007E },
--- } )
-
--- 0xFE321 -- 0xFE340 for missing characters
-
-extras.add(0xFE321, {
- category="sm",
- description="MATHEMATICAL SHORT BAR",
- -- direction="on",
- -- linebreak="nu",
- mathclass="relation",
- mathname="mapstochar",
- unicodeslot=0xFE321,
-} )
-
-extras.add(0xFE322, {
- category="sm",
- description="MATHEMATICAL LEFT HOOK",
- mathclass="relation",
- mathname="lhook",
- unicodeslot=0xFE322,
-} )
-
-extras.add(0xFE323, {
- category="sm",
- description="MATHEMATICAL RIGHT HOOK",
- mathclass="relation",
- mathname="rhook",
- unicodeslot=0xFE323,
-} )
-
-extras.add(0xFE324, {
- category="sm",
- description="MATHEMATICAL SHORT BAR MIRRORED",
--- direction="on",
--- linebreak="nu",
- mathclass="relation",
- mathname="mapsfromchar",
- unicodeslot=0xFE324,
-} )
-
---~ extras.add(0xFE304, {
---~ category="sm",
---~ description="TOP AND BOTTOM PARENTHESES",
---~ direction="on",
---~ linebreak="al",
---~ mathclass="doubleaccent",
---~ mathname="doubleparent",
---~ unicodeslot=0xFE304,
---~ accents={ 0x023DC, 0x023DD },
---~ } )
-
---~ extras.add(0xFE305, {
---~ category="sm",
---~ description="TOP AND BOTTOM BRACES",
---~ direction="on",
---~ linebreak="al",
---~ mathclass="doubleaccent",
---~ mathname="doublebrace",
---~ unicodeslot=0xFE305,
---~ accents={ 0x023DE, 0x023DF },
---~ } )
-
---~ \Umathchardef\braceld="0 "1 "FF07A
---~ \Umathchardef\bracerd="0 "1 "FF07B
---~ \Umathchardef\bracelu="0 "1 "FF07C
---~ \Umathchardef\braceru="0 "1 "FF07D
+extras.add(0xFE321)
+extras.add(0xFE322)
+extras.add(0xFE323)
+extras.add(0xFE324)
diff --git a/tex/context/base/mkiv/math-fbk.lua b/tex/context/base/mkiv/math-fbk.lua
index 2ce292a19..2bf9a97e8 100644
--- a/tex/context/base/mkiv/math-fbk.lua
+++ b/tex/context/base/mkiv/math-fbk.lua
@@ -227,29 +227,9 @@ end
local addextra = mathematics.extras.add
-addextra(0xFE350, {
- category = "sm",
- description = "MATHEMATICAL DOUBLE ARROW LEFT END",
- mathclass = "relation",
- mathname = "ctxdoublearrowfillleftend",
- unicodeslot = 0xFE350,
-} )
-
-addextra(0xFE351, {
- category = "sm",
- description = "MATHEMATICAL DOUBLE ARROW MIDDLE PART",
- mathclass = "relation",
- mathname = "ctxdoublearrowfillmiddlepart",
- unicodeslot = 0xFE351,
-} )
-
-addextra(0xFE352, {
- category = "sm",
- description = "MATHEMATICAL DOUBLE ARROW RIGHT END",
- mathclass = "relation",
- mathname = "ctxdoublearrowfillrightend",
- unicodeslot = 0xFE352,
-} )
+addextra(0xFE350) -- MATHEMATICAL DOUBLE ARROW LEFT END
+addextra(0xFE351) -- MATHEMATICAL DOUBLE ARROW MIDDLE PART
+addextra(0xFE352) -- MATHEMATICAL DOUBLE ARROW RIGHT END
local push = { "push" }
local pop = { "pop" }
@@ -481,17 +461,17 @@ local function smashed(data,unicode,swap,private)
end
end
-addextra(0xFE3DE, { description="EXTENSIBLE OF 0x03DE", unicodeslot=0xFE3DE, mathextensible = "r", mathstretch = "h", mathclass = "topaccent" } )
-addextra(0xFE3DC, { description="EXTENSIBLE OF 0x03DC", unicodeslot=0xFE3DC, mathextensible = "r", mathstretch = "h", mathclass = "topaccent" } )
-addextra(0xFE3B4, { description="EXTENSIBLE OF 0x03B4", unicodeslot=0xFE3B4, mathextensible = "r", mathstretch = "h", mathclass = "topaccent" } )
+addextra(0xFE3DE) -- EXTENSIBLE OF 0x03DE
+addextra(0xFE3DC) -- EXTENSIBLE OF 0x03DC
+addextra(0xFE3B4) -- EXTENSIBLE OF 0x03B4
virtualcharacters[0xFE3DE] = function(data) return smashed(data,0x23DE,0x23DF,0xFE3DE) end
virtualcharacters[0xFE3DC] = function(data) return smashed(data,0x23DC,0x23DD,0xFE3DC) end
virtualcharacters[0xFE3B4] = function(data) return smashed(data,0x23B4,0x23B5,0xFE3B4) end
-addextra(0xFE3DF, { description="EXTENSIBLE OF 0x03DF", unicodeslot=0xFE3DF, mathextensible = "r", mathstretch = "h", mathclass = "botaccent" } )
-addextra(0xFE3DD, { description="EXTENSIBLE OF 0x03DD", unicodeslot=0xFE3DD, mathextensible = "r", mathstretch = "h", mathclass = "botaccent" } )
-addextra(0xFE3B5, { description="EXTENSIBLE OF 0x03B5", unicodeslot=0xFE3B5, mathextensible = "r", mathstretch = "h", mathclass = "botaccent" } )
+addextra(0xFE3DF) -- EXTENSIBLE OF 0x03DF
+addextra(0xFE3DD) -- EXTENSIBLE OF 0x03DD
+addextra(0xFE3B5) -- EXTENSIBLE OF 0x03B5
virtualcharacters[0xFE3DF] = function(data) local c = data.target.characters[0x23DF] if c then c.unicode = 0x23DF return c end end
virtualcharacters[0xFE3DD] = function(data) local c = data.target.characters[0x23DD] if c then c.unicode = 0x23DD return c end end
@@ -499,8 +479,8 @@ virtualcharacters[0xFE3B5] = function(data) local c = data.target.characters[0x2
-- todo: add some more .. numbers might change
-addextra(0xFE302, { description="EXTENSIBLE OF 0x0302", unicodeslot=0xFE302, mathstretch = "h", mathclass = "topaccent" } )
-addextra(0xFE303, { description="EXTENSIBLE OF 0x0303", unicodeslot=0xFE303, mathstretch = "h", mathclass = "topaccent" } )
+addextra(0xFE302) -- EXTENSIBLE OF 0x0302
+addextra(0xFE303) -- EXTENSIBLE OF 0x0303
local function smashed(data,unicode,private)
local target = data.target
@@ -541,14 +521,14 @@ local function smashed(data,unicode,optional)
end
end
-addextra(0xFE932, { description = "SMASHED PRIME 0x02032", unicodeslot = 0xFE932 } )
-addextra(0xFE933, { description = "SMASHED PRIME 0x02033", unicodeslot = 0xFE933 } )
-addextra(0xFE934, { description = "SMASHED PRIME 0x02034", unicodeslot = 0xFE934 } )
-addextra(0xFE957, { description = "SMASHED PRIME 0x02057", unicodeslot = 0xFE957 } )
+addextra(0xFE932) -- SMASHED PRIME 0x02032
+addextra(0xFE933) -- SMASHED PRIME 0x02033
+addextra(0xFE934) -- SMASHED PRIME 0x02034
+addextra(0xFE957) -- SMASHED PRIME 0x02057
-addextra(0xFE935, { description = "SMASHED BACKWARD PRIME 0x02035", unicodeslot = 0xFE935 } )
-addextra(0xFE936, { description = "SMASHED BACKWARD PRIME 0x02036", unicodeslot = 0xFE936 } )
-addextra(0xFE937, { description = "SMASHED BACKWARD PRIME 0x02037", unicodeslot = 0xFE937 } )
+addextra(0xFE935) -- SMASHED BACKWARD PRIME 0x02035
+addextra(0xFE936) -- SMASHED BACKWARD PRIME 0x02036
+addextra(0xFE937) -- SMASHED BACKWARD PRIME 0x02037
virtualcharacters[0xFE932] = function(data) return smashed(data,0x02032) end
virtualcharacters[0xFE933] = function(data) return smashed(data,0x02033) end
@@ -593,7 +573,7 @@ utilities.sequencers.appendaction("aftercopyingcharacters", "system","mathematic
-- actuarian (beware: xits has an ugly one)
-addextra(0xFE940, { category = "mn", description="SMALL ANNUITY SYMBOL", unicodeslot=0xFE940, mathclass="topaccent", mathname="smallactuarial" })
+addextra(0xFE940) -- SMALL ANNUITY SYMBOL
local function actuarian(data)
local characters = data.target.characters
@@ -620,3 +600,49 @@ end
virtualcharacters[0x020E7] = actuarian -- checked
virtualcharacters[0xFE940] = actuarian -- unchecked
+
+local function equals(data,unicode,snippet,advance,n) -- mathpair needs them
+ local characters = data.target.characters
+ local parameters = data.target.parameters
+ local basechar = characters[snippet]
+ local advance = advance * parameters.quad
+ return {
+ unicode = unicode,
+ width = n*basechar.width + (n-1)*advance,
+ commands = {
+ { "char", snippet },
+ { "right", advance },
+ { "char", snippet },
+ n > 2 and { "right", advance } or nil,
+ n > 2 and { "char", snippet } or nil,
+ },
+ }
+end
+
+virtualcharacters[0x2A75] = function(data) return equals(data,0x2A75,0x003D, 1/5,2) end -- ==
+virtualcharacters[0x2A76] = function(data) return equals(data,0x2A76,0x003D, 1/5,3) end -- ===
+virtualcharacters[0x2980] = function(data) return equals(data,0x2980,0x007C,-1/8,3) end -- |||
+
+addextra(0xFE941) -- EXTREMELY IDENTICAL TO
+
+virtualcharacters[0xFE941] = function(data) -- this character is only needed for mathpairs
+ local characters = data.target.characters
+ local parameters = data.target.parameters
+ local basechar = characters[0x003D]
+ local width = basechar.width or 0
+ local height = basechar.height or 0
+ local depth = basechar.depth or 0
+ return {
+ unicode = 0xFE941,
+ width = width,
+ height = height, -- we cheat (no time now)
+ depth = depth, -- we cheat (no time now)
+ commands = {
+ { "down", - height/2 }, -- sort of works
+ { "char", 0x003D },
+ { "right", -width },
+ { "down", height }, -- sort of works
+ { "char", 0x003D },
+ },
+ }
+end
diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua
index 50e21669d..bd1d551e7 100644
--- a/tex/context/base/mkiv/math-noa.lua
+++ b/tex/context/base/mkiv/math-noa.lua
@@ -1516,20 +1516,23 @@ local collapse = { } processors.collapse = collapse
local mathpairs = characters.mathpairs -- next will move to char-def
+-- I should redo this: ligatures but only when attribute. Adn then the prime anchoring will
+-- be the only one left. Then the mathpairs definitions might go from char-def to here.
+
-- 0x02B9 modifier
-mathpairs[0x2032] = { [0x2032] = 0x2033, [0x2033] = 0x2034, [0x2034] = 0x2057 } -- (prime,prime) (prime,doubleprime) (prime,tripleprime)
-mathpairs[0x2033] = { [0x2032] = 0x2034, [0x2033] = 0x2057 } -- (doubleprime,prime) (doubleprime,doubleprime)
-mathpairs[0x2034] = { [0x2032] = 0x2057 } -- (tripleprime,prime)
+-- mathpairs[0x2032] = { [0x2032] = 0x2033, [0x2033] = 0x2034, [0x2034] = 0x2057 } -- (prime,prime) (prime,doubleprime) (prime,tripleprime)
+-- mathpairs[0x2033] = { [0x2032] = 0x2034, [0x2033] = 0x2057 } -- (doubleprime,prime) (doubleprime,doubleprime)
+-- mathpairs[0x2034] = { [0x2032] = 0x2057 } -- (tripleprime,prime)
-mathpairs[0x2035] = { [0x2035] = 0x2036, [0x2036] = 0x2037 } -- (reversedprime,reversedprime) (reversedprime,doublereversedprime)
-mathpairs[0x2036] = { [0x2035] = 0x2037 } -- (doublereversedprime,reversedprime)
+-- mathpairs[0x2035] = { [0x2035] = 0x2036, [0x2036] = 0x2037 } -- (reversedprime,reversedprime) (reversedprime,doublereversedprime)
+-- mathpairs[0x2036] = { [0x2035] = 0x2037 } -- (doublereversedprime,reversedprime)
-mathpairs[0x222B] = { [0x222B] = 0x222C, [0x222C] = 0x222D }
-mathpairs[0x222C] = { [0x222B] = 0x222D }
+-- mathpairs[0x222B] = { [0x222B] = 0x222C, [0x222C] = 0x222D } -- integrals
+-- mathpairs[0x222C] = { [0x222B] = 0x222D }
-mathpairs[0x007C] = { [0x007C] = 0x2016, [0x2016] = 0x2980 } -- bar+bar=double bar+double=triple
-mathpairs[0x2016] = { [0x007C] = 0x2980, [0x02B9] = 0x2016 } -- double+bar=triple
+-- mathpairs[0x007C] = { [0x007C] = 0x2016, [0x2016] = 0x2980 } -- bar+bar=double bar+double=triple
+-- mathpairs[0x2016] = { [0x007C] = 0x2980, [0x02B9] = 0x2016 } -- double+bar=triple
local movesub = {
-- primes
@@ -1617,6 +1620,8 @@ local function movesubscript(parent,current_nucleus,current_char,new_char)
end
end
+-- this is not that efficient as we are actually doing kind of ligatures
+
local function collapsepair(pointer,what,n,parent,nested) -- todo: switch to turn in on and off
if parent then
if validpair[getsubtype(parent)] then
@@ -1629,39 +1634,38 @@ local function collapsepair(pointer,what,n,parent,nested) -- todo: switch to tur
local mathpair = mathpairs[current_char]
if mathpair then
local next_noad = getnext(parent)
- if next_noad and getid(next_noad) == math_noad then
- if validpair[getsubtype(next_noad)] then
- local next_nucleus = getnucleus(next_noad)
- if getid(next_nucleus) == math_char then
- local next_char = getchar(next_nucleus)
- local newchar = mathpair[next_char]
- if newchar then
- local id = getfont(current_nucleus)
- local characters = fontcharacters[id]
- if characters and characters[newchar] then
- if trace_collapsing then
- report_collapsing("%U + %U => %U",current_char,next_char,newchar)
- end
- setchar(current_nucleus,newchar)
- local next_next_noad = getnext(next_noad)
- if next_next_noad then
- setlink(parent,next_next_noad)
- else
- setnext(parent)
- end
- local nsup = getsup(next_noad)
- local nsub = getsub(next_noad)
- if nsup then
- setsup(parent,nsup)
- setsup(next_noad)
- end
- if nsub then
- setsub(parent,nsub)
- setsub(next_noad)
- end
- flush_node(next_noad)
- collapsepair(pointer,what,n,parent,true)
+ if next_noad and getid(next_noad) == math_noad and validpair[getsubtype(next_noad)] then
+ local next_nucleus = getnucleus(next_noad)
+ if getid(next_nucleus) == math_char then
+ local next_char = getchar(next_nucleus)
+ local newchar = mathpair[next_char]
+ if newchar then
+ local id = getfont(current_nucleus)
+ local characters = fontcharacters[id]
+ local replace = characters and characters[newchar]
+ if replace then
+ if trace_collapsing then
+ report_collapsing("%U + %U => %U",current_char,next_char,newchar)
+ end
+ setchar(current_nucleus,newchar)
+ local next_next_noad = getnext(next_noad)
+ if next_next_noad then
+ setlink(parent,next_next_noad)
+ else
+ setnext(parent)
+ end
+ local nsup = getsup(next_noad)
+ local nsub = getsub(next_noad)
+ if nsup then
+ setsup(parent,nsup)
+ setsup(next_noad)
+ end
+ if nsub then
+ setsub(parent,nsub)
+ setsub(next_noad)
end
+ flush_node(next_noad)
+ collapsepair(pointer,what,n,parent,true)
end
end
end
diff --git a/tex/context/base/mkiv/page-ini.lua b/tex/context/base/mkiv/page-ini.lua
new file mode 100644
index 000000000..1aeae8f09
--- /dev/null
+++ b/tex/context/base/mkiv/page-ini.lua
@@ -0,0 +1,51 @@
+if not modules then modules = { } end modules ['page-ini'] = {
+ version = 1.001,
+ comment = "companion to page-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local tonumber, rawget = tonumber, rawget
+local gmatch = string.gmatch
+
+local texgetcount = tex.getcount
+
+local ctx_testcase = commands.testcase
+
+local data = table.setmetatableindex("table")
+local last = 0
+
+interfaces.implement {
+ name = "markpage",
+ arguments = { "string", "string" },
+ actions = function(name,list)
+ local realpage = texgetcount("realpageno")
+ if list and list ~= "" then
+ for sign, page in gmatch(list,"([%+%-])(%d+)") do
+ page = tonumber(page)
+ if page then
+ if sign == "+" then
+ page = realpage + page
+ end
+ data[page][name] = true
+ end
+ end
+ else
+ data[realpage][name] = true
+ end
+ end
+}
+
+interfaces.implement {
+ name = "doifelsemarkedpage",
+ arguments = "string",
+ actions = function(name)
+ local realpage = texgetcount("realpageno")
+ for i=last,realpage-1 do
+ data[i] = nil
+ end
+ local pagedata = rawget(data,realpage)
+ ctx_testcase(pagedata and pagedata[name])
+ end
+}
diff --git a/tex/context/base/mkiv/page-ini.mkiv b/tex/context/base/mkiv/page-ini.mkiv
index 6f6cb7180..7ffd00c65 100644
--- a/tex/context/base/mkiv/page-ini.mkiv
+++ b/tex/context/base/mkiv/page-ini.mkiv
@@ -13,6 +13,8 @@
\writestatus{loading}{ConTeXt Page Macros / Initializations}
+\registerctxluafile{page-ini}{1.001}
+
%D The \type {\processpage} command has become obsolete. It's original
%D purpose was to flush only parts of a document but nowadays we have
%D project structure and modes. This is just one of those very early
@@ -260,11 +262,19 @@
% \appendtoks
% \ifvoid\thispageinsert\else\hbox{\smashedbox\thispageinsert}\fi
% \to \everyshipout
-%
-% %D Idea:
-%
-% \definemarkedpage[nobackgrounds]
-% \markpage[nobackgrounds]
-% \doifmarkedpageelse{nobackgrounds}
+
+% not yet in i-* file
+
+\installcorenamespace{markedpage}
+
+\unexpanded\def\markpage
+ {\dodoubleempty\page_mark}
+
+\def\page_mark[#1][#2]%
+ {\clf_markpage{#1}{#2}}
+
+\unexpanded\def\doifelsemarkedpage#1%
+ {\clf_doifelsemarkedpage{#1}}
+
\protect \endinput
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 40f20e02d..6956328b2 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 a0f467fa3..9ee0237de 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/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml
index 2f03a27fd..fc18b8cc3 100644
--- a/tex/context/interface/mkiv/context-en.xml
+++ b/tex/context/interface/mkiv/context-en.xml
@@ -27426,6 +27426,7 @@
</cd:arguments>
</cd:command>
</cd:interface>
+ <cd:interface file="i-pagemarks.xml"/>
<cd:interface file="i-pairedbox.xml">
<cd:command file="pack-com.mkiv" level="style" name="definepairedbox">
<cd:arguments>
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 54eef5bcd..762411dba 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-context.xml b/tex/context/interface/mkiv/i-context.xml
index f1e85658f..82d3cc541 100644
--- a/tex/context/interface/mkiv/i-context.xml
+++ b/tex/context/interface/mkiv/i-context.xml
@@ -159,6 +159,7 @@
<cd:interfacefile filename="i-pageselection.xml"/>
<cd:interfacefile filename="i-pageshift.xml"/>
<cd:interfacefile filename="i-pagestate.xml"/>
+ <cd:interfacefile filename="i-pagemarks.xml"/>
<cd:interfacefile filename="i-pairedbox.xml"/>
<cd:interfacefile filename="i-papersize.xml"/>
<cd:interfacefile filename="i-paragraph.xml"/>
diff --git a/tex/context/interface/mkiv/i-pagemarks.xml b/tex/context/interface/mkiv/i-pagemarks.xml
new file mode 100644
index 000000000..f0eaae47f
--- /dev/null
+++ b/tex/context/interface/mkiv/i-pagemarks.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?context-directive job ctxfile x-setups.ctx ?>
+
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands">
+
+ <!-- todo: \markpage[name] | \markpage[name][list] (absolute or relative prefized by +) -->
+ <!-- todo: \doifelsemarkedpage{name} -->
+
+</cd:interface>
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 16621d972..98eb8c5d7 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/mkiv/s-fnt-20.mkiv b/tex/context/modules/mkiv/s-fnt-20.mkiv
index b61caaef6..df507a912 100644
--- a/tex/context/modules/mkiv/s-fnt-20.mkiv
+++ b/tex/context/modules/mkiv/s-fnt-20.mkiv
@@ -141,6 +141,7 @@
\directsetup{otftracker-steps}
\directsetup{otftracker-extra}
\stopchapter
+ \setvariables[otftracker][comment=]
\stoptext
\stopsetups
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index c1bbcd2d0..bc2a18b69 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 : 08/04/17 09:40:52
+-- merge date : 08/06/17 16:12:17
do -- begin closure to overcome local limits and interference
@@ -19519,7 +19519,10 @@ local function checkflags(sequence,resources)
if skipsome then
sequence.skiphash=setmetatableindex(function(t,k)
local c=resources.classes[k]
- local v=c==skipmark or (markclass and c=="mark" and not markclass[k]) or c==skipligature or c==skipbase
+ local v=c==skipmark
+ or (markclass and c=="mark" and not markclass[k])
+ or c==skipligature
+ or c==skipbase
t[k]=v or false
return v
end)
@@ -21040,7 +21043,7 @@ function injections.setposition(current,factor,rlmode,r2lflag,spec,injection)
end
local p=rawget(properties,current)
if p then
- local i=rawget(p,injection)
+ local i=p[injection]
if i then
if leftkern~=0 then
i.leftkern=(i.leftkern or 0)+leftkern
@@ -21091,7 +21094,7 @@ function injections.setkern(current,factor,rlmode,x,injection)
injection="injections"
end
if p then
- local i=rawget(p,injection)
+ local i=p[injection]
if i then
i.leftkern=dx+(i.leftkern or 0)
else
@@ -21120,7 +21123,7 @@ function injections.setmove(current,factor,rlmode,x,injection)
injection="injections"
end
if p then
- local i=rawget(p,injection)
+ local i=p[injection]
if i then
i.leftkern=dx+(i.leftkern or 0)
else
@@ -21197,7 +21200,7 @@ local function show(n,what,nested,symbol)
if n then
local p=rawget(properties,n)
if p then
- local i=rawget(p,what)
+ local i=p[what]
if i then
local leftkern=i.leftkern or 0
local rightkern=i.rightkern or 0
@@ -21692,27 +21695,27 @@ local function inject_everything(head,where)
if rightkern then
if pn.markdir<0 then
ox=px-pn.markx-rightkern
-if not pn.markmark then
- ox=ox+(pn.leftkern or 0)
-end
+ if not pn.markmark then
+ ox=ox+(pn.leftkern or 0)
+ end
else
+ ox=px-pn.markx-rightkern
if false then
local leftkern=pp.leftkern
if leftkern then
- ox=px-pn.markx-leftkern
- else
- ox=px-pn.markx
+ ox=ox-leftkern
end
- else
- ox=px-pn.markx-rightkern
end
end
else
if pn.markdir<0 then
ox=px-pn.markx
-if not pn.markmark then
- ox=ox+(pn.leftkern or 0)
-end
+ if not pn.markmark then
+ local leftkern=pn.leftkern
+ if leftkern then
+ ox=ox+leftkern
+ end
+ end
else
ox=px-pn.markx
end
@@ -21729,9 +21732,12 @@ end
end
end
local oy=ny+py+pn.marky
-if not pn.markmark then
- oy=oy+(pn.yoffset or 0)
-end
+ if not pn.markmark then
+ local yoffset=pn.yoffset
+ if yoffset then
+ oy=oy+yoffset
+ end
+ end
setoffsets(n,ox,oy)
if trace_marks then
showoffset(n,true)
@@ -22660,6 +22666,7 @@ registertracker("otf.substitutions","otf.singles","otf.multiples","otf.alternati
registertracker("otf.positions","otf.marks","otf.kerns","otf.cursive")
registertracker("otf.actions","otf.substitutions","otf.positions")
registertracker("otf.sample","otf.steps","otf.substitutions","otf.positions","otf.analyzing")
+registertracker("otf.sample.silent","otf.steps=silent","otf.substitutions","otf.positions","otf.analyzing")
local nuts=nodes.nuts
local tonode=nuts.tonode
local tonut=nuts.tonut
@@ -22759,6 +22766,9 @@ local registermessage=(tracers and tracers.steppers.message) or function() end
local function logprocess(...)
if trace_steps then
registermessage(...)
+ if trace_steps=="silent" then
+ return
+ end
end
report_direct(...)
end
@@ -22910,7 +22920,7 @@ local function markstoligature(head,start,stop,char)
return head,base
end
end
-local function toligature(head,start,stop,char,dataset,sequence,markflag,discfound)
+local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfound)
if getattr(start,a_noligature)==1 then
return head,start
end
@@ -22934,7 +22944,7 @@ local function toligature(head,start,stop,char,dataset,sequence,markflag,discfou
set_components(base,comp)
setlink(prev,base,next)
if not discfound then
- local deletemarks=markflag~="mark"
+ local deletemarks=not skiphash
local components=start
local baseindex=0
local componentindex=0
@@ -23011,7 +23021,7 @@ local function toligature(head,start,stop,char,dataset,sequence,markflag,discfou
end
return head,base
end
-local function multiple_glyphs(head,start,multiple,ignoremarks,what)
+local function multiple_glyphs(head,start,multiple,skiphash,what)
local nofmultiples=#multiple
if nofmultiples>0 then
resetinjection(start)
@@ -23086,7 +23096,7 @@ function handlers.gsub_single(head,start,dataset,sequence,replacement)
setchar(start,replacement)
return head,start,true
end
-function handlers.gsub_alternate(head,start,dataset,sequence,alternative,rlmode,skiphash)
+function handlers.gsub_alternate(head,start,dataset,sequence,alternative)
local kind=dataset[4]
local what=dataset[1]
local value=what==true and tfmdata.shared.features[kind] or what
@@ -23108,7 +23118,7 @@ function handlers.gsub_multiple(head,start,dataset,sequence,multiple,rlmode,skip
if trace_multiples then
logprocess("%s: replacing %s by multiple %s",pref(dataset,sequence),gref(getchar(start)),gref(multiple))
end
- return multiple_glyphs(head,start,multiple,sequence.flags[1],dataset[1])
+ return multiple_glyphs(head,start,multiple,skiphash,dataset[1])
end
function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skiphash)
local current=getnext(start)
@@ -23117,7 +23127,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
end
local stop=nil
local startchar=getchar(start)
- if marks[startchar] then
+ if skiphash and skiphash[startchar] then
while current do
local char=ischar(current,currentfont)
if char then
@@ -23148,13 +23158,12 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
end
end
else
- local skipmark=sequence.flags[1]
local discfound=false
local lastdisc=nil
while current do
local char,id=ischar(current,currentfont)
if char then
- if skipmark and marks[char] then
+ if skiphash and skiphash[char] then
current=getnext(current)
else
local lg=ligature[char]
@@ -23202,10 +23211,10 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
if stop then
if trace_ligatures then
local stopchar=getchar(stop)
- head,start=toligature(head,start,stop,lig,dataset,sequence,skipmark,discfound)
+ head,start=toligature(head,start,stop,lig,dataset,sequence,skiphash,discfound)
logprocess("%s: replacing %s upto %s by ligature %s case 2",pref(dataset,sequence),gref(startchar),gref(stopchar),gref(lig))
else
- head,start=toligature(head,start,stop,lig,dataset,sequence,skipmark,discfound)
+ head,start=toligature(head,start,stop,lig,dataset,sequence,skiphash,discfound)
end
else
resetinjection(start)
@@ -23245,7 +23254,7 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st
while snext do
local nextchar=ischar(snext,currentfont)
if nextchar then
- if marks[nextchar] and sequence.flags[1] then
+ if skiphash and skiphash[nextchar] then
prev=snext
snext=getnext(snext)
else
@@ -23484,6 +23493,9 @@ local chainprocs={}
local function logprocess(...)
if trace_steps then
registermessage(...)
+ if trace_steps=="silent" then
+ return
+ end
end
report_subchain(...)
end
@@ -23491,6 +23503,9 @@ local logwarning=report_subchain
local function logprocess(...)
if trace_steps then
registermessage(...)
+ if trace_steps=="silent" then
+ return
+ end
end
report_chain(...)
end
@@ -23516,17 +23531,30 @@ end
local function reportmoresteps(dataset,sequence)
logwarning("%s: more than 1 step",cref(dataset,sequence))
end
-function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+local function getmapping(dataset,sequence,currentlookup)
local steps=currentlookup.steps
local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
- end
if nofsteps==0 then
reportzerosteps(dataset,sequence)
+ currentlookup.mapping=false
+ return false
else
- local current=start
+ if nofsteps>1 then
+ reportmoresteps(dataset,sequence)
+ end
local mapping=steps[1].coverage
+ currentlookup.mapping=mapping
+ currentlookup.format=steps[1].format
+ return mapping
+ end
+end
+function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
+ end
+ if mapping then
+ local current=start
while current do
local currentchar=ischar(current)
if currentchar then
@@ -23554,44 +23582,16 @@ function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,r
end
return head,start,false
end
-function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup)
- local steps=currentlookup.steps
- local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
- end
- if nofsteps==0 then
- reportzerosteps(dataset,sequence)
- else
- local startchar=getchar(start)
- local replacement=steps[1].coverage[startchar]
- if not replacement or replacement=="" then
- if trace_bugs then
- logwarning("%s: no multiple for %s",cref(dataset,sequence),gref(startchar))
- end
- else
- if trace_multiples then
- logprocess("%s: replacing %s by multiple characters %s",cref(dataset,sequence),gref(startchar),gref(replacement))
- end
- return multiple_glyphs(head,start,replacement,sequence.flags[1],dataset[1])
- end
+function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
end
- return head,start,false
-end
-function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlookup)
- local steps=currentlookup.steps
- local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
- end
- if nofsteps==0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local kind=dataset[4]
local what=dataset[1]
local value=what==true and tfmdata.shared.features[kind] or what
local current=start
- local mapping=steps[1].coverage
while current do
local currentchar=ischar(current)
if currentchar then
@@ -23622,17 +23622,35 @@ function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlooku
end
return head,start,false
end
-function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup,chainindex)
- local steps=currentlookup.steps
- local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
end
- if nofsteps==0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
+ local startchar=getchar(start)
+ local replacement=mapping[startchar]
+ if not replacement or replacement=="" then
+ if trace_bugs then
+ logwarning("%s: no multiple for %s",cref(dataset,sequence),gref(startchar))
+ end
+ else
+ if trace_multiples then
+ logprocess("%s: replacing %s by multiple characters %s",cref(dataset,sequence),gref(startchar),gref(replacement))
+ end
+ return multiple_glyphs(head,start,replacement,skiphash,dataset[1])
+ end
+ end
+ return head,start,false
+end
+function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
+ end
+ if mapping then
local startchar=getchar(start)
- local ligatures=steps[1].coverage[startchar]
+ local ligatures=mapping[startchar]
if not ligatures then
if trace_bugs then
logwarning("%s: no ligatures starting with %s",cref(dataset,sequence,chainindex),gref(startchar))
@@ -23642,7 +23660,6 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
local discfound=false
local last=stop
local nofreplacements=1
- local skipmark=currentlookup.flags[1]
while current do
local id=getid(current)
if id==disc_code then
@@ -23656,7 +23673,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
end
else
local schar=getchar(current)
- if skipmark and marks[schar] then
+ if skiphash and skiphash[schar] then
current=getnext(current)
else
local lg=ligatures[schar]
@@ -23687,7 +23704,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
logprocess("%s: replacing character %s upto %s by ligature %s case 4",cref(dataset,sequence,chainindex),gref(startchar),gref(getchar(stop)),gref(ligature))
end
end
- head,start=toligature(head,start,stop,ligature,dataset,sequence,skipmark,discfound)
+ head,start=toligature(head,start,stop,ligature,dataset,sequence,skiphash,discfound)
return head,start,true,nofreplacements,discfound
elseif trace_bugs then
if start==stop then
@@ -23701,20 +23718,15 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
return head,start,false,0,false
end
function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
- local steps=currentlookup.steps
- local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
end
- if nofsteps==0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local startchar=getchar(start)
- local step=steps[1]
- local kerns=step.coverage[startchar]
- if not kerns then
- else
- local format=step.format
+ local kerns=mapping[startchar]
+ if kerns then
+ local format=currentlookup.format
if format=="single" then
local dx,dy,w,h=setposition(start,factor,rlmode,sequence.flags[4],kerns)
if trace_kerns then
@@ -23731,19 +23743,15 @@ function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,r
return head,start,false
end
function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
- local steps=currentlookup.steps
- local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
end
- if nofsteps==0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local snext=getnext(start)
if snext then
local startchar=getchar(start)
- local step=steps[1]
- local kerns=step.coverage[startchar]
+ local kerns=mapping[startchar]
if kerns then
local prev=start
while snext do
@@ -23751,7 +23759,7 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm
if not nextchar then
break
end
- if marks[nextchar] and sequence.flags[1] then
+ if skiphash and skiphash[nextchar] then
prev=snext
snext=getnext(snext)
else
@@ -23759,7 +23767,7 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm
if not krn then
break
end
- local format=step.format
+ local format=currentlookup.format
if format=="pair" then
local a,b=krn[1],krn[2]
if a==true then
@@ -23799,18 +23807,15 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm
end
return head,start,false
end
-function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash)
- local steps=currentlookup.steps
- local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
end
- if nofsteps==0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local markchar=getchar(start)
if marks[markchar] then
- local markanchors=steps[1].coverage[markchar]
+ local markanchors=mapping[markchar]
if markanchors then
local base=getprev(start)
if base then
@@ -23866,18 +23871,15 @@ function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlooku
end
return head,start,false
end
-function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash)
- local steps=currentlookup.steps
- local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
end
- if nofsteps==0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local markchar=getchar(start)
if marks[markchar] then
- local markanchors=steps[1].coverage[markchar]
+ local markanchors=mapping[markchar]
if markanchors then
local base=getprev(start)
if base then
@@ -23937,18 +23939,15 @@ function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentl
end
return head,start,false
end
-function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash)
- local steps=currentlookup.steps
- local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
end
- if nofsteps==0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local markchar=getchar(start)
if marks[markchar] then
- local markanchors=steps[1].coverage[markchar]
+ local markanchors=mapping[markchar]
if markanchors then
local base=getprev(start)
local slc=getligaindex(start)
@@ -23992,17 +23991,14 @@ function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlooku
end
return head,start,false
end
-function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash)
- local steps=currentlookup.steps
- local nofsteps=currentlookup.nofsteps
- if nofsteps>1 then
- reportmoresteps(dataset,sequence)
+function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
+ local mapping=currentlookup.mapping
+ if mapping==nil then
+ mapping=getmapping(dataset,sequence,currentlookup)
end
- if nofsteps==0 then
- reportzerosteps(dataset,sequence)
- else
+ if mapping then
local startchar=getchar(start)
- local exitanchors=steps[1].coverage[startchar]
+ local exitanchors=mapping[startchar]
if exitanchors then
if marks[startchar] then
if trace_cursive then
@@ -24136,7 +24132,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck)
local chainproc=chainprocs[chainkind]
if chainproc then
local ok,n
- head,start,ok,n=chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash)
+ head,start,ok,n=chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,i)
if ok then
done=true
if n and n>1 and i+n>nofchainlookups then
@@ -24487,7 +24483,8 @@ local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match)
local last=ck[5]
local char=getchar(start)
logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a",
- cref(dataset,sequence),rule,match and "matches" or "nomatch",gref(char),first-1,last-first+1,nofseq-last,lookuptype)
+ cref(dataset,sequence),rule,match and "matches" or "nomatch",
+ gref(char),first-1,last-first+1,nofseq-last,lookuptype)
end
local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash)
local sweepnode=sweepnode
@@ -24905,6 +24902,9 @@ local resolved={}
local function logprocess(...)
if trace_steps then
registermessage(...)
+ if trace_steps=="silent" then
+ return
+ end
end
report_process(...)
end