summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-06-06 13:57:28 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-06-06 13:57:28 +0200
commit5e668aa418d6d082446e9369ae06625b50e49943 (patch)
tree8f6acc7855a1f43463d7ac6ae28c6ecc7c42c958 /tex/context/base
parent32f8047624c2fa49c3031a66edb5a039a813f276 (diff)
downloadcontext-5e668aa418d6d082446e9369ae06625b50e49943.tar.gz
2017-06-06 13:28:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-con.lua26
-rw-r--r--tex/context/base/mkiv/font-ctx.lua66
-rw-r--r--tex/context/base/mkiv/font-def.lua5
-rw-r--r--tex/context/base/mkiv/font-ext.lua7
-rw-r--r--tex/context/base/mkiv/font-fbk.lua10
-rw-r--r--tex/context/base/mkiv/font-mat.mkvi2
-rw-r--r--tex/context/base/mkiv/font-vf.lua4
-rw-r--r--tex/context/base/mkiv/math-act.lua1
-rw-r--r--tex/context/base/mkiv/math-ali.mkiv90
-rw-r--r--tex/context/base/mkiv/math-fbk.lua184
-rw-r--r--tex/context/base/mkiv/math-ini.mkiv5
-rw-r--r--tex/context/base/mkiv/math-noa.lua100
-rw-r--r--tex/context/base/mkiv/mult-prm.lua4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25706 -> 25675 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin424698 -> 424652 bytes
-rw-r--r--tex/context/base/mkiv/supp-mat.mkiv5
-rw-r--r--tex/context/base/mkiv/syst-aux.mkiv6
21 files changed, 291 insertions, 232 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index f1f1b7b54..1935fc5e2 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.06.04 16:55}
+\newcontextversion{2017.06.06 13:22}
%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 ed6e5657a..c000f8918 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.06.04 16:55}
+\edef\contextversion{2017.06.06 13:22}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index cd928701d..6f78ecbb8 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.06.04 16:55}
+\newcontextversion{2017.06.06 13:22}
%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 f586f8706..48bd46739 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.06.04 16:55}
+\edef\contextversion{2017.06.06 13:22}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua
index e328d56d2..5a19d84ee 100644
--- a/tex/context/base/mkiv/font-con.lua
+++ b/tex/context/base/mkiv/font-con.lua
@@ -345,10 +345,6 @@ function constructors.scale(tfmdata,specification)
local defaultdepth = resources.defaultdepth or 0
local units = parameters.units or 1000
--
- if target.fonts then
- target.fonts = fastcopy(target.fonts) -- maybe we virtualize more afterwards
- end
- --
-- boundary keys are no longer needed as we now have a string 'right_boundary'
-- that can be used in relevant tables (kerns and ligatures) ... not that I ever
-- used them
@@ -453,6 +449,13 @@ function constructors.scale(tfmdata,specification)
local writingmode = properties.writingmode or "horizontal"
local identity = properties.identity or "horizontal"
--
+ local vfonts = target.fonts
+ if vfonts and #vfonts > 0 then
+ target.fonts = fastcopy(vfonts) -- maybe we virtualize more afterwards
+ elseif isvirtual then
+ target.fonts = { { id = 0 } } -- catch error
+ end
+ --
if changed and not next(changed) then
changed = false
end
@@ -806,6 +809,21 @@ function constructors.scale(tfmdata,specification)
--
constructors.trytosharefont(target,tfmdata)
--
+ -- catch incosnistencies
+ --
+ local vfonts = target.fonts
+ if isvirtual then
+ if not vfonts or #vfonts == 0 then
+ target.fonts = { { id = 0 } }
+ end
+ elseif vfonts then
+ properties.virtualized = true
+ target.type = "virtual"
+ if #vfonts == 0 then
+ target.fonts = { { id = 0 } }
+ end
+ end
+ --
return target
end
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index e13da7f8a..39a579253 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -1262,7 +1262,6 @@ do -- else too many locals
-- -- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure
-- -- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period
-- --
--- -- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference
-- local id = definefont(tfmdata)
-- csnames[id] = specification.cs
-- tfmdata.properties.id = id
@@ -1429,7 +1428,6 @@ do -- else too many locals
-- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure
-- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period
--
- -- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference
local fallbacks = specification.fallbacks
local mathsize = (mathsize == 1 or mathsize == 2 or mathsize == 3) and mathsize or nil -- can be unset so we test 1 2 3
if fallbacks and fallbacks ~= "" and mathsize and not busy then
@@ -1476,7 +1474,6 @@ do -- else too many locals
-- forget about it (can't happen here)
elseif mathsize == 0 then
-- can't happen (here)
- lastmathids[1] = lastfontid
else
-- maybe only 1 2 3 (we already test for this)
lastmathids[mathsize] = lastfontid
@@ -1532,8 +1529,9 @@ do -- else too many locals
if not mathsize then
-- forget about it
elseif mathsize == 0 then
- lastmathids[1] = lastfontid
- else -- maybe only 1 2 3
+ -- can't happen (here)
+ else
+ -- maybe only 1 2 3
lastmathids[mathsize] = lastfontid
end
--
@@ -1612,7 +1610,6 @@ do -- else too many locals
end
return tfmdata, fontdata[tfmdata]
else
- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference
local id = definefont(tfmdata)
tfmdata.properties.id = id
definers.register(tfmdata,id)
@@ -2383,63 +2380,6 @@ dimenfactors.pct = nil
to scale virtual characters.</p>
--ldx]]--
--- function constructors.checkvirtualids(tfmdata)
--- -- begin of experiment: we can use { "slot", 0, number } in virtual fonts
--- local fonts = tfmdata.fonts
--- local selfid = font.nextid()
--- if fonts and #fonts > 0 then
--- for i=1,#fonts do
--- local fi = fonts[i]
--- if fi[2] == 0 then
--- fi[2] = selfid
--- elseif fi.id == 0 then
--- fi.id = selfid
--- end
--- end
--- else
--- -- tfmdata.fonts = { "id", selfid } -- conflicts with other next id's (vf math), too late anyway
--- end
--- -- end of experiment
--- end
-
--- function constructors.getvirtualid(tfmdata)
--- -- since we don't know the id yet, we use 0 as signal
--- local tf = tfmdata.fonts
--- if not tf then
--- local properties = tfmdata.properties
--- if properties then
--- properties.virtualized = true
--- else
--- tfmdata.properties = { virtualized = true }
--- end
--- tf = { }
--- tfmdata.fonts = tf
--- end
--- local ntf = #tf + 1
--- tf[ntf] = { id = 0 }
--- return ntf
--- end
---
--- function constructors.checkvirtualid(tfmdata, id) -- will go
--- local properties = tfmdata.properties
--- if tfmdata and tfmdata.type == "virtual" or (properties and properties.virtualized) then
--- local vfonts = tfmdata.fonts
--- if not vffonts or #vfonts == 0 then
--- if properties then
--- properties.virtualized = false
--- end
--- tfmdata.fonts = nil
--- else
--- for f=1,#vfonts do
--- local fnt = vfonts[f]
--- if fnt.id and fnt.id == 0 then
--- fnt.id = id
--- end
--- end
--- end
--- end
--- end
-
do
local setmacro = tokens.setters.macro
diff --git a/tex/context/base/mkiv/font-def.lua b/tex/context/base/mkiv/font-def.lua
index a362d8967..19d980e48 100644
--- a/tex/context/base/mkiv/font-def.lua
+++ b/tex/context/base/mkiv/font-def.lua
@@ -415,10 +415,6 @@ function definers.loadfont(specification)
return tfmdata
end
-function constructors.checkvirtualids()
- -- dummy in plain version
-end
-
function constructors.readanddefine(name,size) -- no id -- maybe a dummy first
local specification = definers.analyze(name,size)
local method = specification.method
@@ -432,7 +428,6 @@ function constructors.readanddefine(name,size) -- no id -- maybe a dummy first
local tfmdata = definers.loadfont(specification)
if tfmdata then
tfmdata.properties.hash = hash
- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference
id = font.define(tfmdata)
definers.register(tfmdata,id)
else
diff --git a/tex/context/base/mkiv/font-ext.lua b/tex/context/base/mkiv/font-ext.lua
index 965b6e6dc..da629c045 100644
--- a/tex/context/base/mkiv/font-ext.lua
+++ b/tex/context/base/mkiv/font-ext.lua
@@ -671,6 +671,7 @@ local function manipulatedimensions(tfmdata,key,value)
local commands = {
{ "right", (width - oldwidth) / 2 },
{ "slot", 1, private },
+ -- { "slot", 0, private },
}
if height > 0 then
if depth > 0 then
@@ -803,6 +804,7 @@ local function showboundingbox(tfmdata,key,value)
black,
pop,
{ "slot", 1, private },
+ -- { "slot", 0, private },
}
}
else
@@ -818,6 +820,7 @@ local function showboundingbox(tfmdata,key,value)
black,
pop,
{ "slot", 1, private },
+ -- { "slot", 0, private },
}
}
end
@@ -1271,7 +1274,9 @@ do -- another hack for a crappy font
height = old_c.height,
depth = old_c.depth,
commands = {
- { "slot", 1, private },
+ -- { "slot", 1, private },
+ -- { "slot", 0, private },
+ { "char", private },
{ "right", olditalic },
},
}
diff --git a/tex/context/base/mkiv/font-fbk.lua b/tex/context/base/mkiv/font-fbk.lua
index 3734e8071..60f1a1fdf 100644
--- a/tex/context/base/mkiv/font-fbk.lua
+++ b/tex/context/base/mkiv/font-fbk.lua
@@ -106,8 +106,9 @@ local function composecharacters(tfmdata)
end
local chr_t = cache[chr]
if not chr_t then
- chr_t = { "slot", 1, chr }
- -- will be: chr_t = { "slot", 0, chr }
+ -- chr_t = { "slot", 1, chr }
+ -- chr_t = { "slot", 0, chr }
+ chr_t = { "char", chr }
cache[chr] = chr_t
end
if charsacc then
@@ -116,8 +117,9 @@ local function composecharacters(tfmdata)
end
local acc_t = cache[acc]
if not acc_t then
- acc_t = { "slot", 1, acc }
- -- will be: acc_t = { "slot", 0, acc }
+ -- acc_t = { "slot", 1, acc }
+ -- acc_t = { "slot", 0, acc }
+ acc_t = { "char", acc }
cache[acc] = acc_t
end
local cb = descriptions[chr].boundingbox
diff --git a/tex/context/base/mkiv/font-mat.mkvi b/tex/context/base/mkiv/font-mat.mkvi
index 6ce782ee3..0134f3fe6 100644
--- a/tex/context/base/mkiv/font-mat.mkvi
+++ b/tex/context/base/mkiv/font-mat.mkvi
@@ -21,6 +21,8 @@
\ifdefined\??fontinstancebasic \else \installcorenamespace{fontinstancebasic} \fi
\ifdefined\??fontinstanceclass \else \installcorenamespace{fontinstanceclass} \fi
+%D The order 3 2 1 of siuze matters: needed for math-fbk relative size storage!
+
%D \macros
%D {textonly}
%D
diff --git a/tex/context/base/mkiv/font-vf.lua b/tex/context/base/mkiv/font-vf.lua
index 401e84956..ded992850 100644
--- a/tex/context/base/mkiv/font-vf.lua
+++ b/tex/context/base/mkiv/font-vf.lua
@@ -117,7 +117,7 @@ local function combine_assign(g, name, from, to, start, force)
for i=from,to do
if fc[i] and (force or not gc[i]) then
gc[i] = fastcopy(fc[i],true) -- can be optimized
- gc[i].commands = { { 'slot', hn, start } }
+ gc[i].commands = { { "slot", hn, start } }
gd[i] = fd[i]
end
start = start + 1
@@ -144,7 +144,7 @@ local function combine_names(g,name,force)
for k, v in next, fc do
if force or not gc[k] then
gc[k] = fastcopy(v,true)
- gc[k].commands = { { 'slot', hn, k } }
+ gc[k].commands = { { "slot", hn, k } }
gd[i] = fd[i]
end
end
diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua
index 69d85d01f..0aeca5106 100644
--- a/tex/context/base/mkiv/math-act.lua
+++ b/tex/context/base/mkiv/math-act.lua
@@ -272,6 +272,7 @@ target.properties.virtualized = true
insert(character.commands,1,xoffset)
end
else
+ -- local slot = { "slot", 1, addprivate(target,nil,fastcopy(character)) }
local slot = { "slot", 0, addprivate(target,nil,fastcopy(character)) }
if xoffset and yoffset then
character.commands = { xoffset, yoffset, slot }
diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv
index 49a343ba0..1333b4770 100644
--- a/tex/context/base/mkiv/math-ali.mkiv
+++ b/tex/context/base/mkiv/math-ali.mkiv
@@ -33,20 +33,51 @@
\newtoks\t_math_align_b
\newtoks\t_math_align_c
+\newskip\d_math_eqalign_distance
+
+% \unexpanded\def\math_eqalign_distance
+% {\tabskip\d_math_eqalign_distance}
+
+\unexpanded\def\math_eqalign_distance
+ {\relax
+ \ifdim\d_math_eqalign_distance>\zeropoint
+ \hskip\d_math_eqalign_distance
+ \fi
+ \mathalignmentparameter\c!separator
+ \relax}
+
\def\displayopenupvalue{.25\bodyfontsize}
+% \def\math_build_eqalign
+% {\scratchtoks\emptytoks
+% \d_math_eqalign_distance\mathalignmentparameter\c!distance
+% \dorecurse{\mathalignmentparameter\c!m}\math_build_eqalign_step
+% \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_c}}}
+
+% \unexpanded\def\math_build_eqalign_step % make sure no expansion in tracing
+% {\ifnum\recurselevel>\plusone
+% \scratchtoks\expandafter{\the\scratchtoks\math_eqalign_distance\aligntab\tabskip\zeropoint}%
+% \fi
+% \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_a}}%
+% \dorecurse{\numexpr\mathalignmentparameter\c!n-\plusone\relax}
+% {\normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_b}}}}
+
\def\math_build_eqalign
{\scratchtoks\emptytoks
- \dorecurse{\mathalignmentparameter\c!m}\math_build_eqalign_step
- \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_c}}}
-
-\unexpanded\def\math_build_eqalign_step % make sure no expansion in tracing
- {\ifnum\recurselevel>\plusone
- \scratchtoks\expandafter{\the\scratchtoks\tabskip\mathalignmentparameter\c!distance\aligntab\tabskip\zeropoint}%
- \fi
+ \d_math_eqalign_distance\mathalignmentparameter\c!distance
+ \scratchcounterone\mathalignmentparameter\c!m
+ \scratchcountertwo\mathalignmentparameter\c!n
\normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_a}}%
- \dorecurse{\numexpr\mathalignmentparameter\c!n-\plusone\relax}
- {\normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_b}}}}
+ \scratchcounter\plusone
+ \dorecurse{\numexpr\scratchcounterone*\scratchcountertwo-\plusone\relax}
+ {\ifnum\scratchcounter=\scratchcountertwo
+ \scratchcounter\plusone
+ \scratchtoks\expandafter{\the\scratchtoks\math_eqalign_distance}%
+ \else
+ \advance\scratchcounter\plusone
+ \fi
+ \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_b}}}%
+ \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_c}}}
\def\math_math_in_eqalign#1%
{\startforceddisplaymath
@@ -239,36 +270,50 @@
\newcount\c_math_eqalign_column
\newtoks \everymathalignment
+\newtoks \everymathalignmentdone
-\def\math_alignment_NC_first#1\NR
- {\glet\math_alignment_NC\math_alignment_NC_rest
- \scratchtoks{\math_number_left_of_eqalign\aligntab#1\NR}% \math_number_left_of_eqalign not used yet
- \dodoubleempty\math_alignment_NC_first_indeed}
+\def\math_alignment_NN
+ {\dodirectdoubleempty\math_alignment_NN_indeed}
-\def\math_alignment_NC_first_indeed[#1][#2]%
- {\strc_formulas_place_number_nested{#1}{#2}\the\scratchtoks}
+\def\math_alignment_NN_indeed[#1][#2]%
+ {\aligntab
+ \strc_formulas_place_number_nested{#1}{#2}}
\def\math_alignment_NR
+ {\dodirectdoubleempty\math_alignment_NR_indeed}
+
+\def\math_alignment_NR_indeed[#1][#2]%
{\aligntab
\dostoptagged % finish cell
+ \strc_formulas_place_number_nested{#1}{#2}%
\math_number_right_of_eqalign
\crcr
- \dostoptagged % finish row
- \noalign{\glet\math_alignment_NC\math_alignment_NC_first}} % noalign used for change state, conditional does not work here
+ \dostoptagged} % finish row
-\def\math_alignment_NC_rest
+\def\math_alignment_NC
{\aligntab}
\def\math_alignment_EQ
{\NC=}
\appendtoks
- \glet\math_alignment_NC\math_alignment_NC_first
- \unexpanded\def\NC{\math_alignment_NC}% messy, due to lookahead (we cannot use a flag)
- \let\EQ\math_alignment_EQ
- \let\NR\math_alignment_NR
+ \pushmacro\NC
+ \pushmacro\NN
+ \pushmacro\EQ
+ \pushmacro\NR
+ \let\NC\math_alignment_NC
+ \let\NN\math_alignment_NN
+ \let\EQ\math_alignment_EQ
+ \let\NR\math_alignment_NR
\to \everymathalignment
+\appendtoks
+ \popmacro\NR
+ \popmacro\EQ
+ \popmacro\NN
+ \popmacro\NC
+\to \everymathalignmentdone
+
\let\math_alignment_snap_start\relax
\let\math_alignment_snap_stop \relax
@@ -310,6 +355,7 @@
{\math_finish_eqalign_no
\dostoptagged
\dostoptagged
+ \the\everymathalignmentdone
\math_alignment_snap_stop}
\installcorenamespace{mathalignment}
diff --git a/tex/context/base/mkiv/math-fbk.lua b/tex/context/base/mkiv/math-fbk.lua
index 5a6a42e26..c8843ff1d 100644
--- a/tex/context/base/mkiv/math-fbk.lua
+++ b/tex/context/base/mkiv/math-fbk.lua
@@ -26,17 +26,13 @@ local lastmathids = fonts.hashes.lastmathids
-- that order we could use their id's .. i.e. we could always add a font
-- table with those id's .. in fact, we could also add a whole lot more
-- as it doesn't hurt
---
--- todo: use index 'true when luatex provides that feature (on the agenda)
--- to be considered:
---
--- in luatex provide reserve_id (and pass id as field of tfmdata)
--- in context define three sizes but pass them later i.e. do virtualize afterwards
+local scripscriptdelayed = { } -- 1.005 : add characters later
+local scriptdelayed = { } -- 1.005 : add characters later
function fallbacks.apply(target,original)
local mathparameters = target.mathparameters
- if not mathparameters then
+ if not mathparameters or not next(mathparameters) then
return
end
-- we also have forcedsize ... at this moment we already passed through
@@ -50,61 +46,53 @@ function fallbacks.apply(target,original)
local size = parameters.size
local usedfonts = target.fonts
if not usedfonts then
- usedfonts = { }
+ usedfonts = { { id = 0 } } -- we need at least one entry (automatically done anyway)
target.fonts = usedfonts
end
- -- This is not okay yet ... we have no proper way to refer to 'self'
- -- otherwise I will make my own id allocator).
- local self = #usedfonts == 0 and font.nextid() or nil -- will be true
+ -- not used
local textid, scriptid, scriptscriptid
local textindex, scriptindex, scriptscriptindex
local textdata, scriptdata, scriptscriptdata
if mathsize == 3 then
-- scriptscriptsize
- -- textid = nil -- self
- -- scriptid = nil -- no smaller
- -- scriptscriptid = nil -- no smaller
- textid = self
- scriptid = self
- scriptscriptid = self
+ textid = 0
+ scriptid = 0
+ scriptscriptid = 0
elseif mathsize == 2 then
-- scriptsize
- -- textid = nil -- self
- textid = self
- scriptid = lastmathids[3]
- scriptscriptid = lastmathids[3]
+ textid = 0
+ scriptid = lastmathids[3] or 0
+ scriptscriptid = lastmathids[3] or 0
else
-- textsize
- -- textid = nil -- self
- textid = self
- scriptid = lastmathids[2]
- scriptscriptid = lastmathids[3]
+ textid = 0
+ scriptid = lastmathids[2] or 0
+ scriptscriptid = lastmathids[3] or 0
end
- if textid then
+ if textid and textid ~= 0 then
textindex = #usedfonts + 1
+ textdata = target
usedfonts[textindex] = { id = textid }
- -- textdata = identifiers[textid] or target
- textdata = target
else
textdata = target
end
- if scriptid then
+ if scriptid and scriptid ~= 0 then
scriptindex = #usedfonts + 1
+ scriptdata = identifiers[scriptid]
usedfonts[scriptindex] = { id = scriptid }
- scriptdata = identifiers[scriptid]
else
scriptindex = textindex
scriptdata = textdata
end
- if scriptscriptid then
+ if scriptscriptid and scriptscriptid ~= 0 then
scriptscriptindex = #usedfonts + 1
+ scriptscriptdata = identifiers[scriptscriptid]
usedfonts[scriptscriptindex] = { id = scriptscriptid }
- scriptscriptdata = identifiers[scriptscriptid]
else
scriptscriptindex = scriptindex
scriptscriptdata = scriptdata
end
- -- report_fallbacks("used textid: %S, used script id: %S, used scriptscript id: %S",textid,scriptid,scriptscriptid)
+ -- report_fallbacks("used textid: %S, used script id: %S, used scriptscript id: %S",textid,scriptid,scriptscriptid)
local data = {
textdata = textdata,
scriptdata = scriptdata,
@@ -123,7 +111,7 @@ function fallbacks.apply(target,original)
mathsize = mathsize,
}
target.mathrelation = data
- -- inspect(usedfonts)
+ --
for k, v in next, virtualcharacters do
if not characters[k] then
local tv = type(v)
@@ -166,7 +154,7 @@ end
local function raised(data,down)
local replacement = data.replacement
- local character = data.scriptdata.characters[replacement]
+ local character = data.scriptdata.characters[replacement]
if character then
return {
width = character.width,
@@ -175,6 +163,7 @@ local function raised(data,down)
commands = {
{ "down", down and data.size/4 or -data.size/2 }, -- maybe exheight
reference(data.scriptindex,replacement)
+ -- { "slot", data.scriptindex or 0, char } -- hm, data.mathrelation.scriptindex
}
}
end
@@ -239,27 +228,27 @@ end
local addextra = mathematics.extras.add
addextra(0xFE350, {
- category="sm",
- description="MATHEMATICAL DOUBLE ARROW LEFT END",
- mathclass="relation",
- mathname="ctxdoublearrowfillleftend",
- unicodeslot=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,
+ 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,
+ category = "sm",
+ description = "MATHEMATICAL DOUBLE ARROW RIGHT END",
+ mathclass = "relation",
+ mathname = "ctxdoublearrowfillrightend",
+ unicodeslot = 0xFE352,
} )
local push = { "push" }
@@ -267,6 +256,9 @@ local pop = { "pop" }
local leftarrow = { "char", 0x2190 }
local relbar = { "char", 0x2212 }
local rightarrow = { "char", 0x2192 }
+-- local leftarrow = { "slot", 0, 0x2190 }
+-- local relbar = { "slot", 0, 0x2212 }
+-- local rightarrow = { "slot", 0, 0x2192 }
virtualcharacters[0xFE350] = function(data)
-- return combined(data,0x2190,0x2212) -- leftarrow relbar
@@ -353,6 +345,7 @@ local function accent_to_extensible(target,newchr,original,oldchr,height,depth,s
local correction = swap and { "down", (olddata.height or 0) - height } or { "down", olddata.height + (offset or 0)}
local newdata = {
commands = { correction, { "slot", 1, oldchr } },
+ -- commands = { correction, { "slot", 0, oldchr } },
width = olddata.width,
height = height,
depth = depth,
@@ -365,6 +358,7 @@ local function accent_to_extensible(target,newchr,original,oldchr,height,depth,s
if oldnextdata then
local newnextdata = {
commands = { correction, { "slot", 1, nextglyph } },
+ -- commands = { correction, { "slot", 0, nextglyph } },
width = oldnextdata.width,
height = height,
depth = depth,
@@ -395,6 +389,7 @@ local function accent_to_extensible(target,newchr,original,oldchr,height,depth,s
if olddata then
local newdata = {
commands = { correction, { "slot", 1, oldglyph } },
+ -- commands = { correction, { "slot", 0, oldglyph } },
width = olddata.width,
height = height,
depth = depth,
@@ -525,43 +520,64 @@ virtualcharacters[0xFE303] = function(data) return smashed(data,0x0303,0xFE303)
-- these primes in fonts are a real mess .. kind of a dead end, so don't wonder about
-- the values below
--- local function smashed(data,unicode,optional)
--- local oldchar = data.characters[unicode]
--- if oldchar then
--- local xheight = data.target.parameters.xheight
--- local height = 1.25 * xheight
--- local shift = oldchar.height - height
--- local newchar = {
--- commands = {
--- { "down", shift },
+local function smashed(data,unicode,optional)
+ local oldchar = data.characters[unicode]
+ if oldchar then
+ -- local height = 1.25 * data.target.parameters.xheight
+ local height = 0.85 * data.target.mathparameters.AccentBaseHeight
+ local shift = oldchar.height - height
+ local newchar = {
+ commands = {
+ { "down", shift },
+ { "slot", 0, unicode },
-- { "char", unicode },
--- },
--- height = height,
--- width = oldchar.width,
--- }
--- return newchar
--- elseif not optional then
--- report_fallbacks("missing %U prime in font %a",unicode,data.target.properties.fullname)
--- 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(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 } )
+ },
+ height = height,
+ width = oldchar.width,
+ }
+ return newchar
+ elseif not optional then
+ report_fallbacks("missing %U prime in font %a",unicode,data.target.properties.fullname)
+ end
+end
--- virtualcharacters[0xFE932] = function(data) return smashed(data,0x02032) end
--- virtualcharacters[0xFE933] = function(data) return smashed(data,0x02033) end
--- virtualcharacters[0xFE934] = function(data) return smashed(data,0x02034) end
--- virtualcharacters[0xFE957] = function(data) return smashed(data,0x02057) 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(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 } )
+
+virtualcharacters[0xFE932] = function(data) return smashed(data,0x02032) end
+virtualcharacters[0xFE933] = function(data) return smashed(data,0x02033) end
+virtualcharacters[0xFE934] = function(data) return smashed(data,0x02034) end
+virtualcharacters[0xFE957] = function(data) return smashed(data,0x02057) end
+
+virtualcharacters[0xFE935] = function(data) return smashed(data,0x02035,true) end
+virtualcharacters[0xFE936] = function(data) return smashed(data,0x02036,true) end
+virtualcharacters[0xFE937] = function(data) return smashed(data,0x02037,true) end
+
+function mathematics.getridofprime(target,original)
+-- local mathsize = specification.mathsize
+-- if mathsize == 1 or mathsize == 2 or mathsize == 3) then
+ local mathparameters = original.mathparameters
+ if mathparameters and next(mathparameters) then
+ local changed = original.changed
+ if changed then
+ changed[0x02032] = nil
+ changed[0x02033] = nil
+ changed[0x02034] = nil
+ changed[0x02057] = nil
+ changed[0x02035] = nil
+ changed[0x02036] = nil
+ changed[0x02037] = nil
+ end
+ end
+end
--- virtualcharacters[0xFE935] = function(data) return smashed(data,0x02035,true) end
--- virtualcharacters[0xFE936] = function(data) return smashed(data,0x02036,true) end
--- virtualcharacters[0xFE937] = function(data) return smashed(data,0x02037,true) end
+utilities.sequencers.appendaction("beforecopyingcharacters","system","mathematics.getridofprime")
-- actuarian (beware: xits has an ugly one)
diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv
index 8c682bdcb..351b18044 100644
--- a/tex/context/base/mkiv/math-ini.mkiv
+++ b/tex/context/base/mkiv/math-ini.mkiv
@@ -1043,6 +1043,11 @@
\catcode\circumflexasciicode\activecatcode
\catcode\ampersandasciicode \activecatcode
+ \unexpanded\gdef\obeymathcatcodes
+ {\let _\normalsubscript
+ \let ^\normalsuperscript
+ \let &\normalmathaligntab}
+
\doglobal \appendtoks
\let _\normalsubscript
\let ^\normalsuperscript
diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua
index 8b1fa87fd..abc5337c6 100644
--- a/tex/context/base/mkiv/math-noa.lua
+++ b/tex/context/base/mkiv/math-noa.lua
@@ -1525,30 +1525,30 @@ 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
--- local movesub = {
--- -- primes
--- [0x2032] = 0xFE932,
--- [0x2033] = 0xFE933,
--- [0x2034] = 0xFE934,
--- [0x2057] = 0xFE957,
--- -- reverse primes
--- [0x2035] = 0xFE935,
--- [0x2036] = 0xFE936,
--- [0x2037] = 0xFE937,
--- }
-
local movesub = {
-- primes
- [0x2032] = 0x2032,
- [0x2033] = 0x2033,
- [0x2034] = 0x2034,
- [0x2057] = 0x2057,
+ [0x2032] = 0xFE932,
+ [0x2033] = 0xFE933,
+ [0x2034] = 0xFE934,
+ [0x2057] = 0xFE957,
-- reverse primes
- [0x2035] = 0x2035,
- [0x2036] = 0x2036,
- [0x2037] = 0x2037,
+ [0x2035] = 0xFE935,
+ [0x2036] = 0xFE936,
+ [0x2037] = 0xFE937,
}
+-- local movesub = {
+-- -- primes
+-- [0x2032] = 0x2032,
+-- [0x2033] = 0x2033,
+-- [0x2034] = 0x2034,
+-- [0x2057] = 0x2057,
+-- -- reverse primes
+-- [0x2035] = 0x2035,
+-- [0x2036] = 0x2036,
+-- [0x2037] = 0x2037,
+-- }
+
-- inner under over vcenter
local validpair = {
@@ -1563,38 +1563,48 @@ local validpair = {
[noad_opnolimits] = true,
}
-local function movesubscript(parent,current_nucleus,current_char)
+local options_supported = tokens.defined("Unosuperscript")
+
+local function fixsupscript(parent,current,current_char,new_char)
+ if new_char ~= current_char and new_char ~= true then
+ setchar(current,new_char)
+ if trace_collapsing then
+ report_collapsing("fixing subscript, replacing supscript %U by %U",current_char,new_char)
+ end
+ else
+ if trace_collapsing then
+ report_collapsing("fixing subscript, supscript %U",current_char)
+ end
+ end
+ if options_supported then
+ setfield(parent,"options",0x08+0x22)
+ end
+end
+
+local function movesubscript(parent,current_nucleus,current_char,new_char)
local prev = getprev(parent)
if prev and getid(prev) == math_noad then
local psup = getsup(prev)
local psub = getsub(prev)
if not psup and not psub then
-- {f} {'}_n => f_n^'
- -- setchar(current_nucleus,movesub[current_char or getchar(current_nucleus)])
+ fixsupscript(prev,current_nucleus,current_char,new_char)
local nucleus = getnucleus(parent)
local sub = getsub(parent)
- local sup = getsup(parent)
setsup(prev,nucleus)
setsub(prev,sub)
local dummy = copy_node(nucleus)
setchar(dummy,0)
setnucleus(parent,dummy)
setsub(parent)
- if trace_collapsing then
- report_collapsing("fixing subscript")
- end
elseif not psup then
-- {f} {'}_n => f_n^'
- -- setchar(current_nucleus,movesub[current_char or getchar(current_nucleus)])
+ fixsupscript(prev,current_nucleus,current_char,new_char)
local nucleus = getnucleus(parent)
- local sup = getsup(parent)
setsup(prev,nucleus)
local dummy = copy_node(nucleus)
setchar(dummy,0)
setnucleus(parent,dummy)
- if trace_collapsing then
- report_collapsing("fixing subscript")
- end
end
end
end
@@ -1605,7 +1615,9 @@ local function collapsepair(pointer,what,n,parent,nested) -- todo: switch to tur
local current_nucleus = getnucleus(parent)
if getid(current_nucleus) == math_char then
local current_char = getchar(current_nucleus)
- if not getsub(parent) and not getsup(parent) then
+ local p_sub = getsub(parent)
+ local p_sup = getsup(parent)
+ if not p_sub and not p_sup then
local mathpair = mathpairs[current_char]
if mathpair then
local next_noad = getnext(parent)
@@ -1642,24 +1654,26 @@ local function collapsepair(pointer,what,n,parent,nested) -- todo: switch to tur
flush_node(next_noad)
collapsepair(pointer,what,n,parent,true)
end
--- elseif not nested and movesub[current_char] then
--- movesubscript(parent,current_nucleus,current_char)
end
end
end
--- elseif not nested and movesub[current_char] then
--- movesubscript(parent,current_nucleus,current_char)
end
--- elseif not nested and movesub[current_char] then
--- movesubscript(parent,current_nucleus,current_char)
end
--- elseif not nested and movesub[current_char] then
--- movesubscript(parent,current_nucleus,current_char)
+ elseif p_sup then
+ if getid(p_sup) == math_char then
+ local current_char = getchar(p_sup)
+ local new_char = movesub[current_char]
+ if new_char then
+ fixsupscript(parent,p_sup,current_char,new_char)
+ end
+ end
+ return
+ end
+ local current_char = getchar(current_nucleus)
+ local new_char = movesub[current_char]
+ if new_char then
+ movesubscript(parent,current_nucleus,current_char,new_char)
end
-local current_char = getchar(current_nucleus)
-if movesub[current_char] then
- movesubscript(parent,current_nucleus,current_char)
-end
end
end
end
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 956f83636..b55ac229d 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -226,6 +226,8 @@ return {
"Ustopmath",
"Usubscript",
"Usuperscript",
+ "Unosubscript",
+ "Unosuperscript",
"Uunderdelimiter",
"Uvextensible",
"adjustspacing",
@@ -671,6 +673,8 @@ return {
"Ustopmath",
"Usubscript",
"Usuperscript",
+ "Unosubscript",
+ "Unosuperscript",
"Uunderdelimiter",
"Uvextensible",
"above",
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index eb8c1fec7..74381a37e 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 011c188be..13bb888c4 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/supp-mat.mkiv b/tex/context/base/mkiv/supp-mat.mkiv
index b265a7c5a..176233ae5 100644
--- a/tex/context/base/mkiv/supp-mat.mkiv
+++ b/tex/context/base/mkiv/supp-mat.mkiv
@@ -314,4 +314,9 @@
% \def\startdisplay{\displaybreak\ignorespaces\startpacked}
% \def\stopdisplay {\stoppacked\displaybreak\ignorespaces}
+\let\superscript \Usuperscript
+\let\subscript \Usubscript
+\let\nosuperscript\Unosuperscript
+\let\nosubscript \Unosubscript
+
\protect \endinput
diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv
index eb5b3b90a..956cfa9f3 100644
--- a/tex/context/base/mkiv/syst-aux.mkiv
+++ b/tex/context/base/mkiv/syst-aux.mkiv
@@ -7476,3 +7476,9 @@
% \appendtovaluelist{mylist}{mies}
%
% \showvalue{mylist}
+
+% \unexpanded\def\showtokenlist#1%
+% {\begingroup
+% \edef\tempstring{\the#1}%
+% \tx\ttbf\string#1: \tttf\meaning\tempstring
+% \endgroup}