summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-09-09 09:34:06 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-09-09 09:34:06 +0200
commitbfc2e20d0dfa0dfaf04b0c2c81aed20638f21c91 (patch)
treefd7f740995f6d2f8169116b0cf6444081f96c6f7 /tex/context/base/mkiv
parente2902f3463b940beaefaf51ada0b9c37966491b6 (diff)
downloadcontext-bfc2e20d0dfa0dfaf04b0c2c81aed20638f21c91.tar.gz
2016-09-09 08:26:00
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r--tex/context/base/mkiv/anch-bck.mkvi2
-rw-r--r--tex/context/base/mkiv/anch-pgr.lua237
-rw-r--r--tex/context/base/mkiv/anch-pos.lua133
-rw-r--r--tex/context/base/mkiv/cldf-scn.lua2
-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.lua84
-rw-r--r--tex/context/base/mkiv/font-ctx.lua113
-rw-r--r--tex/context/base/mkiv/font-ext.lua39
-rw-r--r--tex/context/base/mkiv/font-fea.mkvi6
-rw-r--r--tex/context/base/mkiv/font-pre.mkiv7
-rw-r--r--tex/context/base/mkiv/l-string.lua1
-rw-r--r--tex/context/base/mkiv/lpdf-fld.lua2
-rw-r--r--tex/context/base/mkiv/lpdf-tag.lua2
-rw-r--r--tex/context/base/mkiv/math-act.lua4
-rw-r--r--tex/context/base/mkiv/math-ali.mkiv17
-rw-r--r--tex/context/base/mkiv/math-dim.lua2
-rw-r--r--tex/context/base/mkiv/mult-prm.lua6
-rw-r--r--tex/context/base/mkiv/node-fnt.lua5
-rw-r--r--tex/context/base/mkiv/spac-ali.mkiv7
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin9179 -> 9305 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin368798 -> 368824 bytes
-rw-r--r--tex/context/base/mkiv/strc-mat.mkiv2
-rw-r--r--tex/context/base/mkiv/toks-scn.lua12
-rw-r--r--tex/context/base/mkiv/toks-tra.lua1
-rw-r--r--tex/context/base/mkiv/util-str.lua3
-rw-r--r--tex/context/base/mkiv/util-tab.lua3
27 files changed, 426 insertions, 268 deletions
diff --git a/tex/context/base/mkiv/anch-bck.mkvi b/tex/context/base/mkiv/anch-bck.mkvi
index fe9f9a168..cbdb90291 100644
--- a/tex/context/base/mkiv/anch-bck.mkvi
+++ b/tex/context/base/mkiv/anch-bck.mkvi
@@ -218,7 +218,7 @@
\newskip\textbackgroundskip
-\def\anch_backgrounds_text_start_par
+\def\anch_backgrounds_text_start_par % beware .. background shapes
{\endgraf % new
\textbackgroundparameter\c!before
\begingroup
diff --git a/tex/context/base/mkiv/anch-pgr.lua b/tex/context/base/mkiv/anch-pgr.lua
index dc26499bf..22b52af66 100644
--- a/tex/context/base/mkiv/anch-pgr.lua
+++ b/tex/context/base/mkiv/anch-pgr.lua
@@ -6,33 +6,38 @@ if not modules then modules = { } end modules ['anch-pgr'] = {
license = "see context related readme files"
}
--- todo: we need to clean up lists (of previous pages)
+-- This is a bit messy module but backgrounds are messy anyway. Especially when we want to
+-- follow shapes. This is work in progress (and always will be).
local format = string.format
local abs = math.abs
-local concat, sort = table.concat, table.sort
+local concat, sort, copy = table.concat, table.sort, table.copy
local splitter = lpeg.splitat(":")
local lpegmatch = lpeg.match
-local jobpositions = job.positions
-local formatters = string.formatters
+local jobpositions = job.positions
+local formatters = string.formatters
-local commands = commands
-local context = context
+local commands = commands
+local context = context
-local implement = interfaces.implement
+local implement = interfaces.implement
local report_graphics = logs.reporter("graphics")
-local f_b_tag = formatters["b:%s"]
-local f_e_tag = formatters["e:%s"]
-local f_p_tag = formatters["p:%s"]
+local f_b_tag = formatters["b:%s"]
+local f_e_tag = formatters["e:%s"]
+local f_p_tag = formatters["p:%s"]
-local f_tag_two = formatters["%s:%s"]
+local f_tag_two = formatters["%s:%s"]
-local f_point = formatters["%p"]
-local f_pair = formatters["(%p,%p)"]
-local f_path = formatters["%--t--cycle"]
+local f_point = formatters["%p"]
+local f_pair = formatters["(%p,%p)"]
+local f_path = formatters["%--t--cycle"]
+
+graphics = graphics or { }
+local backgrounds = { }
+graphics.backgrounds = backgrounds
local function regionarea(r)
local rx = r.x
@@ -52,7 +57,7 @@ end
local eps = 2
-local function add(t,x,y,last,direction)
+local function add(t,x,y,direction,last)
local n = #t
if n == 0 then
t[n+1] = { x, y }
@@ -63,7 +68,6 @@ local function add(t,x,y,last,direction)
if x == lx and y == ly then
-- quick skip
elseif n == 1 then
- -- if abs(lx-x) <= eps or abs(ly-y) <= eps then
if abs(lx-x) > eps or abs(ly-y) > eps then
t[n+1] = { x, y }
end
@@ -73,14 +77,17 @@ local function add(t,x,y,last,direction)
local py = tm[2]
if (direction == "down" and y > ly) or (direction == "up" and y < ly) then
-- move back from too much hang
+ tn[1] = x -- hm
elseif abs(lx-px) <= eps and abs(lx-x) <= eps then
if abs(ly-y) > eps then
tn[2] = y
end
+ t[n+1] = { x, y }
elseif abs(ly-py) <= eps and abs(ly-y) <= eps then
if abs(lx-x) > eps then
tn[1] = x
end
+ t[n+1] = { x, y }
elseif not last then
t[n+1] = { x, y }
end
@@ -92,11 +99,11 @@ end
-- t[#t+1] = { x, y }
-- end
-local function finish(t)
+local function finish(t) -- circulair list
local n = #t
if n > 1 then
local first = t[1]
- local last = t[n]
+ local last = t[n]
if abs(first[1]-last[1]) <= eps and abs(first[2]-last[2]) <= eps then
t[n] = nil
end
@@ -116,53 +123,58 @@ local function clip(t,ytop,ybot)
break
end
end
- local lp = { }
- lp[#lp+1] = { t[first][1], ytop }
+ -- or just reuse t
+ local lp = { { t[first][1], ytop } }
+ local ln = 2
for i=first+1,last-1 do
- lp[#lp+1] = { t[i][1], t[i][2] }
+ -- lp[ln] = { t[i][1], t[i][2] }
+ lp[ln] = t[i]
+ ln = ln + 1
end
- lp[#lp+1] = { t[last][1], ybot }
+ lp[ln] = { t[last][1], ybot }
return lp
end
-- todo: mark regions and free paragraphs in collected
-local function shapes(r,rx,ry,rw,rh,rd,lytop,lybot,rytop,rybot,obeyhang,r2l)
- -- we assume that we only hang per page and not cross pages
- -- which makes sense as hanging is only uses in special cases
- --
- -- we can remove data as soon as a page is done so we could
- -- remember per page and discard areas after each shipout
+-- We assume that we only hang per page and not cross pages which makes sense as hanging
+-- is only uses in special cases. We can remove data as soon as a page is done so we could
+-- remember per page and discard areas after each shipout.
+
+local function shapes(r,rx,ry,rw,rh,rd,lytop,lybot,rytop,rybot,obeyhang)
local delta = r2l and (rw - rx) or 0
- local leftshape = { { rx + delta, rh } } -- spikes get removed so we can start at the edge
- local rightshape = { { rw - delta, rh } } -- even if we hang next
+ local xleft = rx + delta
+ local xright = rw - delta
local paragraphs = r.paragraphs
- local extending = false
- if paragraphs then
+ local leftshape = { { xleft, rh } } -- spikes get removed so we can start at the edge
+ local rightshape = { { xright, rh } } -- even if we hang next
+ local extending = false
+
+ if obeyhang and paragraphs and #paragraphs > 0 then
+
for i=1,#paragraphs do
- local p = paragraphs[i]
+ local p = paragraphs[i]
local ha = p.ha
- if obeyhang and ha and ha ~= 0 then
+ if ha and ha ~= 0 then
local py = p.y
local ph = p.h
local pd = p.d
local hi = p.hi
- local hang = ha * (ph + pd)
+ local hang = ha * (ph + pd)
local py_ph = py + ph
- -- ha < 0 hi < 0 : right top
- -- ha < 0 hi > 0 : left top
if ha < 0 then
- if hi < 0 then -- right
- add(rightshape,rw - delta, py_ph,"up")
- add(rightshape,rw - delta + hi,py_ph,"up")
- add(rightshape,rw - delta + hi,py_ph + hang,"up")
- add(rightshape,rw - delta, py_ph + hang,"up")
+ if hi < 0 then
+ -- right top
+ add(rightshape,xright, py_ph, "down") -- "up"
+ add(rightshape,xright + hi,py_ph, "down") -- "up"
+ add(rightshape,xright + hi,py_ph + hang,"down") -- "up"
+ add(rightshape,xright, py_ph + hang,"down") -- "up"
else
- -- left
- add(leftshape,rx + delta,py_ph,"down")
- add(leftshape,rx + delta + hi,py_ph,"down")
- add(leftshape,rx + delta + hi,py_ph + hang,"down")
- add(leftshape,rx + delta,py_ph + hang,"down")
+ -- left top
+ add(leftshape,xleft, py_ph, "down")
+ add(leftshape,xleft + hi,py_ph, "down")
+ add(leftshape,xleft + hi,py_ph + hang,"down")
+ add(leftshape,xleft, py_ph + hang,"down")
end
else
-- maybe some day
@@ -177,17 +189,17 @@ local function shapes(r,rx,ry,rw,rh,rd,lytop,lybot,rytop,rybot,obeyhang,r2l)
local step = ph + pd
local size = #ps * step
local py_ph = py + ph
- add(leftshape,rx,py_ph,"up")
+ add(leftshape, rx,py_ph,"up")
add(rightshape,rw,py_ph,"down")
for i=1,#ps do
local p = ps[i]
local l = p[1]
local w = p[2]
- add(leftshape, rx + delta + l, py_ph,"up")
- add(rightshape,rx - delta + l + w, py_ph,"down")
+ add(leftshape, xleft + l, py_ph,"up")
+ add(rightshape,xright + l + w, py_ph,"down")
py_ph = py_ph - step
- add(leftshape, rx + delta + l, py_ph,"up")
- add(rightshape,rx - delta + l + w, py_ph,"down")
+ add(leftshape, xleft + l, py_ph,"up")
+ add(rightshape,xright + l + w, py_ph,"down")
end
extending = true
elseif extending then
@@ -198,31 +210,31 @@ local function shapes(r,rx,ry,rw,rh,rd,lytop,lybot,rytop,rybot,obeyhang,r2l)
local py_pd = py - pd
add(leftshape, leftshape [#leftshape ][1],py_ph,"up")
add(rightshape,rightshape[#rightshape][1],py_ph,"down")
- add(leftshape, rx + delta,py_ph,"up") -- shouldn't this be py_pd
- add(rightshape,rw - delta,py_ph,"down") -- shouldn't this be py_pd
+ add(leftshape, xleft ,py_ph,"up") -- shouldn't this be py_pd
+ add(rightshape,xright,py_ph,"down") -- shouldn't this be py_pd
extending = false
end
end
end
- end
- -- we can have a simple variant when no paragraphs
- if extending then
- -- not ok
- leftshape [#leftshape] [2] = rd
- rightshape[#rightshape][2] = rd
+ -- we can have a simple variant when no paragraphs
+ if extending then
+ -- not ok
+ leftshape [#leftshape] [2] = rd
+ rightshape[#rightshape][2] = rd
+ else
+ add(leftshape, xleft ,rd,"up")
+ add(rightshape,xright,rd,"down")
+ end
+
else
- add(leftshape, rx + delta,rd,"up")
- add(rightshape,rw - delta,rd,"down")
+ leftshape [2] = { xleft, rd }
+ rightshape[2] = { xright, rd }
end
- return clip(leftshape,lytop,lybot), clip(rightshape,rytop,rybot)
+ leftshape = clip(leftshape,lytop,lybot)
+ rightshape = clip(rightshape,rytop,rybot)
+ return leftshape, rightshape
end
--- local function shapes(r,rx,ry,rw,rh,rd,lytop,lybot,rytop,rybot,obeyhang)
--- local leftshape = { { rx, rh }, { rx, rd } }
--- local rightshape = { { rw, rh }, { rw, rd } }
--- return clip(leftshape,lytop,lybot), clip(rightshape,rytop,rybot)
--- end
-
local function singlepart(b,e,r,left,right,obeyhang)
local bx, by = b.x, b.y
local ex, ey = e.x, e.y
@@ -244,14 +256,6 @@ local function singlepart(b,e,r,left,right,obeyhang)
-- (at least visually) injected then it's best to stress the issue.
ex = rw
end
--- if b.r2l then
--- print("BEGIN r2l")
--- bx = b.w - bx
--- end
--- if e.r2l then
--- print("END r2l")
--- ex = e.w - ex
--- end
local area
if by == ey then
area = {
@@ -263,6 +267,14 @@ local function singlepart(b,e,r,left,right,obeyhang)
else
area = { }
local leftshapes, rightshapes = shapes(r,rx,ry,rw,rh,rd,bd,ed,bh,eh,obeyhang,b.r2l)
+
+ -- needed for shapes
+
+ bx = leftshapes[1][1]
+ ex = rightshapes[#rightshapes][1]
+
+ --
+
add(area,bx,bh-ry)
for i=1,#rightshapes do
local ri = rightshapes[i]
@@ -275,8 +287,10 @@ local function singlepart(b,e,r,left,right,obeyhang)
add(area,li[1],li[2]-ry)
end
add(area,bx,bd-ry)
- add(area,bx,bh-ry,true) -- finish last straight line (but no add as we cycle)
+ add(area,bx,bh-ry,nil,true) -- finish last straight line (but no add as we cycle)
+
finish(area)
+
for i=1,#area do
local a = area[i]
area[i] = f_pair(a[1],a[2])
@@ -313,7 +327,7 @@ local function firstpart(b,r,left,right,obeyhang)
add(area,li[1],li[2]-ry)
end
add(area,bx,bd-ry)
- add(area,bx,bh-ry,true) -- finish last straight line (but no add as we cycle)
+ add(area,bx,bh-ry,nil,true) -- finish last straight line (but no add as we cycle)
finish(area)
for i=1,#area do
local a = area[i]
@@ -395,11 +409,6 @@ local function lastpart(e,r,left,right,obeyhang)
}
end
-graphics = graphics or { }
-local backgrounds = { }
-
-graphics.backgrounds = backgrounds
-
local function calculatemultipar(tag,obeyhang)
local collected = jobpositions.collected
local b = collected[f_b_tag(tag)]
@@ -451,8 +460,9 @@ local function calculatemultipar(tag,obeyhang)
end
end
--
+ local result
if bindex == eindex then
- return {
+ result = {
list = { [b.p] = { singlepart(b,e,collected[br],left,right,obeyhang) } },
bpos = b,
epos = e,
@@ -467,28 +477,31 @@ local function calculatemultipar(tag,obeyhang)
if not r then
report_graphics("invalid middle for %a",br)
else
- local p = r.p
+ local p = r.p
local pp = list[p]
+ local mp = middlepart(r,left,right,obeyhang)
if pp then
- pp[#pp+1] = middlepart(r,left,right,obeyhang)
+ pp[#pp+1] = mp
else
- list[p] = { middlepart(r,left,right,obeyhang) }
+ list[p] = { mp }
end
end
end
- local p = e.p
+ local p = e.p
local pp = list[p]
+ local lp = lastpart(e,collected[er],left,right,obeyhang)
if pp then
- pp[#pp+1] = lastpart(e,collected[er],left,right,obeyhang)
+ pp[#pp+1] = lp
else
- list[p] = { lastpart(e,collected[er],left,right,obeyhang) }
+ list[p] = { lp }
end
- return {
+ result = {
list = list,
bpos = b,
epos = e,
}
end
+ return result
end
-- local pending = { } -- needs gc
@@ -535,7 +548,7 @@ local multilocs = {
-- if unknown context_abck : input mp-abck.mpiv ; fi ;
-local f_template_a = [[
+local f_template_a = formatters[ [[
path multiregs[], multipars[], multibox ;
string multikind[] ;
numeric multilocs[], nofmultipars ;
@@ -545,26 +558,17 @@ numeric par_strut_height, par_strut_depth, par_line_height ;
par_strut_height := %p ;
par_strut_depth := %p ;
par_line_height := %p ;
-]]
+]] ]
-local f_template_b = [[
+local f_template_b = formatters[ [[
multilocs[%s] := %s ;
multikind[%s] := "%s" ;
-multipars[%s] := (%--t--cycle) shifted - (%p,%p) ;
-]]
+multipars[%s] := simplified(%--t--cycle) shifted - (%p,%p) ;
+]] ]
-local f_template_c = [[
-multiregs[%s] := (%--t--cycle) shifted - %s ;
-]]
-
-local f_template_d = [[
+local f_template_c = formatters[ [[
setbounds currentpicture to multibox ;
-]]
-
-f_template_a = formatters[f_template_a]
-f_template_b = formatters[f_template_b]
-f_template_c = formatters[f_template_c]
-f_template_d = formatters[f_template_d]
+]] ]
local function fetchmultipar(n,anchor,page,obeyhang)
local data = pbg[n]
@@ -584,7 +588,6 @@ local function fetchmultipar(n,anchor,page,obeyhang)
if not a then
report_graphics("missing anchor %a",anchor)
else
- local trace = false
local x, y, w, h, d = a.x, a.y, a.w, a.h, a.d
local bpos = data.bpos
local bh, bd = bpos.h, bpos.d
@@ -595,12 +598,9 @@ local function fetchmultipar(n,anchor,page,obeyhang)
i, multilocs[region.location],
i, region.location,
i, region.area, x, y-region.region.y)
- if trace then
- result[#result+1] = f_template_c(i, regionarea(region.region), offset)
- end
end
data[page] = nil
- result[#result+1] = f_template_d()
+ result[#result+1] = f_template_c()
result = concat(result,"\n")
return result
end
@@ -630,22 +630,19 @@ implement {
arguments = { "string", "string", "integer", true }
}
-local f_template_a = [[
+local f_template_a = formatters[ [[
path posboxes[], posregions[] ;
numeric pospages[] ;
numeric nofposboxes ;
nofposboxes := %s ;
%t ;
-]]
+]] ]
-local f_template_b = [[
+local f_template_b = formatters[ [[
pospages[%s] := %s ;
posboxes[%s] := (%p,%p)--(%p,%p)--(%p,%p)--(%p,%p)--cycle ;
posregions[%s] := (%p,%p)--(%p,%p)--(%p,%p)--(%p,%p)--cycle ;
-]]
-
-f_template_a = formatters[f_template_a]
-f_template_b = formatters[f_template_b]
+]] ]
implement {
name = "fetchposboxes",
diff --git a/tex/context/base/mkiv/anch-pos.lua b/tex/context/base/mkiv/anch-pos.lua
index d9ec1d501..4360c9386 100644
--- a/tex/context/base/mkiv/anch-pos.lua
+++ b/tex/context/base/mkiv/anch-pos.lua
@@ -18,8 +18,8 @@ more efficient.</p>
-- eventually mp will have large numbers so we can use sp there too
local tostring, next, rawget, setmetatable = tostring, next, rawget, setmetatable
-local sort = table.sort
-local format, gmatch, match = string.format, string.gmatch, string.match
+local sort, sortedhash, sortedkeys = table.sort, table.sortedhash, table.sortedkeys
+local format, gmatch, match, find = string.format, string.gmatch, string.match, string.find
local rawget = rawget
local lpegmatch = lpeg.match
local insert, remove = table.insert, table.remove
@@ -125,6 +125,76 @@ jobpositions.used = false
-- todo: register subsets and count them indepently
+-- local function initializer()
+-- tobesaved = jobpositions.tobesaved
+-- collected = jobpositions.collected
+-- -- add sparse regions
+-- local pages = structures.pages.collected
+-- if pages then
+-- local last = nil
+-- for p=1,#pages do
+-- local region = "page:" .. p
+-- local data = collected[region]
+-- if data then
+-- last = data
+-- last.p = nil -- no need for a page
+-- elseif last then
+-- collected[region] = last
+-- end
+-- end
+-- end
+-- -- enhance regions with paragraphs
+-- -- local sorted = sortedkeys(collected)
+-- --
+-- for tag, data in next, collected do
+-- -- for i=1,#sorted do
+-- -- local tag = sorted[i]
+-- -- local data = collected[tag]
+-- local region = data.r
+-- if region then
+-- local r = collected[region]
+-- if r then
+-- local paragraphs = r.paragraphs
+-- if not paragraphs then
+-- r.paragraphs = { data }
+-- else
+-- paragraphs[#paragraphs+1] = data
+-- end
+-- nofusedregions = nofusedregions + 1
+-- else
+-- nofmissingregions = nofmissingregions + 1
+-- end
+-- else
+-- nofregular = nofregular + 1
+-- end
+-- setmetatable(data,default)
+-- end
+-- -- add metatable
+-- -- for tag, data in next, collected do
+-- -- setmetatable(data,default)
+-- -- end
+-- -- sort this data
+-- for tag, data in next, collected do
+-- -- for i=1,#sorted do
+-- -- local tag = sorted[i]
+-- -- local data = collected[tag]
+-- local region = data.r
+-- if region then
+-- local r = collected[region]
+-- if r then
+-- local paragraphs = r.paragraphs
+-- if paragraphs and #paragraphs > 1 then
+-- sort(paragraphs,sorter)
+-- end
+-- end
+-- end
+-- -- so, we can be sparse and don't need 'or 0' code
+-- end
+-- jobpositions.used = next(collected)
+-- end
+
+-- todo: categories, like par, page, ... saves find and also ordered tags then
+
local function initializer()
tobesaved = jobpositions.tobesaved
collected = jobpositions.collected
@@ -143,48 +213,51 @@ local function initializer()
end
end
end
- -- enhance regions with paragraphs
+ -- enhance regions with paragraphs -- could be a list of tags instead -- there can be too many
+ local regions = { }
+ -- for tag, data in sortedhash(collected) do --saves a sort later on but can be huge
for tag, data in next, collected do
- local region = data.r
- if region then
- local r = collected[region]
- if r then
- local paragraphs = r.paragraphs
- if not paragraphs then
- r.paragraphs = { data }
- else
+ if find(tag,"^p:") then
+ local region = data.r
+ if region then
+ local paragraphs = regions[region]
+ if paragraphs then
+ local par = match(tag,"%d+")
+ data.par = tonumber(par)
paragraphs[#paragraphs+1] = data
+ nofusedregions = nofusedregions + 1
+ elseif r == false then
+ nofmissingregions = nofmissingregions + 1
+ else
+ local r = collected[region]
+ if r then
+ local par = match(tag,"%d+")
+ data.par = tonumber(par)
+ paragraphs = { data }
+ regions[region] = paragraphs
+ nofusedregions = nofusedregions + 1
+ r.paragraphs = paragraphs
+ else
+ nofmissingregions = nofmissingregions + 1
+ regions[region] = false
+ end
end
- nofusedregions = nofusedregions + 1
else
- nofmissingregions = nofmissingregions + 1
+ nofregular = nofregular + 1
end
- else
- nofregular = nofregular + 1
end
setmetatable(data,default)
end
- -- add metatable
- -- for tag, data in next, collected do
- -- setmetatable(data,default)
- -- end
-- sort this data
- for tag, data in next, collected do
- local region = data.r
- if region then
- local r = collected[region]
- if r then
- local paragraphs = r.paragraphs
- if paragraphs and #paragraphs > 1 then
- sort(paragraphs,sorter)
- end
- end
+ for tag, paragraphs in next, regions do
+ if paragraphs then
+ sort(paragraphs,function(a,b) return a.par < b.par end)
end
- -- so, we can be sparse and don't need 'or 0' code
end
jobpositions.used = next(collected)
end
+
job.register('job.positions.collected', tobesaved, initializer)
local regions = { }
diff --git a/tex/context/base/mkiv/cldf-scn.lua b/tex/context/base/mkiv/cldf-scn.lua
index 755d7fed7..4a90c5b7e 100644
--- a/tex/context/base/mkiv/cldf-scn.lua
+++ b/tex/context/base/mkiv/cldf-scn.lua
@@ -122,7 +122,7 @@ function interfaces.implement(specification)
command = args
for i=1,#actions do
command = f_action_f(i,command)
- f[#f+1] = f_action_s(i,i)
+ f[i] = f_action_s(i,i)
end
command = f_command(f,args,command)
command = load(command)
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index c7f04f470..92a4ad6e8 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{2016.09.06 19:11}
+\newcontextversion{2016.09.09 08:21}
%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 a33b9270b..67664a557 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{2016.09.06 19:11}
+\edef\contextversion{2016.09.09 08:21}
\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 931e4e70e..b3e506b34 100644
--- a/tex/context/base/mkiv/font-con.lua
+++ b/tex/context/base/mkiv/font-con.lua
@@ -144,7 +144,9 @@ end
local unscaled = {
ScriptPercentScaleDown = true,
ScriptScriptPercentScaleDown = true,
- RadicalDegreeBottomRaisePercent = true
+ RadicalDegreeBottomRaisePercent = true,
+ NoLimitSupFactor = true,
+ NoLimitSubFactor = true,
}
function constructors.assignmathparameters(target,original) -- simple variant, not used in context
@@ -490,13 +492,13 @@ function constructors.scale(tfmdata,specification)
--
if hasmath then
constructors.assignmathparameters(target,tfmdata) -- does scaling and whatever is needed
- properties.hasmath = true
- target.nomath = false
- target.MathConstants = target.mathparameters
+ properties.hasmath = true
+ target.nomath = false
+ target.MathConstants = target.mathparameters
else
- properties.hasmath = false
- target.nomath = true
- target.mathparameters = nil -- nop
+ properties.hasmath = false
+ target.nomath = true
+ target.mathparameters = nil -- nop
end
--
-- Here we support some context specific trickery (this might move to a plugin). During the
@@ -905,42 +907,42 @@ function constructors.finalize(tfmdata)
-- tfmdata.unscaled
--
if not properties.hasmath then
- properties.hasmath = not tfmdata.nomath
+ properties.hasmath = not tfmdata.nomath
end
--
- tfmdata.MathConstants = nil
- tfmdata.postprocessors = nil
- --
- tfmdata.fontname = nil
- tfmdata.filename = nil
- tfmdata.fullname = nil
- tfmdata.name = nil -- most tricky part
- tfmdata.psname = nil
- --
- tfmdata.encodingbytes = nil
- tfmdata.embedding = nil
- tfmdata.tounicode = nil
- tfmdata.cidinfo = nil
- tfmdata.format = nil
- tfmdata.direction = nil
- tfmdata.type = nil
- tfmdata.nomath = nil
- tfmdata.designsize = nil
- --
- tfmdata.size = nil
- tfmdata.stretch = nil
- tfmdata.shrink = nil
- tfmdata.step = nil
- tfmdata.auto_expand = nil
- tfmdata.auto_protrude = nil
- tfmdata.extend = nil
- tfmdata.slant = nil
- tfmdata.units = nil
- tfmdata.units_per_em = nil
- --
- tfmdata.cache = nil
- --
- properties.finalized = true
+ tfmdata.MathConstants = nil
+ tfmdata.postprocessors = nil
+ --
+ tfmdata.fontname = nil
+ tfmdata.filename = nil
+ tfmdata.fullname = nil
+ tfmdata.name = nil -- most tricky part
+ tfmdata.psname = nil
+ --
+ tfmdata.encodingbytes = nil
+ tfmdata.embedding = nil
+ tfmdata.tounicode = nil
+ tfmdata.cidinfo = nil
+ tfmdata.format = nil
+ tfmdata.direction = nil
+ tfmdata.type = nil
+ tfmdata.nomath = nil
+ tfmdata.designsize = nil
+ --
+ tfmdata.size = nil
+ tfmdata.stretch = nil
+ tfmdata.shrink = nil
+ tfmdata.step = nil
+ tfmdata.auto_expand = nil
+ tfmdata.auto_protrude = nil
+ tfmdata.extend = nil
+ tfmdata.slant = nil
+ tfmdata.units = nil
+ tfmdata.units_per_em = nil
+ --
+ tfmdata.cache = nil
+ --
+ properties.finalized = true
--
return tfmdata
end
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index 98accd7a3..b1f16fa5c 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -14,7 +14,7 @@ if not modules then modules = { } end modules ['font-ctx'] = {
local context, commands = context, commands
-local format, gmatch, match, find, lower, gsub, byte = string.format, string.gmatch, string.match, string.find, string.lower, string.gsub, string.byte
+local format, gmatch, match, find, lower, gsub, byte, topattern = string.format, string.gmatch, string.match, string.find, string.lower, string.gsub, string.byte, string.topattern
local concat, serialize, sort, fastcopy, mergedtable = table.concat, table.serialize, table.sort, table.fastcopy, table.merged
local sortedhash, sortedkeys, sequenced = table.sortedhash, table.sortedkeys, table.sequenced
local settings_to_hash, hash_to_string = utilities.parsers.settings_to_hash, utilities.parsers.hash_to_string
@@ -156,13 +156,13 @@ helpers.name = getfontname
if _LUAVERSION < 5.2 then
- utilities.strings.formatters.add(formatters,"font:name", [["'"..fontname(%s).."'"]], "local fontname = fonts.helpers.name")
- utilities.strings.formatters.add(formatters,"font:features",[["'"..sequenced(%s," ",true).."'"]],"local sequenced = table.sequenced")
+ formatters.add(formatters,"font:name", [["'"..fontname(%s).."'"]], "local fontname = fonts.helpers.name")
+ formatters.add(formatters,"font:features",[["'"..sequenced(%s," ",true).."'"]],"local sequenced = table.sequenced")
else
- utilities.strings.formatters.add(formatters,"font:name", [["'"..fontname(%s).."'"]], { fontname = helpers.name })
- utilities.strings.formatters.add(formatters,"font:features",[["'"..sequenced(%s," ",true).."'"]],{ sequenced = table.sequenced })
+ formatters.add(formatters,"font:name", [["'"..fontname(%s).."'"]], { fontname = helpers.name })
+ formatters.add(formatters,"font:features",[["'"..sequenced(%s," ",true).."'"]],{ sequenced = table.sequenced })
end
@@ -175,58 +175,62 @@ constructors.nofsharedhashes = 0
constructors.nofsharedvectors = 0
constructors.noffontsloaded = 0
-local shares = { }
-local hashes = { }
-
-function constructors.trytosharefont(target,tfmdata)
- constructors.noffontsloaded = constructors.noffontsloaded + 1
- if constructors.sharefonts then
- local fonthash = target.specification.hash
- if fonthash then
- local properties = target.properties
- local fullname = target.fullname
- local sharedname = hashes[fonthash]
- if sharedname then
- -- this is ok for context as we know that only features can mess with font definitions
- -- so a similar hash means that the fonts are similar too
- if trace_defining then
- report_defining("font %a uses backend resources of font %a (%s)",target.fullname,sharedname,"common hash")
- end
- target.fullname = sharedname
- properties.sharedwith = sharedname
- constructors.nofsharedfonts = constructors.nofsharedfonts + 1
- constructors.nofsharedhashes = constructors.nofsharedhashes + 1
- else
- -- the one takes more time (in the worst case of many cjk fonts) but it also saves
- -- embedding time
- local characters = target.characters
- local n = 1
- local t = { target.psname }
- local u = sortedkeys(characters)
- for i=1,#u do
- local k = u[i]
- n = n + 1 ; t[n] = k
- n = n + 1 ; t[n] = characters[k].index or k
- end
- local checksum = md5.HEX(concat(t," "))
- local sharedname = shares[checksum]
+do
+
+ local shares = { }
+ local hashes = { }
+
+ function constructors.trytosharefont(target,tfmdata)
+ constructors.noffontsloaded = constructors.noffontsloaded + 1
+ if constructors.sharefonts then
+ local fonthash = target.specification.hash
+ if fonthash then
+ local properties = target.properties
local fullname = target.fullname
+ local sharedname = hashes[fonthash]
if sharedname then
+ -- this is ok for context as we know that only features can mess with font definitions
+ -- so a similar hash means that the fonts are similar too
if trace_defining then
- report_defining("font %a uses backend resources of font %a (%s)",fullname,sharedname,"common vector")
+ report_defining("font %a uses backend resources of font %a (%s)",target.fullname,sharedname,"common hash")
end
- fullname = sharedname
- properties.sharedwith= sharedname
+ target.fullname = sharedname
+ properties.sharedwith = sharedname
constructors.nofsharedfonts = constructors.nofsharedfonts + 1
- constructors.nofsharedvectors = constructors.nofsharedvectors + 1
+ constructors.nofsharedhashes = constructors.nofsharedhashes + 1
else
- shares[checksum] = fullname
+ -- the one takes more time (in the worst case of many cjk fonts) but it also saves
+ -- embedding time
+ local characters = target.characters
+ local n = 1
+ local t = { target.psname }
+ local u = sortedkeys(characters)
+ for i=1,#u do
+ local k = u[i]
+ n = n + 1 ; t[n] = k
+ n = n + 1 ; t[n] = characters[k].index or k
+ end
+ local checksum = md5.HEX(concat(t," "))
+ local sharedname = shares[checksum]
+ local fullname = target.fullname
+ if sharedname then
+ if trace_defining then
+ report_defining("font %a uses backend resources of font %a (%s)",fullname,sharedname,"common vector")
+ end
+ fullname = sharedname
+ properties.sharedwith= sharedname
+ constructors.nofsharedfonts = constructors.nofsharedfonts + 1
+ constructors.nofsharedvectors = constructors.nofsharedvectors + 1
+ else
+ shares[checksum] = fullname
+ end
+ target.fullname = fullname
+ hashes[fonthash] = fullname
end
- target.fullname = fullname
- hashes[fonthash] = fullname
end
end
end
+
end
directives.register("fonts.checksharing",function(v)
@@ -584,6 +588,15 @@ local function presetcontext(name,parent,features) -- will go to con and shared
return number, t
end
+local function adaptcontext(pattern,features)
+ local pattern = topattern(pattern,false,true)
+ for name in next, setups do
+ if find(name,pattern) then
+ presetcontext(name,name,features)
+ end
+ end
+end
+
-- local function contextnumber(name) -- will be replaced
-- local t = setups[name]
-- if not t then
@@ -2122,6 +2135,12 @@ do
actions = presetcontext
}
+ implement {
+ name = "adaptfontfeature",
+ arguments = { "string", "string" },
+ actions = adaptcontext
+ }
+
local cache = { }
local hows = {
diff --git a/tex/context/base/mkiv/font-ext.lua b/tex/context/base/mkiv/font-ext.lua
index 4af279590..e57c4e56c 100644
--- a/tex/context/base/mkiv/font-ext.lua
+++ b/tex/context/base/mkiv/font-ext.lua
@@ -1162,10 +1162,47 @@ implement {
-- name = "ignoremathconstants",
-- description = "ignore math constants table",
-- initializers = {
--- base = function(tfmdata,key,value)
+-- base = function(tfmdata,value)
-- if value then
-- tfmdata.mathparameters = nil
-- end
-- end
-- }
-- }
+
+-- tfmdata.properties.mathnolimitsmode = tonumber(value) or 0
+
+do
+
+ local splitter = lpeg.splitat(",",tonumber)
+ local lpegmatch = lpeg.match
+
+ local function initialize(tfmdata,value)
+ local mathparameters = tfmdata.mathparameters
+ if mathparameters then
+ local sup, sub
+ if type(value) == "string" then
+ sup, sub = lpegmatch(splitter,value)
+ if not sup then
+ sub, sup = 0, 0
+ elseif not sub then
+ sub, sup = sup, 0
+ end
+ elseif type(value) == "number" then
+ sup, sub = 0, value
+ end
+ mathparameters.NoLimitSupFactor = sup
+ mathparameters.NoLimitSubFactor = sub
+ end
+ end
+
+ registerotffeature {
+ name = "mathnolimitsmode",
+ description = "influence nolimits placement",
+ initializers = {
+ base = initialize,
+ node = initialize,
+ }
+ }
+
+end
diff --git a/tex/context/base/mkiv/font-fea.mkvi b/tex/context/base/mkiv/font-fea.mkvi
index 4a4034225..354fc6310 100644
--- a/tex/context/base/mkiv/font-fea.mkvi
+++ b/tex/context/base/mkiv/font-fea.mkvi
@@ -125,6 +125,12 @@
\def\font_basics_define_font_feature[#featureset][#parent][#settings]%
{\clf_definefontfeature{#featureset}{#parent}{#settings}}
+\unexpanded\def\adaptfontfeature
+ {\dodoubleargument\font_basics_adapt_font_feature}
+
+\def\font_basics_adapt_font_feature[#pattern][#settings]%
+ {\clf_adaptfontfeature{#pattern}{#settings}}
+
\unexpanded\def\fontfeatureslist
{\dodoubleargument\font_basics_features_list}
diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv
index 5d93ab4f1..a9910e0c9 100644
--- a/tex/context/base/mkiv/font-pre.mkiv
+++ b/tex/context/base/mkiv/font-pre.mkiv
@@ -249,12 +249,19 @@
% liga=yes, % makes no sense
% tlig=yes, % makes no sense
% trep=yes, % makes no sense
+ mathnolimitsmode={0,750}, % this looks okay on the average font
mathalternates=yes,
mathitalics=yes, % we pass them
% mathgaps=yes,
language=dflt,
script=math]
+\ifdefined\mathnolimitsmode
+ \mathnolimitsmode\plusone % font driven (only opentype)
+\fi
+
+% \adaptfontfeature[*math*][mathnolimitsmode=1000] % only subscript
+
\definefontfeature
[mathematics-l2r]
[mathematics]
diff --git a/tex/context/base/mkiv/l-string.lua b/tex/context/base/mkiv/l-string.lua
index e9dc2bbbc..88297f2e6 100644
--- a/tex/context/base/mkiv/l-string.lua
+++ b/tex/context/base/mkiv/l-string.lua
@@ -177,6 +177,7 @@ function string.topattern(str,lowercase,strict)
end
end
+-- print(string.escapedpattern("abc*234",true))
-- print(string.escapedpattern("12+34*.tex",false))
-- print(string.escapedpattern("12+34*.tex",true))
-- print(string.topattern ("12+34*.tex",false,false))
diff --git a/tex/context/base/mkiv/lpdf-fld.lua b/tex/context/base/mkiv/lpdf-fld.lua
index b1401200f..bbafb299b 100644
--- a/tex/context/base/mkiv/lpdf-fld.lua
+++ b/tex/context/base/mkiv/lpdf-fld.lua
@@ -247,7 +247,7 @@ local mapping = {
local function fieldactions(specification) -- share actions
local d = nil
- for key, target in next, mapping do
+ for key, target in sortedhash(mapping) do -- sort so that we can compare pdf
local code = specification[key]
if code and code ~= "" then
-- local a = checked(code)
diff --git a/tex/context/base/mkiv/lpdf-tag.lua b/tex/context/base/mkiv/lpdf-tag.lua
index ee72181ba..3167aeb5c 100644
--- a/tex/context/base/mkiv/lpdf-tag.lua
+++ b/tex/context/base/mkiv/lpdf-tag.lua
@@ -158,7 +158,6 @@ local function finishstructure()
}
addtocatalog("MarkInfo",pdfreference(pdfflushobject(markinfo)))
--
- -- for fulltag, element in next, elements do
for fulltag, element in sortedhash(elements) do -- sorting is easier on comparing pdf
pdfflushobject(element.knum,element.kids)
end
@@ -192,7 +191,6 @@ local pdf_userproperties = pdfconstant("UserProperties")
local function makeattribute(t)
if t and next(t) then
local properties = pdfarray()
- -- for k, v in next, t do
for k, v in sortedhash(t) do -- easier on comparing pdf
properties[#properties+1] = pdfdictionary {
N = pdfunicode(k),
diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua
index d47d29179..83ea0996b 100644
--- a/tex/context/base/mkiv/math-act.lua
+++ b/tex/context/base/mkiv/math-act.lua
@@ -59,7 +59,9 @@ local how = {
-- RadicalKernAfterDegree = "horizontal",
ScriptPercentScaleDown = "unscaled",
ScriptScriptPercentScaleDown = "unscaled",
- RadicalDegreeBottomRaisePercent = "unscaled"
+ RadicalDegreeBottomRaisePercent = "unscaled",
+ NoLimitSupFactor = "unscaled",
+ NoLimitSubFactor = "unscaled",
}
function mathematics.scaleparameters(target,original)
diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv
index 2456efd22..b77af6383 100644
--- a/tex/context/base/mkiv/math-ali.mkiv
+++ b/tex/context/base/mkiv/math-ali.mkiv
@@ -25,6 +25,8 @@
%D Modules may provide additional alignment features. The following
%D mechanisms are provided by the core.
+% why all these spans
+
% n>1 ### needed, strange # interaction in recurse
\newtoks\t_math_align_a
@@ -243,7 +245,8 @@
\def\math_alignment_NC_first#1\NR
{\glet\math_alignment_NC\math_alignment_NC_rest
- \scratchtoks{\math_number_left_of_eqalign\aligntab#1\NR}%
+ %\scratchtoks{\math_number_left_of_eqalign\aligntab#1\NR}%
+ \scratchtoks{\aligntab#1\NR}%
\dodoubleempty\math_alignment_NC_first_indeed}
\def\math_alignment_NC_first_indeed[#1][#2]%
@@ -399,12 +402,12 @@
\fi
\fi}
-\def\math_number_left_of_eqalign
- {\ifcase\wd\b_strc_formulas_number\else
- \ifcase\c_strc_math_number_location\or
- \box\b_strc_formulas_number
- \fi
- \fi}
+% \def\math_number_left_of_eqalign
+% {\ifcase\wd\b_strc_formulas_number\else
+% \ifcase\c_strc_math_number_location\or
+% \box\b_strc_formulas_number
+% \fi
+% \fi}
\def\math_eqalign_set_column#1% we could just add to the preamble (as with other alignments)
{\expandafter\let\csname\??mathalignmentvariant\number\c_math_eqalign_column\expandafter\endcsname
diff --git a/tex/context/base/mkiv/math-dim.lua b/tex/context/base/mkiv/math-dim.lua
index b5241cb5a..ba0235a5b 100644
--- a/tex/context/base/mkiv/math-dim.lua
+++ b/tex/context/base/mkiv/math-dim.lua
@@ -99,6 +99,8 @@ local defaults = {
radical_degree_before = { default = { "RadicalKernBeforeDegree", "(5/18)*quad" }, },
radical_degree_after = { default = { "RadicalKernAfterDegree", "(-10/18)*quad" }, },
radical_degree_raise = { default = { "RadicalDegreeBottomRaisePercent", "60" }, },
+ no_limit_sub_factor = { default = { "NoLimitSubFactor", "0" }, },
+ no_limit_sup_factor = { default = { "NoLimitSupFactor", "0" }, },
}
local styles = {
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 9d10cf6c1..acbd52088 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -210,6 +210,8 @@ return {
"Umathunderbarvgap",
"Umathunderdelimiterbgap",
"Umathunderdelimitervgap",
+ "Umathnolimitsupfactor",
+ "Umathnolimitsubfactor",
"Umiddle",
"Uoverdelimiter",
"Uradical",
@@ -283,6 +285,7 @@ return {
"mathdir",
"mathdisplayskipmode",
"matheqnogapstep",
+ "mathnolimitsmode",
"mathoption",
"mathscriptsmode",
"mathstyle",
@@ -641,6 +644,8 @@ return {
"Umathunderbarvgap",
"Umathunderdelimiterbgap",
"Umathunderdelimitervgap",
+ "Umathnolimitsupfactor",
+ "Umathnolimitsubfactor",
"Umiddle",
"Uoverdelimiter",
"Uradical",
@@ -923,6 +928,7 @@ return {
"mathdisplayskipmode",
"matheqnogapstep",
"mathinner",
+ "mathnolimitsmode",
"mathop",
"mathopen",
"mathoption",
diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua
index 0fb8821e8..60b1f8332 100644
--- a/tex/context/base/mkiv/node-fnt.lua
+++ b/tex/context/base/mkiv/node-fnt.lua
@@ -78,11 +78,6 @@ local setmetatableindex = table.setmetatableindex
--
-- maybe getting rid of the intermediate shared can save some time
--- potential speedup: check for subtype < 256 so that we can remove that test
--- elsewhere, danger: injected nodes will not be dealt with but that does not
--- happen often; we could consider processing sublists but that might need more
--- checking later on; the current approach also permits variants
-
local run = 0
local setfontdynamics = { }
diff --git a/tex/context/base/mkiv/spac-ali.mkiv b/tex/context/base/mkiv/spac-ali.mkiv
index bfd4d5426..e0deb8a77 100644
--- a/tex/context/base/mkiv/spac-ali.mkiv
+++ b/tex/context/base/mkiv/spac-ali.mkiv
@@ -1294,10 +1294,11 @@
% Some obsolete (old) helpers:
-\def\dodefinehbox[#1][#2]%
+\unexpanded\def\definehbox
+ {\dodoubleargument\spac_align_definehbox}
+
+\def\spac_align_definehbox[#1][#2]%
{\setvalue{hbox#1}##1{\hbox to #2{\begstrut##1\endstrut\hss}}}
-\unexpanded\def\definehbox
- {\dodoubleargument\dodefinehbox}
\protect \endinput
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index dad6fd02e..422b93537 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 a941430ad..726f5ef16 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-mat.mkiv b/tex/context/base/mkiv/strc-mat.mkiv
index fba6b5ee2..8ff087a8c 100644
--- a/tex/context/base/mkiv/strc-mat.mkiv
+++ b/tex/context/base/mkiv/strc-mat.mkiv
@@ -821,10 +821,12 @@
\ifcase\c_strc_formulas_mode
\noindent % prevents that tex injects empty line (when using native display mechanism)
\Ucheckedstartdisplaymath
+ \the\everydisplay % new (probably too much)
\or
\setbox\b_strc_formulas_content\hbox\bgroup
\normalUstartmath
\displaystyle
+ \the\everydisplay % new (probably too much)
\else
\expandafter\startinnermath
\fi}
diff --git a/tex/context/base/mkiv/toks-scn.lua b/tex/context/base/mkiv/toks-scn.lua
index 5c8dee8f3..696478144 100644
--- a/tex/context/base/mkiv/toks-scn.lua
+++ b/tex/context/base/mkiv/toks-scn.lua
@@ -292,7 +292,8 @@ function tokens.compile(specification)
tokens._action = a
for i=1,#a do
code = f_action_f(i,code)
- f[#f+1] = f_action_s(i,i)
+-- f[#f+1] = f_action_s(i,i)
+n = n + 1 f[n] = f_action_s(i,i)
end
code = f_simple(f,code)
else
@@ -309,7 +310,8 @@ function tokens.compile(specification)
tokens._action = a
for i=1,#a do
code = f_action_f(i,code)
- f[#f+1] = f_action_s(i,i)
+-- f[#f+1] = f_action_s(i,i)
+n = n + 1 f[n] = f_action_s(i,i)
end
end
code = f_table(f,ti,code)
@@ -318,7 +320,8 @@ function tokens.compile(specification)
tokens._action = a
for i=1,#a do
code = f_action_f(i,code)
- f[#f+1] = f_action_s(i,i)
+-- f[#f+1] = f_action_s(i,i)
+n = n + 1 f[n] = f_action_s(i,i)
end
code = f_simple(f,code)
else
@@ -365,7 +368,8 @@ function tokens.compile(specification)
tokens._action = a
for i=1,#a do
code = f_action_f(i,code)
- f[#f+1] = f_action_s(i,i)
+-- f[#f+1] = f_action_s(i,i)
+n = n + 1 f[n] = f_action_s(i,i)
end
end
code = f_sequence(c,f,p,code)
diff --git a/tex/context/base/mkiv/toks-tra.lua b/tex/context/base/mkiv/toks-tra.lua
index a1408b0b8..3a5bc1306 100644
--- a/tex/context/base/mkiv/toks-tra.lua
+++ b/tex/context/base/mkiv/toks-tra.lua
@@ -5,6 +5,7 @@ if not modules then modules = { } end modules ['toks-ini'] = {
license = "see context related readme files"
}
+-- this will become a module
local utfbyte, utfchar, utfvalues = utf.byte, utf.char, utf.values
local format, gsub = string.format, string.gsub
diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua
index 42dbf16b3..fb510257a 100644
--- a/tex/context/base/mkiv/util-str.lua
+++ b/tex/context/base/mkiv/util-str.lua
@@ -826,7 +826,8 @@ local format_extension = function(extensions,f,name)
local t = { }
for i=1,f do
n = n + 1
- t[#t+1] = "a" .. n
+ -- t[#t+1] = "a" .. n
+ t[i] = "a" .. n
end
return format(extension,unpack(t))
end
diff --git a/tex/context/base/mkiv/util-tab.lua b/tex/context/base/mkiv/util-tab.lua
index b8b9091b0..9266598db 100644
--- a/tex/context/base/mkiv/util-tab.lua
+++ b/tex/context/base/mkiv/util-tab.lua
@@ -169,7 +169,8 @@ function table.tocsv(t,specification)
r[f] = tostring(field)
end
end
- result[#result+1] = concat(r,separator)
+ -- result[#result+1] = concat(r,separator)
+ result[i+1] = concat(r,separator)
end
return concat(result,"\n")
else